How to hide a pixel without hiding its shadow too?
Asked Answered
M

3

0

I use a shader to toggle on and off the roof of a house.

if (is_roof_pixel) {
     ALPHA = 0.0;
}

The problem is this lets sunlight in.
Is there a way to hide the roof without letting in directional light?
Maybe there's some way to hide the mesh after it draws its shadow?

I also tried discardas well but no luck.

Blender has a visibility option that allows you to hide meshes for specific cameras, maybe theres a similar feature in godot?

Mooch answered 16/2, 2023 at 19:5 Comment(0)
L
0

Easiest solution might be to use a second/extra shadow casting object, that is a mesh instance object with the shadow casting property set to shadow only. It wouldn't visibly render, but it's shadow would.

Liken answered 16/2, 2023 at 23:27 Comment(0)
M
0

Liken
Unfortunately mesh is the entire world (this is a minecraft clone), duplicating the mesh would be really hard on performance I think? Im open to harder solutions though

Mooch answered 17/2, 2023 at 17:32 Comment(0)
L
0

You could procedurally produce the shadowcaster mesh via the SurfaceTool and modify further via the MeshDataTool classes perhaps.

Liken answered 17/2, 2023 at 22:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.