Various coding style improvements

This commit is contained in:
Antoine Pilote
2023-07-02 16:35:16 -04:00
parent dfb81046bf
commit fca6b2f651
5 changed files with 16 additions and 23 deletions

View File

@@ -242,15 +242,16 @@ void main()
float distance = length(Lights[i].Position - worldPos);
float attenuation = 1.0 / (distance * distance);
if (Lights[i].Type == 0) {
if (Lights[i].Type == 0)
{
L = normalize(Lights[i].Direction);
attenuation = 1.0f;
shadow += ShadowCalculation(Lights[i], worldPos, N);
}
vec3 radiance = Lights[i].Color * attenuation ;
if (Lights[i].Type == 0) {
if (Lights[i].Type == 0)
{
radiance *= shadow;
}
@@ -281,8 +282,8 @@ void main()
vec3 kD = 1.0 - kS;
kD *= 1.0 - metallic;
vec3 ambient = (kD * albedo) * (ao);
vec3 color = (ambient * ssao) + Lo;
vec3 ambient = (kD * albedo) * (ao) * ssao;
vec3 color = (ambient) + Lo;
// Display CSM splits..
/*float depth = length(worldPos - u_EyePosition);

View File

@@ -176,11 +176,11 @@ void main() {
}
outColor = vec4(resultingColor.xyz * Fresnel, metallic) ;
outColor = vec4(resultingColor.xyz * Fresnel, 1.0) ;
}
else {
outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, metallic);
outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, 1.0);
if (outColor.xyz == vec3(0.f)) {
outColor = texture(textureFrame, UV);
}

View File

@@ -62,8 +62,8 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light)
vec3 rayVector = FragPos - startPosition; // Ray Direction
float rayLength = length(rayVector); // Length of the raymarched
if(rayLength > 100)
return vec3(0);
if(rayLength > 1000.0)
return vec3(1.0, 1.0, 1.0);
float stepLength = rayLength / u_StepCount; // Step length
vec3 rayDirection = rayVector / rayLength;
vec3 step = rayDirection * stepLength; // Normalized to step length direction