Im am drawing a cube around a position. what i want is to get a vector from the camera(eye position) to the pixel I am drawing.
I have tried to just take the (vertex position - eye pos) in the pixel shader but that does not give the right answer, its just gives me the vector to the vertex position. In some way it is possible to get the view vector to the pixel its drawing but i cant get it to work.
Does anyone now how?
vector to pixel
Started by kruseborn, Feb 26 2009 09:39 AM
2 replies to this topic
#1
Posted 26 February 2009 - 09:39 AM
#2
Posted 26 February 2009 - 10:13 AM
Guess you wish the eye direction:
In the Vertex-Shader:
These two output fields may be declared as, lets say, TEXCOORD1 and TEXCOORD2.
In the Vertex-Shader:
output.EyePosition = mul(-View._m30_m31_m32, transpose(View)); output.EyeDirection = normalize(worldPosition - output.EyePosition);
These two output fields may be declared as, lets say, TEXCOORD1 and TEXCOORD2.
#3
Posted 26 February 2009 - 10:57 AM
works perfectly
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












