Isotropix Forums

Runtime Scripting to Modulate material parameters

Clarisse Scripting related topics

Runtime Scripting to Modulate material parameters

Unread postby igbw712 » Tue Feb 07, 2017 9:23 pm

How do you create a runtime script/expression? Say I want to modulate some parameter over time with math how is that accomplished? I know python enough to modify and re-purpose code. It'd be so nice to have a script/expression node I could script that I could code to control any parameter over time in any material node(be really cool if it had pre-built example functions like in xGen in Maya). Any ideas or examples of ways to do this?
igbw712
 
Posts: 47
Joined: Tue Nov 29, 2016 5:11 pm

Re: Runtime Scripting to Modulate material parameters

Unread postby halim » Fri Mar 10, 2017 4:46 am

Hello,

Unfortunately a runtime python script/expression is not possible in Clarisse, unlike traditional Dccs like Maya as python interpretation would introduce a major leak of performane within the scene graph evaluation. OSL is probably the best way to acheive this. You could use a texture OSL script/file node hooked up on the channel you want to drive.

Best

-H.
Halim Negadi
Technical Artist - Clarisse Specialist
User avatar
halim
 
Posts: 141
Joined: Thu Nov 21, 2013 8:27 pm

Re: Runtime Scripting to Modulate material parameters

Unread postby igbw712 » Wed Sep 27, 2017 10:51 pm

Could put together a simple project and link to it using a texture OSL script/file node hooked up on the channel that you're driving? I can't seem to figure it out. Thanks!
igbw712
 
Posts: 47
Joined: Tue Nov 29, 2016 5:11 pm

Re: Runtime Scripting to Modulate material parameters

Unread postby gjennings » Thu Oct 12, 2017 12:18 pm

Hi,

attached is a simple project with a sphere and a standard material.
The diffuse color attribute is bind to a OSL_script texture.

In the OSL_Script, go down to the "Shader" tab and click the three dots [...] to open up the OSL script editor:

shader ClarisseOSLTexture
[[ string help = "Default Clarisse Texture" ]]
( color input1 = color(1, 0, 0) [[ string help = "Input color 1" ]],
string time_input = "$F" [[ string widget = "null"]],
output color result = 0)

{
result = input1 * time;
}



Here we multiply the input1 (red color by default) by time.
(The line <string time_input = "$F" [[ string widget = "null"]],> was added to automatically "dirty" the timeline for it to work.)

Hope this helps, let us know !
Cheers,
Attachments
OSL_Script.project
(46.44 KiB) Downloaded 4 times
User avatar
gjennings
 
Posts: 21
Joined: Sun Feb 28, 2016 6:53 am


Return to Scripting