PDA

View Full Version : How can i get the unit direction vector to the point light source from a point on OBJ


SIMPLE
03-12-2004, 10:47 PM
i got this problem when i try do a LAMBERT use surfaceShader in maya(just for comprehend the theory in the book),

i have tried two ways for solve this problem:

1,
There is a lightDirection Attr In the surfaceLum Node ,but can not be outputed,so i use expression to do this :
setAttr surfaceLuminance1.lightDirection ;
float $LD = `getAttr surfaceLuminance1.lightDirection `;
but,in the scriptEditor say : // Error: No object matches name: surfaceLuminance1.lightDirection //

2,I create one multilisterLight Node and use lightDirection Attr In it ,multiply by -1 then setRange it 0 to 1 ,but
still some problem .

here is the scene file and thanks for your help .C:\lambert1.jpg

uschi
03-15-2004, 10:56 AM
i donīt know if i can help, on highend youīll find a toon shader that uses i think the facing ratio to achiev that wat you want - so try to reconnect it to the light direction (i donīt know how it called but its in there) :)

misterdi
03-16-2004, 04:26 AM
I'm not too familiar with surfaceLuminance node.

First create your surfaceLuminance node, create a point light, create a surface shader.

Connection:
1. Hook up surfaceLuminance outValue (scalar) to outColorR, outColorG, outColorB on the surface shader.
2. Open connection editor, load your point light shape node on the left, and surfaceLuminance node on the right.
3. Connect LightData (compound) to Light Data Array (array of compound attr).

That is the basic setup.

What the setup read, from the point light, when a ray hit the surface, light data will have light direction on that surface, if it is facing the light direction then it has value of 1, and 0 when it facing perpendicular to the light direction.

This will be use as output value of the surfaceLuminance node and then it will be pass to outColor of the surface shader.

The image I attach, using 3 surfaceLuminance node, and 3 point lights with connection to outColorR, outColorG, outColorB respectivelly

Hope this help

misterdi
03-16-2004, 04:29 AM
Sorry, I forgot to attach the rendered image.

CGTalk Moderation
01-17-2006, 05:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.