Skip to content

Commit

Permalink
Skip face culling in shadows for double-sided materials (e.g. plantli…
Browse files Browse the repository at this point in the history
…ke) (#13500)

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

* Keep previous face culling for transparent surfaces e.g. water
  • Loading branch information
x2048 committed Sep 17, 2023
1 parent a88e61c commit e36b222
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/client/clientmap.cpp
Expand Up @@ -1198,8 +1198,14 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
// override some material properties
video::SMaterial local_material = buf->getMaterial();
local_material.MaterialType = material.MaterialType;
local_material.BackfaceCulling = material.BackfaceCulling;
local_material.FrontfaceCulling = material.FrontfaceCulling;
// do not override culling if the original material renders both back
// 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.Lighting = false;
driver->setMaterial(local_material);
Expand Down

0 comments on commit e36b222

Please sign in to comment.