Skip face culling in shadows for double-sided materials (e.g. plantlike) (#13500)

* Skip face culling in shadows for double-sided materials (e.g. plantlike)

* Keep previous face culling for transparent surfaces e.g. water
This commit is contained in:
x2048 2023-09-17 21:42:14 +02:00 committed by GitHub
parent a88e61c2cf
commit e36b2226b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1198,8 +1198,14 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
// override some material properties // override some material properties
video::SMaterial local_material = buf->getMaterial(); video::SMaterial local_material = buf->getMaterial();
local_material.MaterialType = material.MaterialType; local_material.MaterialType = material.MaterialType;
local_material.BackfaceCulling = material.BackfaceCulling; // do not override culling if the original material renders both back
local_material.FrontfaceCulling = material.FrontfaceCulling; // and front faces in solid mode (e.g. plantlike)
// Transparent plants would still render shadows only from one side,
// but this conflicts with water which occurs much more frequently
if (is_transparent_pass || local_material.BackfaceCulling || local_material.FrontfaceCulling) {
local_material.BackfaceCulling = material.BackfaceCulling;
local_material.FrontfaceCulling = material.FrontfaceCulling;
}
local_material.BlendOperation = material.BlendOperation; local_material.BlendOperation = material.BlendOperation;
local_material.Lighting = false; local_material.Lighting = false;
driver->setMaterial(local_material); driver->setMaterial(local_material);