mograph shader ISL

Announcements, requests and support regarding the Cinema 4D exporter
User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

mograph shader ISL

Post by sandidolsak » Thu Nov 22, 2012 1:09 am

Hello,

I was trying to use mographs color shader to give some variation to clones, found out soon that is not supported by exporter, I guess this would require a material for each clone...

So I went testing ISL to get variation using 3D noise, my thought process was to simply use objects position for 3D noise and apply the resulting color to whole clone, but how?

I get that pos in
def eval(vec3 pos) vec3: ...
is position of every point, so it applys the noise like expected in 3D, so now I am wondering how to get the objects position to feed it to the noise so I would get 1 color for whole objects...

Thanks for any input!

Cheers

User avatar
Zom-B
1st Place 100
Posts: 4697
Joined: Tue Jul 04, 2006 4:18 pm
Location: ´'`\_(ò_Ó)_/´'`
Contact:

Re: mograph shader ISL

Post by Zom-B » Thu Nov 22, 2012 6:34 am

afaik the exporter tries to bake every C4D shader directly, so some ISL input inside that shader wont help here :/

I remember that support for this lovely mograph Shader was requested once, but I forgot what the answer was -.-'
polygonmanufaktur.de

User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

Re: mograph shader ISL

Post by sandidolsak » Thu Nov 22, 2012 6:45 am

Heh, yea I kinda got that far, what I am trying to do now is to do what color shader does with ISL (in my case is just some color variation) so I am trying to do it in code but what I am missing is access to objects position in ISL =)

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: mograph shader ISL

Post by CTZn » Thu Nov 22, 2012 7:57 am

ISL can access the sample position in world space and object space but not the very object position in world. At the moment it must be an exporter feature to capture whatever scene data into ISL code.

Check out the last functions in the Technical Reference PDF, those ending by vec3 will return a color (or vector) straight out.

But a color can also be composed by individual components, each of the 'real' type in this case:

Code: Select all

def eval(vec3 pos) vec3 :
vec3
(
	noise(pos * 45.0) * 0.5 +0.5,	# R
	0.5,						# G
	pos.z * 0.8				# B
)
Perhaps will you figure out the way you can get what you want that way.
obsolete asset

User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

Re: mograph shader ISL

Post by sandidolsak » Thu Nov 22, 2012 11:38 am

That gives variation per sample if I understand the code, what I am after is variation per object, so each object gets different color as a whole (like random shader does it in c4d)

Well it was just a thing I was wondering if it was possible, nothing vital, just testing =)

Thanks for replies!

Cheers

User avatar
OnoSendai
Developer
Posts: 6226
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: mograph shader ISL

Post by OnoSendai » Thu Nov 22, 2012 11:42 am

Try objectId()

User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

Re: mograph shader ISL

Post by sandidolsak » Thu Nov 22, 2012 11:50 am

Aha will test that out, btw is there a simple list of stuff I can access via ISL that I could check, I cant find any information in the pdfs or ISL_stdlib.txt about objectid()... I like to exhaust all the options before I pester you guys on forum =)

Thanks alot!

User avatar
Zom-B
1st Place 100
Posts: 4697
Joined: Tue Jul 04, 2006 4:18 pm
Location: ´'`\_(ò_Ó)_/´'`
Contact:

Re: mograph shader ISL

Post by Zom-B » Thu Nov 22, 2012 12:03 pm

OnoSendai wrote:Try objectId()
could use some explanation in the technical Reference.pdf ;)
polygonmanufaktur.de

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: mograph shader ISL

Post by CTZn » Thu Nov 22, 2012 2:57 pm

Aha !

I digged this one a little, as expected it's an integer and it might well be material based ? The preview material seem to respond to the ID '3'.

Code: Select all

def eval(vec3 pos) vec3 :
vec3(
	if(objectId()==3, 0.7, 0.2)
)
I'm not saavy enough to get a unique RGB from a specific ID though...
obsolete asset

User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

Re: mograph shader ISL

Post by sandidolsak » Thu Nov 22, 2012 10:31 pm

I can't even get past using this id, so it is an integer that I would need to convert to real but it gives an error

Code: Select all

def eval(vec3 pos) vec3:
   vec3(
      real(objectId()),
   )
says it cannot find real(int) function and it is in technical reference

btw how does one use print(int), it is listed at the end of tech ref...

Sorry for this basic questions, I have alot to learn =)

Cheers

User avatar
fused
Developer
Posts: 3647
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: mograph shader ISL

Post by fused » Fri Nov 23, 2012 1:26 am

sandidolsak wrote:I can't even get past using this id, so it is an integer that I would need to convert to real but it gives an error

Code: Select all

def eval(vec3 pos) vec3:
   vec3(
      real(objectId()),
   )
says it cannot find real(int) function and it is in technical reference

btw how does one use print(int), it is listed at the end of tech ref...

Sorry for this basic questions, I have alot to learn =)

Cheers
Hi sandidolsak,

that functions is indeed in the reference but unfortunately it is not implemented currently.

We will fix this soon.

Regards,
Yves

User avatar
sandidolsak
Posts: 12
Joined: Fri Nov 16, 2012 7:15 am
Location: Slovenia

Re: mograph shader ISL

Post by sandidolsak » Fri Nov 23, 2012 2:36 am

Thanks for the info, will let it be then, time to test something else!

Cheers

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: mograph shader ISL

Post by CTZn » Fri Nov 23, 2012 4:09 am

sandidolsak wrote:btw how does one use print(int), it is listed at the end of tech ref...
You just wrap it around a value or expression... alas, it does print to the infamous stdout, as such I think it may require API access.
obsolete asset

User avatar
OnoSendai
Developer
Posts: 6226
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: mograph shader ISL

Post by OnoSendai » Fri Nov 23, 2012 11:23 am

CTZn wrote:
sandidolsak wrote:btw how does one use print(int), it is listed at the end of tech ref...
You just wrap it around a value or expression... alas, it does print to the infamous stdout, as such I think it may require API access.
Just run your scene in indigo_console, then you will see it.

User avatar
OnoSendai
Developer
Posts: 6226
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: mograph shader ISL

Post by OnoSendai » Fri Nov 23, 2012 11:24 am

sandidolsak wrote:I can't even get past using this id, so it is an integer that I would need to convert to real but it gives an error

Code: Select all

def eval(vec3 pos) vec3:
   vec3(
      real(objectId()),
   )
says it cannot find real(int) function and it is in technical reference

btw how does one use print(int), it is listed at the end of tech ref...

Sorry for this basic questions, I have alot to learn =)

Cheers

real(int x) is checked in for next 3.6 beta release.

Post Reply
16 posts

Who is online

Users browsing this forum: No registered users and 0 guests