Improved Volumetric

This commit is contained in:
Antoine Pilote
2023-07-02 16:56:11 -04:00
parent fca6b2f651
commit c56a655be4
3 changed files with 5 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ struct Light {
vec3 color;
vec3 direction;
sampler2D shadowmap;
float strength;
};
uniform Light u_Lights[MAX_LIGHT];
@@ -86,7 +87,7 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light)
if (closestDepth > currentDepth && closestDepth < 999)
{
//accumFog = vec3(light.color);
accumFog += (ComputeScattering(dot(rayDirection, light.direction)).xxx * light.color * 10.0);
accumFog += (ComputeScattering(dot(rayDirection, light.direction)).xxx * light.color );
//accumFog = vec3(projCoords.x, projCoords.y, 1.0);
}
@@ -95,7 +96,7 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light)
}
accumFog /= u_StepCount;
return accumFog;
return accumFog * 5.0;
}
// Converts depth to World space coords.

View File

@@ -59,6 +59,7 @@ namespace Nuake {
volumetricShader->SetUniformVec3(u_light + "direction", light.GetDirection());
volumetricShader->SetUniformTex(u_light + "shadowmap", light.m_Framebuffers[0]->GetTexture(GL_DEPTH_ATTACHMENT).get(), 5 + i);
volumetricShader->SetUniform1f(u_light + "strength", light.Strength);
}

View File

@@ -11,7 +11,7 @@ namespace Nuake {
private:
uint32_t mStepCount = 50;
float mRenderRatio = 1.0f;
float mFogAmount = 0.9f;
float mFogAmount = 0.4f;
Vector2 mSize;
Texture* mDepth;