In MaterialX, is it possible to get the vector from the surface to a particular light? Right now, I'm creating an attribute in SOPs to store the information, then reading it as a geometry attribute in the shader. It works, but seems inelegant. I can get similar info from a dot node and putting "ray" in the note field. Maybe there is something similar for light direction?
I'm trying to create a shader where the color changes based on the relationship between the light position and surface normal. Kinda like 3dsMax's "shadow/light falloff".
As far as I know, you still need to use your "manual" method. I believe there is currently no way around storing the light pos and calculating the light direction vector manually.
BradThompson In MaterialX, is it possible to get the vector from the surface to a particular light? Right now, I'm creating an attribute in SOPs to store the information, then reading it as a geometry attribute in the shader. It works, but seems inelegant. I can get similar info from a dot node and putting "ray" in the note field. Maybe there is something similar for light direction?
I'm trying to create a shader where the color changes based on the relationship between the light position and surface normal. Kinda like 3dsMax's "shadow/light falloff".
Thanks!
Brad T.
You can in a light shader. A surface shader doesn't know about values that are created at light shader evaluation time.
for what you are doing, you can probably use coordsys [www.sidefx.com] to access position of your light or any transformable prim
it's probably not as elegant as being able to access light directly by defining relationship or by path, but should be better than having to store primvars
if however you need per sample access to any light that the surface shader is evaluating, I'm not sure that's possible from surface shader as jsmack mentioned, since I believe there is no illuminance loop equivalent in Karma