mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 16:50:15 +00:00
Stabilize shadows and soften foliage shadow casting
This commit is contained in:
parent
f17b15395d
commit
979c0b5592
8 changed files with 136 additions and 13 deletions
|
|
@ -89,6 +89,7 @@ bool WMORenderer::initialize(pipeline::AssetManager* assets) {
|
|||
uniform sampler2DShadow uShadowMap;
|
||||
uniform mat4 uLightSpaceMatrix;
|
||||
uniform bool uShadowEnabled;
|
||||
uniform float uShadowStrength;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
|
|
@ -137,6 +138,7 @@ bool WMORenderer::initialize(pipeline::AssetManager* assets) {
|
|||
shadow /= 9.0;
|
||||
}
|
||||
}
|
||||
shadow = mix(1.0, shadow, clamp(uShadowStrength, 0.0, 1.0));
|
||||
|
||||
// Combine lighting with texture
|
||||
vec3 result = (ambient + (diffuse + specular) * shadow) * texColor.rgb;
|
||||
|
|
@ -499,6 +501,7 @@ void WMORenderer::render(const Camera& camera, const glm::mat4& view, const glm:
|
|||
shader->setUniform("uFogStart", fogStart);
|
||||
shader->setUniform("uFogEnd", fogEnd);
|
||||
shader->setUniform("uShadowEnabled", shadowEnabled ? 1 : 0);
|
||||
shader->setUniform("uShadowStrength", 0.65f);
|
||||
if (shadowEnabled) {
|
||||
shader->setUniform("uLightSpaceMatrix", lightSpaceMatrix);
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue