custom UI for RenderMan shader with slo2otl.py

   6724   6   1
User Avatar
Member
288 posts
Joined: July 2005
Offline
I usually use slo2otl.py to create the otl from RenderMan slo file. I want to create the menu in the UI can choose different type of the things like the vex shader, or the toggle to enable or disable the parameters. Without this I can only use numbers to switch them, not good UI.

So, Are there any way to custom the UI through this command or anyway else?
^_^
User Avatar
Staff
2591 posts
Joined: July 2005
Offline
ykcosmo
I usually use slo2otl.py to create the otl from RenderMan slo file. I want to create the menu in the UI can choose different type of the things like the vex shader, or the toggle to enable or disable the parameters. Without this I can only use numbers to switch them, not good UI.

So, Are there any way to custom the UI through this command or anyway else?
Once the .otl has been built, you can customize it by editing the type properties.

But, if you need to remake the OTL, you will most likely lose your changes.

The alternative, is to include pragmas in your code and declare the function & arguments as a VEX function (in addition to the RSL function). Then you can generate the .otl using the VEX compiler (vcc). This tends to make the shader code a little harder to read though.

For example:

#pragma rendermask RIB
#pragma label red “The Red Parameter”
#pragma hint red color

#if defined(__vex)
surface flatred(vector red={1,0,0}) {}
#else

surface
flatred(color red=color(1,0,0))
{
Ci = red;
}
#endif


Then compile with vcc:

% vcc -l flatred.otl flatred.sl
User Avatar
Member
288 posts
Joined: July 2005
Offline
It works, thank you !

And I tried to make the toggle, it worked but there was a warming:

S31003 {WARNING} RIB value for “x” in shader “flatred” on gprim “/obj/platonic_object1” was not declared.

Here is my sl code:

#pragma rendermask RIB
#pragma label red “The Red Parameter”
#pragma hint red color

#pragma label x “toggle blue”
#pragma hint x toggle

#if defined(__vex)
surface flatred(vector red={1,0,0}; float x = 0) {}
#else

surface
flatred(color red = color (1,0,0); float x = 0)
{
color blue = color (0,0,1);
Ci = red + x * blue;
}
#endif


Also, this is not the best to make toggle parameter, I tried to use if {}but doesn't work.

Could you make a toggle example?
^_^
User Avatar
Staff
2591 posts
Joined: July 2005
Offline
ykcosmo
It works, thank you !

And I tried to make the toggle, it worked but there was a warming:

Could you make a toggle example?

Did you remember to re-compile the shader for RenderMan? I got the warning until I remembered to recompile it using “shader flatred.sl”.
User Avatar
Member
288 posts
Joined: July 2005
Offline
yes, I re-complied it….
^_^
User Avatar
Staff
2591 posts
Joined: July 2005
Offline
ykcosmo
yes, I re-complied it….

Then I'm at a loss since your shader worked perfectly for me (no warning).

By toggling it, do you get magenta instead of red? Maybe your re-compiled shader isn't being picked up in the shader path?
User Avatar
Member
288 posts
Joined: July 2005
Offline
very odd….

I put them in the same directory as my hip is, also I assigned the shader path as $HIP with the default path.

I tried it again, re-complied the shader and otl. I got the magenta color when I toggle the blue, so the shader works, but still get that warning, very odd…

Please see my attachment, I put the hip, sl, and otl in it.

I was running mac OSX 10.6.1 with houdini 10.0.401.

Attachments:
Archive.zip (26.3 KB)

^_^
  • Quick Links