mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Improved Volumetric
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user