Removing normals from Surface Shader / Getting Frag/Vert in U4

Hey guys.

This has been a continuous headache for me, Unity is SUCH a [insert degrading insult] about this…

I need a shader with built-in fog and vertex color that is as fast as possible.
It should have no shading, just vertex color multiplied with attenuation of lights (so I get shadows from a directional light and distance attenuation from point-lights)

I am not using normals in any way so I want to save these away to have small mesh data size and maximum dynamic batching.
This is not allowed with surface shaders it seems, I get errors when trying to write custom structs and functions to not include the normals.

I tried making a vert/frag shader, but as soon as I tried including shadows, Unity comments it out.

I tried so many different things I can’t even list them and all I need is a freakin’ working simple cheap shader that does these 3 things. Vertex color, light attenuation with shadows and fog.

So can ANYONE help me out here? If I could have one that just gives vertex color and attenuation without including any unnecessary data (so the appdata struct is just color and vertex/position) I’ll write in the fog myself.

Thankyou!

Here’s a reasonable way: Make a surface shader that works, no matter if it does unnecessary stuff or not. Then add #pragma debug and look at the compiled shader. What you should see is the resulting vert/frag shader. You are then free to remove, simplify and optimize anything you want, with the advantage of starting with a working code.

Yes!! Thankyou! How could I have forgotten that option! That’ll do, thankyou :slight_smile: