Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vec3 r = (vec3(f_coord.xy,1.f/tan(radians(40)))) //initialize the ray for a field of view of 40, f_coord is the pizel coordinate in OpenGL (-1 to 1);
- r.y /= aspect_ratio // crunch the y direction to fit the aspect ratio;
- vec3 dir = vec3(view_m*vec4(normalize(r),1)); //rotate the ray by the camera's rotation
- r+= camera_pos; //Set the ray at the camera's position
Add Comment
Please, Sign In to add comment