New answers tagged raytracing
2
You can calculate the ray from camera for any pixel px,py with the following formula:
ray.origin = camera.getPosition();
relativeX = px * 2 / screenWidth - 1; // [0, screenWidth] -> [-1, 1]
relativeY = py * 2 / screenHeight - 1; // [0, screenHeight] -> [-1, 1], might need to be flipped depending on the coordinate system
ray.direction = ...
Top 50 recent answers are included