Only get closest vertex from Camera in vertex shader

I’ve started working on a personal shader project, using a base that my computer graphics TA provided us with. In simple terms, it’s going to replicate a specific style of 2D shading (cross-hatching) on 3D objects. Part of the base we were provided with already has a function to get the distance of the vertices from the camera in the vertex shader, however a (fairly large) part of how I want to personally make the shader work involves rendering all visible vertices on the mesh based on the distance of whichever one is closest, if that makes sense. (Basically so the texture doesn’t actually turn with the camera and is always in the same place, regardless of the angle the model is viewed at.)
However, I’m not really even sure where to start. I essentially want the texture to look the same from any angle without deforming based on the mesh curving, but still showing depth with the model. Any advice?

Derive texture coordinates from window coordinates. Either from gl_FragCoord.xy or from interpolating gl_Position.xy/gl_Position.w. If you want the texture to move (pan) with the object, subtract the window coordinates of the object’s origin/centre position.

I have no idea what that’s supposed to mean.

The still showing depth basically meant, not in orthographic mode. So you still have perspective on the model. I worded it a bit weirdly, apologies.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.