I want to create CG shader (not surface shader) that can receive and cast shadow.
But when I try it using the traditional way , IE using LIGHTING_COORDS etc… unity spits out this message and fails to compile.
#warning Upgrade NOTE: SubShader commented out; uses Unity 2.x per-pixel lighting. You should rewrite shader into a Surface Shader.
I am wondering if anything has changed !
Surface shader is good, but sometimes you want to have a full control.
Anyone?
I’d need to see the full shader code, but you can write one that’s not a surface shader just fine.
I’ve posted up a very basic one here if you want to have a look at that to compare;
http://forum.unity3d.com/threads/213430-Get-the-range-of-a-point-light-in-forward-add-mode?p=1432660&viewfull=1#post1432660
Check out the file UnityCG.cginc in your UnityPath/Editor/Data/CGIncludes.
At the last section, it declares all the shadow functions you may need to use when u want to make custom shadow render.
However I believe UnityEngine should render shadow automatically in a separate path. So u just write a simple lighting shader, it should still be affected by shadow. (pure assumption, you can have a try)