PDA

View Full Version : Some newbie questions



diaspora
09-25-2015, 05:48 PM
Hello, first time posting here.
I implemented a simple raytracer in glsl and passed the collected information (Position, Depth ("gl_Fragdepth format"), Normal and Color ) to a lighting shader, which will compute the final color of the scene.

Now I want to grab this color and compute reflections using screen-space reflections. I found this paper "Efficient GPU Screen-Space Ray Tracing by Morgan McGuire" and tried to implement the code in this paper.

But the function has some arguments that I'm not sure what to put in, like vec3 camera-space origin and vec3 camera-space direction.
So, my questions are:

1) Is the Position that I compute in my raytracer, in camera-space or world coordinates? If they are in world coordinates, how do I convert them to camera-space coordinates?

2) To compute the reflection direction, I need to get reflect(viewDirection, Normal). Is the viewDirection the same direction from the raytracer? And should I multiply all the Normals by transpose(inverse(viewMatrix))?


That's all! Thanks!