Vector property missing when translating RSL to OSL


anders.steen98@...
 

This was originally posted in the RenderMan forum, but I think someone here might know the answer, so I'll try posting here.

I'm in the process of translating the wood BRDF from the paper Measuring and Modeling the Appearance of Finished Wood by Marschner et al. from RenderMan Shading Language to Open Shading Language.
One line reads:

  1. thOutPrime = asin ( ssOutDir.axis );

where ssOutDir is a vector and thOutPrime is a float.
The OSL compiler complains about that line, saying there is no 'axis' property of a vector, so I'm wondering what the axis property actually is equivalent to. I've scoured the docs and forums but have found no answer. Anyone who knows and can tell me?


Larry Gritz
 

In the original RSL, there were no structures, and "." was appropriated to be the dot product operator! (We later came to regret that once the utility of structures was evident.)

So I think what you want is

    thOutPrime = asin(dot(ssOutDir, axis));

(This was the second response I wrote to your email, the first being just totally perplexed and begging to see the declaration ofssOutDir. Then I started thinking about the "asin" and why anybody would ever take the component-by-component asin of a vector, that made no sense. Then just before I hit "send", I realized that asin is useful for computing the angle between two vectors from their dot product... and it all fell into place.)


On Dec 27, 2021, at 6:31 AM, anders.steen98@... wrote:

This was originally posted in the RenderMan forum, but I think someone here might know the answer, so I'll try posting here.

I'm in the process of translating the wood BRDF from the paper Measuring and Modeling the Appearance of Finished Wood by Marschner et al. from RenderMan Shading Language to Open Shading Language.
One line reads:

  1. thOutPrime = asin ( ssOutDir.axis );

where ssOutDir is a vector and thOutPrime is a float.
The OSL compiler complains about that line, saying there is no 'axis' property of a vector, so I'm wondering what the axis property actually is equivalent to. I've scoured the docs and forums but have found no answer. Anyone who knows and can tell me?


--
Larry Gritz