Hi. I’ve just seen this shader at glslsandbox :GLSL Sandbox
And I would like to know how do I use a shader like this inside a skybox in openGL. I would like to know the space conversion I need to do to make it in worldSpace.
I’ve found this explanation but i’m not understanding the transformation from screen space to NDC. Basically I want to know what it takes to perform rayMarch with outPut in worldSpace.
// Convert screen coordinates to normalized device coordinates (NDC)
vec4 ndc = vec4(
(gl_FragCoord.x / screen_width - 0.5) * 2.0,
(gl_FragCoord.y / screen_height - 0.5) * 2.0,
(gl_FragCoord.z - 0.5) * 2.0,
1.0);
// Convert NDC throuch inverse clip coordinates to view coordinates
vec4 clip = inverse_view_proj * ndc;
vec3 vertex = (clip / clip.w).xyz;