Guest User

Untitled

a guest
Jun 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. 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);
  2. r.y /= aspect_ratio // crunch the y direction to fit the aspect ratio;
  3. vec3 dir = vec3(view_m*vec4(normalize(r),1)); //rotate the ray by the camera's rotation
  4. r+= camera_pos; //Set the ray at the camera's position
Add Comment
Please, Sign In to add comment