Windows in distant parts will show the part exterior instead
JonnyOThan opened this issue · 4 comments
Currently, looking into a part that has windows will render the outside of that part where the windows are. We should be able to solve this with depth masks.
Actually...in issue #114 these meshes seemed to be making the space outside the ship visible. Was this pulling from an old framebuffer, or was it just a consequence of being able to see through the backfaces of the part you were inside?
I am skeptical that depth masks are a solution to this problem, because they'd have to be drawn before the parts are rendered but we can't know if that window should actually be visible or not.
Idea from Sofie:
We could use the mesh cutting tech to do cuts for hatches on the EXTERNAL models. The cut geometry would be put in a separate submesh which could be toggled on or off depending on whether a hatch is connected there.
The hatch cutout shapes could be transformed into external space, but they may not quite touch the external model (since internals are typically slightly smaller). The cutout geometry could be moved along the attachnode direction to try to make this better.
Depth mask idea:
If we could make sure that adjacent parts are the LAST thing to be drawn, then we could draw a depth mask quad or something over any open hatches in the current part before drawing the part's external model. This works when you're looking into a single part that has a window, but wouldn't work if you had a chain of parts. Could we somehow sort parts based on number of connections and draw depth masks before each one?