Per-material shadow bias
See original GitHub issueIt currently sits in the light, but as it happens the same value of bias would fix one object in the scene while causing problems for another. How hard would it be to add an optional bias to the material, and will this work for e g #12919
Looking at the code, it is just passed as the uniform parameter, so altering it should not be a problem?
Ok no, looks like those are some different uniforms, for shadow pass or something. It is not on material uniforms in onBeforeCompile 😦
It is actually in param.uniforms.directionalLights.value[0]
Ok, so I was able to do this hack:
material.onBeforeCompile = function(stuff) {
var chunk = THREE.ShaderChunk.shadowmap_pars_fragment
.split ('z += shadowBias')
.join ('z += shadowBias - 0.001');
stuff.fragmentShader = stuff.fragmentShader
.split ('#include <shadowmap_pars_fragment>')
.join (chunk);
};
so this is definitely possible.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
6.1 - Shadow Bias | Unreal Engine 4.27 Documentation
This example shows off the Shadow Bias. This property exists primarily to help objects feel more grounded along a surface. There is a...
Read more >Shadows | Babylon.js Documentation
Bias. Normal Bias (Since 3.2). Soft Shadows. Custom shadow map shaders. Global custom shadow map shader. Per-material shadow depth map shader. Basic usage....
Read more >Directional Shadows - Catlike Coding
Render and sample shadow maps. Support multiple shadowed directional lights. Use cascaded shadow maps. Blend, fade, and filter shadows.
Read more >[2.2] Self Shadowing errors - Ogre Forums
Hi, just wondering if there is a solution to fix the self shadowing artefacts that run on the pcf based shadows.
Read more >will it be improved? Will we ever get better soft shadows?
@PutridEx The receive shadow setting is now per material so that you can ... Bias improvements need to be done in major release...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Instead of moving shadow properties to materials, it’s better to focus on #13108. Meaning investigating and introducing new shadow approaches for tweaking shadows (like
normalBias
).I don’t think so. It’s a new property in the shadow.
You can try it in the editor:
shadow.normalBias = 0
:shadow.normalBias = 0.05
: