Skip to content

Instantly share code, notes, and snippets.

@antoinefortin
Created June 30, 2021 02:52
Show Gist options
  • Select an option

  • Save antoinefortin/80b149fd6b81784115a7c1db90134791 to your computer and use it in GitHub Desktop.

Select an option

Save antoinefortin/80b149fd6b81784115a7c1db90134791 to your computer and use it in GitHub Desktop.
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = (2.0 * fragCoord- iResolution.xy) / iResolution.y;
vec3 ro = vec3(0., 2.0, -5.);
vec3 rd = normalize(vec3(uv.x, uv.y, 1.));
vec3 col = vec3(0.25, .15, .2); // Sky color
vec3 lig = normalize(vec3(-1., 5.7, -2.6));
// Rendering part
int nbRef = 5;
for(int i = 0; i < nbRef; i ++)
{
float t = castRay(ro, rd);
if(t > 0.0)
{
// Stuff we will compute
}
}
fragColor = vec4(col, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment