Hello everyone,
this is my first post in this forum. I hope I can state my problem appropriate. Here it is...
In my project I want to implement a slider, which enables the user to look inside a mesh, i.e. that the front face is cut to a corresponding degree depending on the slider.
To realize this, I first draw the back face and afterwards the front face of the object. While drawing the front face the fragment-shader checks, how far the current pixel is away from the camera.
Now depending on the distance I decide if the pixel shall be transparent or opaque. To make this algorithm work properly though, I need to know the distance of the current closest pixel of my object so I can define an appropriate ratio. Since I can rotate the object this distance also has to be update every frame.
So my question is, how can I efficiently calculate this closest pixel?
The only idea I have in mind, is to store the depth-buffer into a texture. But then I still would have to find the lowest depth value in my texture and convert this distance so it relates the calculated shader distances.
Is this algorithm generally a good idea, or is there even a better approach of doing such a look-inside-view?
Thanks in advance for any proposals!



)
roject() to calculate screen coordinates. It is not as quick as having the graphics card doing the job, but you don't have to do the computation every frame.
