Getting both the frontfacing and backfacing normals on the front faces?

Godot Version

v4.3.dev6.mono.official [89850d553]

Question

image
Normal vector, cull_back.

image
Normal vector, cull_front.

I want to access the cull_back and cull_front normals at the same time to get the distance between them - in other words I want to make this shader go through the mesh. If this is possible or feasible, how could I go about this?

I imagine there is some combination of using buffers and some math in the shader to do this, for instance if you draw the front face to the Depth buffer (I think that already happens, though not sure about backfaces, if they draw into it), and then when you draw the backface you access the depth buffer texture and do some math on it.

What is the effect you want to achieve with that data?

What is the effect you want to achieve with that data?

I want to use this data for a PDF I’m trying to follow, “An Approximate Image-Space Approach for Interactive Refraction” by Chris Wyman.

You can see (approx.) how the data is used in Figure 3.