Hi,
I'm trying to create a simple phong shader (practice) but it seems that light information is inaccessible from within mat shader. I tried global variable node with light selected but that only worked within light shader node.
I know there's a lighting model node available to compose but is there anyway to access lights or other /obj information from within material shader?
Get light position from within material shader possible?
5024 4 1-
- standy727
- Member
- 2 posts
- Joined: Aug. 2010
- Offline
-
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
-
- tamte
- Member
- 9384 posts
- Joined: July 2007
- Offline
no need for export import P
just inside illuminance Loop create Global Variables VOP
and add P and L variables with Add VOP
you'll get position of the currently processed light in camera space
if you need it in world space append Transform VOP and change space from current to world
but for recreating phong shader you don't need light position because you already have L variable which is vector from currently shaded point to light
just inside illuminance Loop create Global Variables VOP
and add P and L variables with Add VOP
you'll get position of the currently processed light in camera space
if you need it in world space append Transform VOP and change space from current to world
but for recreating phong shader you don't need light position because you already have L variable which is vector from currently shaded point to light
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
-
- standy727
- Member
- 2 posts
- Joined: Aug. 2010
- Offline
-
- Quick Links

