The direction vector need to be normalized.

When i did raytracing in glsl it was something like this:

```
vec2 uv = gl_FragCoord.xy / resolution.xy;
vec3 r0 = vec3(0.0, 1.0, 4.0); //the position of view
vec3 rd = vec3((-1.0 + 2.0 * uv) * vec2(1.78, 1.0), -1.0); //the look direction, note the -Z!, the multiplication with vec2(1.78, 1.0) is just a correction for the aspect.
```

The resolution is a 2d vec, the screen width and height (in window
coords, for example: 800*600).

Yes, you need a full screen quad, and run the (fragment) shader code on
this.

I recommend to use ShaderToy (http://www.iquilezles.org/apps/shadertoy/), or GLSL Sandbox (http://glsl.heroku.com/e). Quick and simple. :)

Hello All,

I am trying to develop a basic Ray Tracer. So far i have calculated intersection with a plane and blinn-phong shading.i am working on a 500*500 window and my primary ray generation code is as follows

Now i doubt that above method is right or wrong. Please give me some insights.

I am also having doubt that do we need to construct geometry in OpenGL code while rayTracing in GLSL. for example if i am trying to raytrace a plane do i need to construct plane in OpenGL code using glVertex2f ?

Thank You