Creating panoramic images with raymarching
If we have raymarch shader, it's easy to create a panoramic image with it. Here I will explain how to do it by modifying a GLSL fragment shader which performs raymarching (raycasting, raytracing). 1) In the vertex shader, generate normalized 2D coordinates pos_normalized at [-1,1]x[-1,1] of the rendered pixel: //Declare variable which will be interpolated and passed into fragment shader out vec2 pos_normalized; //position [-1,1]x[-1,1] //Inside main() shader's function: gl_Position = modelViewProjectionMatrix * position; //... some normal code vec2 pos_normalized = gl_Position.xy/gl_Position.w; 2) In the fragment shader, add uniform for passing center of panoram and also optional rotation of panoram horizontally in degrees; and of course pos_normalized input: uniform vec3 head_position = vec3(0,0,0); uniform float panoramic_render_angle...