Sign in to follow this  
Basiror

fragment program: pixel position in worldspace

Recommended Posts

Just use a vertex shader,and use one texture coordinate set to store the worldspace position as a vector(not normalized).It will be interpolated and you can retrieve it in the fragment program.Just as you do for the light vector,for instance.Actually,just the lightvector is enought for attenuation purposes.Just don't normalize it in the vertex program,but only in the fragment program when needed(for DOT3 operations).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this