In a game I’m working on, multiple objects are placed next to each other that have a modifiable transparency. More specifically, I want one section of a scene to turn translucent when another is put into focus behind it.
I have a ceiling cuboid connected to a wall cuboid, but the side face of the ceiling is being rendered under the wall, creating a dark parallelogram depicted in the top image.
Here is what the current problem looks like (above), and a manually corrected image of what the final effect should look like (below):
I’ve considered three solutions to the problem:
1) Use just one model
Create a new model that is both the ceiling, floor, and wall combined into one model. The problem itself is avoided, but creating a new model for every section of every scene would be tiresome.
2) Shader magic
Make a shader that corrects the problem. This probably requires an incredibly in-depth knowledge of shaders that I simply don’t understand, and it may not even be possible.
3) ZWrite manipulation
This may be involved in solution 2, but it may also not be. A script would keep the different elements rendering properly.
Which of these solutions would be the most plausible / effective at resolving the issue, or would another solution I haven’t thought of actually be best?