Your comments

Exactly what I am doing now to a bunch of vegetation shaders we built in SF - pretty tedious and repetitive for me. Actually, as the UNITY_MATRIX_MVP will be transparently replaced with the instance matrices when the multi_compile is enabled, basic support should be pretty easy (macro here, macro there, sv_InstanceId into the data). But I see that the task may be more complex when looking at the full SF featureset...

After upgrading to 1.33, I've gone through our SF shaders to recompile then, but many complain about a undeclared identifier now (D3D11, Deferred, Linear Lighting):


undeclared identifier 'surfaceReduction'
Compiling Vertex program with SHADOWS_DEPTH LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP

Serialized shader for reproduction (hopefully :) ):


// Shader created with Shader Forge v1.33
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.33;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:3,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:True,hqlp:False,rprd:True,enco:False,rmgx:True,rpth:1,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.9777864,fgcg:0.9916228,fgcb:0.9991848,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:2865,x:32719,y:32712,varname:node_2865,prsc:2|diff-7736-RGB,spec-6555-R,gloss-6555-A,normal-4075-OUT,emission-1006-OUT;n:type:ShaderForge.SFN_Tex2d,id:7736,x:31922,y:32620,ptovrint:True,ptlb:[UV0] Diffuse,ptin:_MainTex,varname:_MainTex,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:True,tagnrm:False,ntxv:0,isnm:False|UVIN-5972-UVOUT;n:type:ShaderForge.SFN_Tex2d,id:5964,x:31922,y:33000,ptovrint:True,ptlb:[UV0] Normal Map,ptin:_BumpMap,varname:_BumpMap,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:True,tagnrm:False,ntxv:3,isnm:True|UVIN-5972-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:5972,x:31631,y:32807,varname:node_5972,prsc:2,uv:0;n:type:ShaderForge.SFN_Tex2d,id:6555,x:31922,y:32814,ptovrint:False,ptlb:[UV0] Metallic (R) Roughness (A),ptin:_UV0MetallicRRoughnessA,varname:node_6555,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:True,tagnrm:False,ntxv:0,isnm:False|UVIN-5972-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:2971,x:31151,y:32274,varname:node_2971,prsc:2,uv:1;n:type:ShaderForge.SFN_Tex2d,id:666,x:32131,y:32396,ptovrint:False,ptlb:[UV1] Matrix,ptin:_UV1Matrix,varname:node_666,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:True,tagnrm:False,ntxv:0,isnm:False|UVIN-5603-OUT;n:type:ShaderForge.SFN_Tex2d,id:50,x:32173,y:33170,ptovrint:False,ptlb:[UV1] Matrix Normal,ptin:_UV1MatrixNormal,varname:node_50,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:True,tagnrm:False,ntxv:3,isnm:True|UVIN-2971-UVOUT;n:type:ShaderForge.SFN_NormalBlend,id:4075,x:32352,y:33015,varname:node_4075,prsc:2|BSE-5964-RGB,DTL-50-RGB;n:type:ShaderForge.SFN_Multiply,id:1006,x:32638,y:32475,varname:node_1006,prsc:2|A-7270-OUT,B-666-RGB,C-666-A;n:type:ShaderForge.SFN_Slider,id:7270,x:32517,y:32411,ptovrint:False,ptlb:Emission Intensity,ptin:_EmissionIntensity,varname:node_7270,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:20;n:type:ShaderForge.SFN_Add,id:5603,x:31683,y:32408,varname:node_5603,prsc:2|A-2971-UVOUT,B-3137-OUT;n:type:ShaderForge.SFN_Append,id:3137,x:31347,y:32722,varname:node_3137,prsc:2|A-376-OUT,B-51-OUT;n:type:ShaderForge.SFN_ValueProperty,id:8316,x:30913,y:32803,ptovrint:False,ptlb:Matrix Row Height,ptin:_MatrixRowHeight,varname:node_8316,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:2285,x:30913,y:32890,ptovrint:False,ptlb:Matrix Row Index,ptin:_MatrixRowIndex,varname:node_2285,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_Multiply,id:51,x:31152,y:32867,varname:node_51,prsc:2|A-8316-OUT,B-2285-OUT;n:type:ShaderForge.SFN_Vector1,id:376,x:31152,y:32722,varname:node_376,prsc:2,v1:0;proporder:7736-6555-5964-666-50-7270-8316-2285;pass:END;sub:END;*/

That gives the same result as the OT, but it still leaves all the calculations in the shader code, basically calculating the "other branch" for nothing.


I also like the feature of having compile-time switches to just disable certain shader features for different materials.

I also second this request, being able to access texture arrays would allow us to make use of more "virtual" samplers