Execute UnityObjectToClipPos() once in surface shader?
You can use a "vertex:" function in surface shader.
If you use UnityObjectToClipPos() in this vertex function, the generated vs/fs will execute UnityObjectToClipPos() another time.
See example: https://docs.unity3d.com/2018.1/Documentation/Manual/SL-SurfaceShaderExamples.html Custom Fog with Final Color Modifier
Answer by trapazza · Mar 25, 2019 at 11:58 AM
I've just converted a regular vertex/fragment shader into a surface shader and ran into this problem. It seems that Unity does this for you after your custom vertex program has been executed, so you don't have to take care of data transformations for the next stage. It also seems that in the context of surface shaders they wouldn't even call it "vertex program/shader" but "vertex modifier".
Answer by Romaleks360 · Apr 16, 2019 at 07:52 PM
Any updates on this? Didn't get what should this "fog example" illustrate, but the issue itself is still actual. I'm also converting vertex shader to surface shader and I need UnityObjectToClipPos to execute before my other logic in custom vertex function