Re: primitive variables

Larry Gritz <l...@...>

Thanks for the email, Simon!

Yes, OSL already has primitive variables. I agree that it would be handy to have a built-in function that tells you if the particular value is the default, from a connection (not an option in RMan), has an instance value, or is from a geometric primitive value. I've thought of this before, but never got around to it. Thanks for the reminder, we'll add this, it's quite easy.

As for the coordinate systems, that's actually a renderer API issue -- in the RMan world, there is a hierarchical coordinate system being maintained by the renderer as the scene is input (TransformBegin, ConcatMatrix, etc.). The rule is that any point/vector/normal or matrix is always expressed relative to the *current* transformation matrix (CTM), and upon going through the RI interface, is automatically transformed to coordinate system that everything will be shaded in.

This doesn't impact the working of RSL itself, nor does it affect OSL. A renderer using OSL is free to impose this rule, or not, on its API. I've long thought that in RMan-like APIs -- and I always planned to do this with the Gelato API some day, but never did -- there ought to be a way to pass a point/vector/normal *already* in current/common units so that no transformation occurs. I'll remember to do that in the next renderer API I set up. (Whew, let me get this language stable, then maybe I'll move on to that.)

-- lg

On Feb 4, 2010, at 4:45 AM, Simon Bunker wrote:

Just wondering if you have thought about binding shader parameters to
geometry like you can with primitive variables in RenderMan.
Specifically - if you are going to do something like this - it would
be good to have a better approach than RenderMan. The two areas that
always cause issues for me:

- working out if it exists at all. In RenderMan eg for a rest position
variable (eg Pref) you have to have the variable available to be
filled in, but it may not be on a primitive. It is quite hard to
determine if it is the default value, or if it has been assigned by
the primitive. I think Houdini VEX does have a shadeop to tell you

- primitive variable space. RenderMan tries to be too clever by doing
an implicit object-> current transformation. Often this is not what
you want. This should either have a flag on the geometry definition to
say what space it is in, or leave it alone and leave it up to the
shader writer.

I think it is really important to have this functionality in place to
make shader writers lives easier!


Larry Gritz

Join to automatically receive all group messages.