Direct3D error when building game.
Hello!
First off just want to say I love Shader Forge. Thankyou for making this awesome asset.
Somewhere along the line the shader I created below started creating errors when building my game. These are the errors:
Shader error in 'Shader Forge/ShaderTerrain': Too many output registers declared (12). When no output register has been declared with the semantic 'psize0', 11 o# registers are available. When an o# register has been declared with the semantic 'psize0' (same as 'psize'), 12 registers are available. at line 104 (on d3d9)
Shader error in 'Shader Forge/ShaderTerrain': Too many output registers declared (12). When no output register has been declared with the semantic 'psize0', 11 o# registers are available. When an o# register has been declared with the semantic 'psize0' (same as 'psize'), 12 registers are available. at line 362
This error only happens when I have Target renderers: Direct3d 9 enabled in the shader settings. I've spent some time searching around this but to know avail. I would really appreciate having some light shed on what I did with the shader that resulted in me getting this error so I can avoid in the future.
Thanks!
// Shader created with Shader Forge v1.38 // 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.38;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,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,imps:True,rpth:0,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.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.02,fgrn:0,fgrf:300,stcl:False,atwp: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,fsmp:False;n:type:ShaderForge.SFN_Final,id:2865,x:35447,y:32057,varname:node_2865,prsc:2|diff-7198-OUT,spec-440-OUT,gloss-2723-OUT,normal-1753-OUT;n:type:ShaderForge.SFN_Panner,id:3911,x:27366,y:32505,varname:node_3911,prsc:2,spu:0,spv:0.5|UVIN-242-UVOUT,DIST-6699-OUT;n:type:ShaderForge.SFN_ValueProperty,id:6571,x:27398,y:32984,ptovrint:False,ptlb:positionx,ptin:_positionx,varname:node_6571,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:6699,x:26635,y:32931,ptovrint:False,ptlb:positionz,ptin:_positionz,varname:node_6699,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_Panner,id:57,x:28074,y:32488,varname:node_57,prsc:2,spu:0.5,spv:0|UVIN-3911-UVOUT,DIST-6571-OUT;n:type:ShaderForge.SFN_VertexColor,id:5163,x:31861,y:32850,varname:node_5163,prsc:2;n:type:ShaderForge.SFN_Lerp,id:9294,x:32093,y:32532,varname:node_9294,prsc:2|A-6902-OUT,B-4822-OUT,T-5163-R;n:type:ShaderForge.SFN_Tex2d,id:7618,x:31395,y:34433,ptovrint:False,ptlb:BarrenBNormal,ptin:_BarrenBNormal,varname:node_7618,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:2305f4de6af0fff4d89d0ac4fb97e9d3,ntxv:3,isnm:True|UVIN-9070-OUT;n:type:ShaderForge.SFN_Lerp,id:2705,x:32117,y:34266,varname:node_2705,prsc:2|A-467-RGB,B-7618-RGB,T-5163-R;n:type:ShaderForge.SFN_InverseLerp,id:9259,x:28608,y:31185,varname:node_9259,prsc:2|A-4857-OUT,B-537-OUT,V-1774-Y;n:type:ShaderForge.SFN_Append,id:1990,x:28873,y:31191,varname:node_1990,prsc:2|A-4752-OUT,B-9259-OUT;n:type:ShaderForge.SFN_Vector1,id:4752,x:28608,y:30965,varname:node_4752,prsc:2,v1:0.15625;n:type:ShaderForge.SFN_Tex2d,id:3968,x:29537,y:31181,varname:node_3968,prsc:2,tex:9d2b4a485363a3947a015963cd23c4ab,ntxv:0,isnm:False|UVIN-1990-OUT,TEX-8852-TEX;n:type:ShaderForge.SFN_Blend,id:2148,x:32376,y:32476,varname:node_2148,prsc:2,blmd:1,clmp:True|SRC-3968-RGB,DST-9294-OUT;n:type:ShaderForge.SFN_RemapRange,id:6902,x:31561,y:32527,varname:node_6902,prsc:2,frmn:0,frmx:1,tomn:0.1,tomx:0.5|IN-9194-OUT;n:type:ShaderForge.SFN_Tex2d,id:1179,x:30589,y:27559,varname:node_1179,prsc:2,tex:9d2b4a485363a3947a015963cd23c4ab,ntxv:0,isnm:False|UVIN-7839-OUT,TEX-8852-TEX;n:type:ShaderForge.SFN_Lerp,id:8958,x:33699,y:31513,varname:node_8958,prsc:2|A-4283-OUT,B-2606-OUT,T-1580-OUT;n:type:ShaderForge.SFN_Append,id:7839,x:30277,y:27538,varname:node_7839,prsc:2|A-240-OUT,B-3333-OUT;n:type:ShaderForge.SFN_InverseLerp,id:3333,x:29506,y:27434,varname:node_3333,prsc:2|A-9768-OUT,B-9542-OUT,V-6588-OUT;n:type:ShaderForge.SFN_Vector1,id:240,x:30043,y:27408,varname:node_240,prsc:2,v1:0.03125;n:type:ShaderForge.SFN_FragmentPosition,id:1774,x:25935,y:27421,varname:node_1774,prsc:2;n:type:ShaderForge.SFN_Multiply,id:9542,x:28475,y:27868,varname:node_9542,prsc:2|A-9768-OUT,B-2544-OUT;n:type:ShaderForge.SFN_Vector1,id:2544,x:28127,y:27887,varname:node_2544,prsc:2,v1:-3;n:type:ShaderForge.SFN_RemapRange,id:4822,x:31577,y:32786,varname:node_4822,prsc:2,frmn:0,frmx:1,tomn:0,tomx:1|IN-4775-OUT;n:type:ShaderForge.SFN_Lerp,id:3175,x:33438,y:33542,varname:node_3175,prsc:2|A-5987-OUT,B-3921-OUT,T-1580-OUT;n:type:ShaderForge.SFN_Tex2d,id:1725,x:32512,y:31124,ptovrint:False,ptlb:Cliff,ptin:_Cliff,varname:node_1725,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:560b0b276e01e544c89c3cb0f8d68c3b,ntxv:0,isnm:False|UVIN-57-UVOUT;n:type:ShaderForge.SFN_Lerp,id:7426,x:34212,y:31166,varname:node_7426,prsc:2|A-8958-OUT,B-9733-OUT,T-5163-G;n:type:ShaderForge.SFN_Tex2d,id:1272,x:32085,y:33188,ptovrint:False,ptlb:CliffNorm,ptin:_CliffNorm,varname:node_1272,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:f7a4be1a2c76dc446b1a140081c00ef0,ntxv:3,isnm:True|UVIN-57-UVOUT;n:type:ShaderForge.SFN_Lerp,id:1753,x:34108,y:33189,varname:node_1753,prsc:2|A-3175-OUT,B-1272-RGB,T-5163-G;n:type:ShaderForge.SFN_ValueProperty,id:2509,x:30076,y:30825,ptovrint:False,ptlb:Food,ptin:_Food,varname:node_2509,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_Tex2d,id:5140,x:31820,y:31963,ptovrint:False,ptlb:Fertile,ptin:_Fertile,varname:node_5140,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:4741f570e4dd4f14694ca4bfef3de191,ntxv:0,isnm:False|UVIN-57-UVOUT;n:type:ShaderForge.SFN_Lerp,id:4283,x:33092,y:31937,varname:node_4283,prsc:2|A-2148-OUT,B-5902-OUT,T-626-OUT;n:type:ShaderForge.SFN_Tex2d,id:7892,x:30426,y:30362,ptovrint:False,ptlb:MaskFertile,ptin:_MaskFertile,varname:node_7892,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:e59bda40d1889a64ba4b74b51ac62d05,ntxv:0,isnm:False|UVIN-57-UVOUT;n:type:ShaderForge.SFN_Add,id:7635,x:31338,y:30419,varname:node_7635,prsc:2|A-7892-R,B-6191-OUT;n:type:ShaderForge.SFN_Clamp01,id:626,x:31600,y:30413,varname:node_626,prsc:2|IN-7635-OUT;n:type:ShaderForge.SFN_Lerp,id:6191,x:30915,y:30866,varname:node_6191,prsc:2|A-761-OUT,B-5306-OUT,T-9373-OUT;n:type:ShaderForge.SFN_Vector1,id:761,x:30376,y:31012,varname:node_761,prsc:2,v1:-1;n:type:ShaderForge.SFN_Vector1,id:5306,x:30376,y:31099,varname:node_5306,prsc:2,v1:1;n:type:ShaderForge.SFN_ValueProperty,id:8153,x:28196,y:29147,ptovrint:False,ptlb:FoodNeighbour0,ptin:_FoodNeighbour0,varname:node_8153,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:410,x:28196,y:29372,ptovrint:False,ptlb:FoodNeighbour1,ptin:_FoodNeighbour1,varname:node_410,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:9146,x:28196,y:29612,ptovrint:False,ptlb:FoodNeighbour2,ptin:_FoodNeighbour2,varname:node_9146,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:7859,x:28196,y:29843,ptovrint:False,ptlb:FoodNeighbour3,ptin:_FoodNeighbour3,varname:node_7859,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:5893,x:28196,y:30084,ptovrint:False,ptlb:FoodNeighbour4,ptin:_FoodNeighbour4,varname:node_5893,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:6702,x:28196,y:30338,ptovrint:False,ptlb:FoodNeighbour5,ptin:_FoodNeighbour5,varname:node_6702,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0;n:type:ShaderForge.SFN_Multiply,id:6724,x:28574,y:29120,varname:node_6724,prsc:2|A-9591-R,B-8153-OUT;n:type:ShaderForge.SFN_Multiply,id:1385,x:28574,y:29350,varname:node_1385,prsc:2|A-9591-G,B-410-OUT;n:type:ShaderForge.SFN_Multiply,id:6378,x:28599,y:29585,varname:node_6378,prsc:2|A-9591-B,B-9146-OUT;n:type:ShaderForge.SFN_Multiply,id:1713,x:28599,y:29802,varname:node_1713,prsc:2|A-8087-R,B-7859-OUT;n:type:ShaderForge.SFN_Multiply,id:5590,x:28599,y:30049,varname:node_5590,prsc:2|A-8087-G,B-5893-OUT;n:type:ShaderForge.SFN_Multiply,id:4010,x:28607,y:30315,varname:node_4010,prsc:2|A-8087-B,B-6702-OUT;n:type:ShaderForge.SFN_Max,id:8210,x:28900,y:29330,varname:node_8210,prsc:2|A-6724-OUT,B-1385-OUT;n:type:ShaderForge.SFN_Max,id:9253,x:29144,y:29570,varname:node_9253,prsc:2|A-8210-OUT,B-6378-OUT;n:type:ShaderForge.SFN_Max,id:9427,x:29420,y:29770,varname:node_9427,prsc:2|A-9253-OUT,B-1713-OUT;n:type:ShaderForge.SFN_Max,id:2625,x:29723,y:30015,varname:node_2625,prsc:2|A-9427-OUT,B-5590-OUT;n:type:ShaderForge.SFN_Max,id:9249,x:29947,y:30281,varname:node_9249,prsc:2|A-2625-OUT,B-4010-OUT;n:type:ShaderForge.SFN_Max,id:9373,x:30612,y:30792,varname:node_9373,prsc:2|A-2509-OUT,B-9249-OUT;n:type:ShaderForge.SFN_Vector1,id:4590,x:30278,y:30893,varname:node_4590,prsc:2,v1:0;n:type:ShaderForge.SFN_Tex2d,id:9591,x:27746,y:28476,varname:node_9591,prsc:2,tex:f27c756874db2b34f8f8f82105ae96d0,ntxv:0,isnm:False|UVIN-3909-UVOUT,TEX-1243-TEX;n:type:ShaderForge.SFN_UVTile,id:3909,x:27434,y:28503,varname:node_3909,prsc:2|UVIN-242-UVOUT,WDT-4502-OUT,HGT-4502-OUT,TILE-4921-OUT;n:type:ShaderForge.SFN_TexCoord,id:242,x:25338,y:28445,varname:node_242,prsc:2,uv:0,uaff:False;n:type:ShaderForge.SFN_Vector1,id:4502,x:27174,y:28662,varname:node_4502,prsc:2,v1:3;n:type:ShaderForge.SFN_Vector1,id:4921,x:27174,y:28828,varname:node_4921,prsc:2,v1:0;n:type:ShaderForge.SFN_Tex2dAsset,id:8852,x:28574,y:28482,ptovrint:False,ptlb:Ramps,ptin:_Ramps,varname:node_8852,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:9d2b4a485363a3947a015963cd23c4ab,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2dAsset,id:1243,x:27265,y:28210,ptovrint:False,ptlb:Utility,ptin:_Utility,varname:node_1243,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:f27c756874db2b34f8f8f82105ae96d0,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:8087,x:27764,y:28850,varname:node_8087,prsc:2,tex:f27c756874db2b34f8f8f82105ae96d0,ntxv:0,isnm:False|UVIN-7855-UVOUT,TEX-1243-TEX;n:type:ShaderForge.SFN_UVTile,id:7855,x:27448,y:28668,varname:node_7855,prsc:2|UVIN-242-UVOUT,WDT-4502-OUT,HGT-4502-OUT,TILE-484-OUT;n:type:ShaderForge.SFN_Vector1,id:484,x:27174,y:28950,varname:node_484,prsc:2,v1:1;n:type:ShaderForge.SFN_Clamp,id:6588,x:29227,y:27282,varname:node_6588,prsc:2|IN-1774-Y,MIN-9761-OUT,MAX-3346-OUT;n:type:ShaderForge.SFN_Add,id:9761,x:28732,y:27151,varname:node_9761,prsc:2|A-9768-OUT,B-2570-OUT;n:type:ShaderForge.SFN_Vector1,id:2570,x:28542,y:27315,varname:node_2570,prsc:2,v1:0.01;n:type:ShaderForge.SFN_Subtract,id:3346,x:28849,y:27493,varname:node_3346,prsc:2|A-9542-OUT,B-2570-OUT;n:type:ShaderForge.SFN_ValueProperty,id:1693,x:27984,y:27466,ptovrint:False,ptlb:BeachHeight,ptin:_BeachHeight,varname:node_1693,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.03;n:type:ShaderForge.SFN_Multiply,id:9768,x:28287,y:27404,varname:node_9768,prsc:2|A-1693-OUT,B-3260-OUT;n:type:ShaderForge.SFN_Vector1,id:3260,x:28059,y:27617,varname:node_3260,prsc:2,v1:-1;n:type:ShaderForge.SFN_Tex2d,id:9166,x:30633,y:27975,varname:node_9166,prsc:2,tex:9d2b4a485363a3947a015963cd23c4ab,ntxv:0,isnm:False|UVIN-5690-OUT,TEX-8852-TEX;n:type:ShaderForge.SFN_Append,id:5690,x:30271,y:27884,varname:node_5690,prsc:2|A-272-OUT,B-3333-OUT;n:type:ShaderForge.SFN_Vector1,id:272,x:30068,y:27726,varname:node_272,prsc:2,v1:0.09375;n:type:ShaderForge.SFN_Append,id:3222,x:28884,y:31433,varname:node_3222,prsc:2|A-9488-OUT,B-1570-OUT;n:type:ShaderForge.SFN_Vector1,id:9488,x:28608,y:31403,varname:node_9488,prsc:2,v1:0.21875;n:type:ShaderForge.SFN_Tex2d,id:9705,x:29536,y:31438,varname:node_9705,prsc:2,tex:9d2b4a485363a3947a015963cd23c4ab,ntxv:0,isnm:False|UVIN-3222-OUT,TEX-8852-TEX;n:type:ShaderForge.SFN_Blend,id:5902,x:32515,y:31951,varname:node_5902,prsc:2,blmd:1,clmp:True|SRC-5140-RGB,DST-9705-RGB;n:type:ShaderForge.SFN_Relay,id:1580,x:31072,y:27574,varname:node_1580,prsc:2|IN-1179-R;n:type:ShaderForge.SFN_Tex2d,id:5380,x:31159,y:32478,varname:node_5380,prsc:2,tex:08aa80057f00b30419fe625d741bfa39,ntxv:0,isnm:False|UVIN-4818-OUT,TEX-4465-TEX;n:type:ShaderForge.SFN_Multiply,id:4818,x:30914,y:32483,varname:node_4818,prsc:2|A-6919-OUT,B-5307-OUT;n:type:ShaderForge.SFN_Vector1,id:5307,x:30582,y:32604,varname:node_5307,prsc:2,v1:1;n:type:ShaderForge.SFN_Tex2dAsset,id:4465,x:30675,y:32782,ptovrint:False,ptlb:BarrenRGB,ptin:_BarrenRGB,varname:node_4465,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:08aa80057f00b30419fe625d741bfa39,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:1592,x:31170,y:32779,varname:node_1592,prsc:2,tex:08aa80057f00b30419fe625d741bfa39,ntxv:0,isnm:False|UVIN-9070-OUT,TEX-4465-TEX;n:type:ShaderForge.SFN_Multiply,id:9070,x:30932,y:32863,varname:node_9070,prsc:2|A-6919-OUT,B-9388-OUT;n:type:ShaderForge.SFN_Relay,id:6919,x:30641,y:32428,varname:node_6919,prsc:2|IN-57-UVOUT;n:type:ShaderForge.SFN_Vector1,id:9388,x:30694,y:33003,varname:node_9388,prsc:2,v1:1.2;n:type:ShaderForge.SFN_Vector1,id:440,x:35008,y:32113,varname:node_440,prsc:2,v1:0;n:type:ShaderForge.SFN_Append,id:9194,x:31382,y:32507,varname:node_9194,prsc:2|A-5380-R,B-5380-R,C-5380-R;n:type:ShaderForge.SFN_Append,id:4775,x:31388,y:32822,varname:node_4775,prsc:2|A-1592-G,B-1592-G,C-1592-G;n:type:ShaderForge.SFN_Vector1,id:537,x:28241,y:31366,varname:node_537,prsc:2,v1:2.5;n:type:ShaderForge.SFN_Vector1,id:4857,x:28244,y:31051,varname:node_4857,prsc:2,v1:-0.833;n:type:ShaderForge.SFN_Blend,id:7232,x:32103,y:31487,varname:node_7232,prsc:2,blmd:10,clmp:True|SRC-542-OUT,DST-4822-OUT;n:type:ShaderForge.SFN_Lerp,id:3905,x:32504,y:31540,varname:node_3905,prsc:2|A-7232-OUT,B-542-OUT,T-558-OUT;n:type:ShaderForge.SFN_Vector1,id:7751,x:30245,y:28748,varname:node_7751,prsc:2,v1:-0.15;n:type:ShaderForge.SFN_Vector1,id:1489,x:30221,y:28914,varname:node_1489,prsc:2,v1:0.1;n:type:ShaderForge.SFN_InverseLerp,id:8375,x:30749,y:28913,varname:node_8375,prsc:2|A-7751-OUT,B-1489-OUT,V-1774-Y;n:type:ShaderForge.SFN_Vector1,id:9627,x:30694,y:28574,varname:node_9627,prsc:2,v1:1;n:type:ShaderForge.SFN_Subtract,id:1820,x:31015,y:28911,varname:node_1820,prsc:2|A-9627-OUT,B-8375-OUT;n:type:ShaderForge.SFN_Clamp01,id:558,x:31295,y:28930,varname:node_558,prsc:2|IN-1820-OUT;n:type:ShaderForge.SFN_RemapRange,id:542,x:31706,y:31555,varname:node_542,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.8|IN-9166-RGB;n:type:ShaderForge.SFN_Vector1,id:2723,x:34992,y:32200,varname:node_2723,prsc:2,v1:0.04;n:type:ShaderForge.SFN_Tex2d,id:312,x:32092,y:33921,ptovrint:False,ptlb:FertileNorm,ptin:_FertileNorm,varname:node_312,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:bd424a7ce26bcad4f868f51729190a35,ntxv:3,isnm:True|UVIN-57-UVOUT;n:type:ShaderForge.SFN_Lerp,id:5987,x:32954,y:33877,varname:node_5987,prsc:2|A-2705-OUT,B-312-RGB,T-626-OUT;n:type:ShaderForge.SFN_Lerp,id:3921,x:32946,y:33560,varname:node_3921,prsc:2|A-7618-RGB,B-8683-OUT,T-558-OUT;n:type:ShaderForge.SFN_Vector3,id:8683,x:32652,y:33380,varname:node_8683,prsc:2,v1:0.5,v2:0.5,v3:1;n:type:ShaderForge.SFN_RemapRange,id:9733,x:33024,y:31127,varname:node_9733,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.8|IN-1725-RGB;n:type:ShaderForge.SFN_Tex2d,id:8014,x:27785,y:29203,varname:node_8014,prsc:2,tex:f27c756874db2b34f8f8f82105ae96d0,ntxv:0,isnm:False|UVIN-2471-UVOUT,TEX-1243-TEX;n:type:ShaderForge.SFN_Vector1,id:1847,x:27160,y:29124,varname:node_1847,prsc:2,v1:2;n:type:ShaderForge.SFN_UVTile,id:2471,x:27449,y:28984,varname:node_2471,prsc:2|UVIN-242-UVOUT,WDT-4502-OUT,HGT-4502-OUT,TILE-1847-OUT;n:type:ShaderForge.SFN_Blend,id:7585,x:34578,y:31017,varname:node_7585,prsc:2,blmd:6,clmp:True|SRC-8014-RGB,DST-7426-OUT;n:type:ShaderForge.SFN_Lerp,id:7198,x:34750,y:31253,varname:node_7198,prsc:2|A-7585-OUT,B-7426-OUT,T-2565-OUT;n:type:ShaderForge.SFN_Vector1,id:2565,x:34553,y:31356,varname:node_2565,prsc:2,v1:0.95;n:type:ShaderForge.SFN_Relay,id:886,x:29813,y:31375,varname:node_886,prsc:2;n:type:ShaderForge.SFN_RemapRange,id:1570,x:28649,y:31489,varname:node_1570,prsc:2,frmn:0,frmx:1,tomn:0.1,tomx:0.9|IN-9373-OUT;n:type:ShaderForge.SFN_RemapRange,id:2606,x:32866,y:31424,varname:node_2606,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.8|IN-3905-OUT;n:type:ShaderForge.SFN_Tex2d,id:467,x:31541,y:33971,ptovrint:False,ptlb:BarrenANormal,ptin:_BarrenANormal,varname:node_467,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:26752155e89c03146aac7ec2fd63ce73,ntxv:3,isnm:True|UVIN-4818-OUT;proporder:6571-6699-7618-1725-1272-5140-2509-7892-8153-410-9146-7859-5893-6702-8852-1243-1693-4465-312-467;pass:END;sub:END;*/
Shader "Shader Forge/ShaderTerrain" { Properties { _positionx ("positionx", Float ) = 0 _positionz ("positionz", Float ) = 0 _BarrenBNormal ("BarrenBNormal", 2D) = "bump" {} _Cliff ("Cliff", 2D) = "white" {} _CliffNorm ("CliffNorm", 2D) = "bump" {} _Fertile ("Fertile", 2D) = "white" {} _Food ("Food", Float ) = 0 _MaskFertile ("MaskFertile", 2D) = "white" {} _FoodNeighbour0 ("FoodNeighbour0", Float ) = 0 _FoodNeighbour1 ("FoodNeighbour1", Float ) = 0 _FoodNeighbour2 ("FoodNeighbour2", Float ) = 0 _FoodNeighbour3 ("FoodNeighbour3", Float ) = 0 _FoodNeighbour4 ("FoodNeighbour4", Float ) = 0 _FoodNeighbour5 ("FoodNeighbour5", Float ) = 0 _Ramps ("Ramps", 2D) = "white" {} _Utility ("Utility", 2D) = "white" {} _BeachHeight ("BeachHeight", Float ) = 0.03 _BarrenRGB ("BarrenRGB", 2D) = "white" {} _FertileNorm ("FertileNorm", 2D) = "bump" {} _BarrenANormal ("BarrenANormal", 2D) = "bump" {} } SubShader { Tags { "RenderType"="Opaque" } Pass { Name "FORWARD" Tags { "LightMode"="ForwardBase" } CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDBASE #define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) #define _GLOSSYENV 1 #include "UnityCG.cginc" #include "AutoLight.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" #include "UnityStandardBRDF.cginc" #pragma multi_compile_fwdbase_fullshadows #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON #pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE #pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON #pragma multi_compile_fog #pragma only_renderers d3d9 d3d11 glcore gles #pragma target 3.0 uniform float _positionx; uniform float _positionz; uniform sampler2D _BarrenBNormal; uniform float4 _BarrenBNormal_ST; uniform sampler2D _Cliff; uniform float4 _Cliff_ST; uniform sampler2D _CliffNorm; uniform float4 _CliffNorm_ST; uniform float _Food; uniform sampler2D _Fertile; uniform float4 _Fertile_ST; uniform sampler2D _MaskFertile; uniform float4 _MaskFertile_ST; uniform float _FoodNeighbour0; uniform float _FoodNeighbour1; uniform float _FoodNeighbour2; uniform float _FoodNeighbour3; uniform float _FoodNeighbour4; uniform float _FoodNeighbour5; uniform sampler2D _Ramps; uniform float4 _Ramps_ST; uniform sampler2D _Utility; uniform float4 _Utility_ST; uniform float _BeachHeight; uniform sampler2D _BarrenRGB; uniform float4 _BarrenRGB_ST; uniform sampler2D _FertileNorm; uniform float4 _FertileNorm_ST; uniform sampler2D _BarrenANormal; uniform float4 _BarrenANormal_ST; struct VertexInput { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; float2 texcoord0 : TEXCOORD0; float2 texcoord1 : TEXCOORD1; float2 texcoord2 : TEXCOORD2; float4 vertexColor : COLOR; }; struct VertexOutput { float4 pos : SV_POSITION; float2 uv0 : TEXCOORD0; float2 uv1 : TEXCOORD1; float2 uv2 : TEXCOORD2; float4 posWorld : TEXCOORD3; float3 normalDir : TEXCOORD4; float3 tangentDir : TEXCOORD5; float3 bitangentDir : TEXCOORD6; float4 vertexColor : COLOR; LIGHTING_COORDS(7,8) UNITY_FOG_COORDS(9) #if defined(LIGHTMAP_ON) || defined(UNITY_SHOULD_SAMPLE_SH) float4 ambientOrLightmapUV : TEXCOORD10; #endif }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.uv1 = v.texcoord1; o.uv2 = v.texcoord2; o.vertexColor = v.vertexColor; #ifdef LIGHTMAP_ON o.ambientOrLightmapUV.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; o.ambientOrLightmapUV.zw = 0; #elif UNITY_SHOULD_SAMPLE_SH #endif #ifdef DYNAMICLIGHTMAP_ON o.ambientOrLightmapUV.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif o.normalDir = UnityObjectToWorldNormal(v.normal); o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz ); o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); o.posWorld = mul(unity_ObjectToWorld, v.vertex); float3 lightColor = _LightColor0.rgb; o.pos = UnityObjectToClipPos( v.vertex ); UNITY_TRANSFER_FOG(o,o.pos); TRANSFER_VERTEX_TO_FRAGMENT(o) return o; } float4 frag(VertexOutput i) : COLOR { i.normalDir = normalize(i.normalDir); float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir); float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); float2 node_57 = ((i.uv0+_positionz*float2(0,0.5))+_positionx*float2(0.5,0)); float2 node_6919 = node_57; float2 node_4818 = (node_6919*1.0); float3 _BarrenANormal_var = UnpackNormal(tex2D(_BarrenANormal,TRANSFORM_TEX(node_4818, _BarrenANormal))); float2 node_9070 = (node_6919*1.2); float3 _BarrenBNormal_var = UnpackNormal(tex2D(_BarrenBNormal,TRANSFORM_TEX(node_9070, _BarrenBNormal))); float3 _FertileNorm_var = UnpackNormal(tex2D(_FertileNorm,TRANSFORM_TEX(node_57, _FertileNorm))); float4 _MaskFertile_var = tex2D(_MaskFertile,TRANSFORM_TEX(node_57, _MaskFertile)); float node_4502 = 3.0; float node_4921 = 0.0; float2 node_3909_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_3909_ty = floor(node_4921 * node_3909_tc_rcp.x); float node_3909_tx = node_4921 - node_4502 * node_3909_ty; float2 node_3909 = (i.uv0 + float2(node_3909_tx, node_3909_ty)) * node_3909_tc_rcp; float4 node_9591 = tex2D(_Utility,TRANSFORM_TEX(node_3909, _Utility)); float node_484 = 1.0; float2 node_7855_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_7855_ty = floor(node_484 * node_7855_tc_rcp.x); float node_7855_tx = node_484 - node_4502 * node_7855_ty; float2 node_7855 = (i.uv0 + float2(node_7855_tx, node_7855_ty)) * node_7855_tc_rcp; float4 node_8087 = tex2D(_Utility,TRANSFORM_TEX(node_7855, _Utility)); float node_9373 = max(_Food,max(max(max(max(max((node_9591.r*_FoodNeighbour0),(node_9591.g*_FoodNeighbour1)),(node_9591.b*_FoodNeighbour2)),(node_8087.r*_FoodNeighbour3)),(node_8087.g*_FoodNeighbour4)),(node_8087.b*_FoodNeighbour5))); float node_626 = saturate((_MaskFertile_var.r+lerp((-1.0),1.0,node_9373))); float node_558 = saturate((1.0-((i.posWorld.g-(-0.15))/(0.1-(-0.15))))); float node_9768 = (_BeachHeight*(-1.0)); float node_9542 = (node_9768*(-3.0)); float node_2570 = 0.01; float node_3333 = ((clamp(i.posWorld.g,(node_9768+node_2570),(node_9542-node_2570))-node_9768)/(node_9542-node_9768)); float2 node_7839 = float2(0.03125,node_3333); float4 node_1179 = tex2D(_Ramps,TRANSFORM_TEX(node_7839, _Ramps)); float node_1580 = node_1179.r; float3 _CliffNorm_var = UnpackNormal(tex2D(_CliffNorm,TRANSFORM_TEX(node_57, _CliffNorm))); float3 normalLocal = lerp(lerp(lerp(lerp(_BarrenANormal_var.rgb,_BarrenBNormal_var.rgb,i.vertexColor.r),_FertileNorm_var.rgb,node_626),lerp(_BarrenBNormal_var.rgb,float3(0.5,0.5,1),node_558),node_1580),_CliffNorm_var.rgb,i.vertexColor.g); float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz); float3 lightColor = _LightColor0.rgb; float3 halfDirection = normalize(viewDirection+lightDirection); ////// Lighting: float attenuation = LIGHT_ATTENUATION(i); float3 attenColor = attenuation * _LightColor0.xyz; float Pi = 3.141592654; float InvPi = 0.31830988618; ///////// Gloss: float gloss = 0.04; float perceptualRoughness = 1.0 - 0.04; float roughness = perceptualRoughness * perceptualRoughness; float specPow = exp2( gloss * 10.0 + 1.0 ); /////// GI Data: UnityLight light; #ifdef LIGHTMAP_OFF light.color = lightColor; light.dir = lightDirection; light.ndotl = LambertTerm (normalDirection, light.dir); #else light.color = half3(0.f, 0.f, 0.f); light.ndotl = 0.0f; light.dir = half3(0.f, 0.f, 0.f); #endif UnityGIInput d; d.light = light; d.worldPos = i.posWorld.xyz; d.worldViewDir = viewDirection; d.atten = attenuation; #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) d.ambient = 0; d.lightmapUV = i.ambientOrLightmapUV; #else d.ambient = i.ambientOrLightmapUV; #endif #if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION d.boxMin[0] = unity_SpecCube0_BoxMin; d.boxMin[1] = unity_SpecCube1_BoxMin; #endif #if UNITY_SPECCUBE_BOX_PROJECTION d.boxMax[0] = unity_SpecCube0_BoxMax; d.boxMax[1] = unity_SpecCube1_BoxMax; d.probePosition[0] = unity_SpecCube0_ProbePosition; d.probePosition[1] = unity_SpecCube1_ProbePosition; #endif d.probeHDR[0] = unity_SpecCube0_HDR; d.probeHDR[1] = unity_SpecCube1_HDR; Unity_GlossyEnvironmentData ugls_en_data; ugls_en_data.roughness = 1.0 - gloss; ugls_en_data.reflUVW = viewReflectDirection; UnityGI gi = UnityGlobalIllumination(d, 1, normalDirection, ugls_en_data ); lightDirection = gi.light.dir; lightColor = gi.light.color; ////// Specular: float NdotL = saturate(dot( normalDirection, lightDirection )); float LdotH = saturate(dot(lightDirection, halfDirection)); float3 specularColor = 0.0; float specularMonochrome; float node_1847 = 2.0; float2 node_2471_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_2471_ty = floor(node_1847 * node_2471_tc_rcp.x); float node_2471_tx = node_1847 - node_4502 * node_2471_ty; float2 node_2471 = (i.uv0 + float2(node_2471_tx, node_2471_ty)) * node_2471_tc_rcp; float4 node_8014 = tex2D(_Utility,TRANSFORM_TEX(node_2471, _Utility)); float2 node_1990 = float2(0.15625,((i.posWorld.g-(-0.833))/(2.5-(-0.833)))); float4 node_3968 = tex2D(_Ramps,TRANSFORM_TEX(node_1990, _Ramps)); float4 node_5380 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_4818, _BarrenRGB)); float4 node_1592 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_9070, _BarrenRGB)); float3 node_4822 = (float3(node_1592.g,node_1592.g,node_1592.g)*1.0+0.0); float4 _Fertile_var = tex2D(_Fertile,TRANSFORM_TEX(node_57, _Fertile)); float2 node_3222 = float2(0.21875,(node_9373*0.8+0.1)); float4 node_9705 = tex2D(_Ramps,TRANSFORM_TEX(node_3222, _Ramps)); float2 node_5690 = float2(0.09375,node_3333); float4 node_9166 = tex2D(_Ramps,TRANSFORM_TEX(node_5690, _Ramps)); float3 node_542 = (node_9166.rgb*0.8+0.0); float4 _Cliff_var = tex2D(_Cliff,TRANSFORM_TEX(node_57, _Cliff)); float3 node_7426 = lerp(lerp(lerp(saturate((node_3968.rgb*lerp((float3(node_5380.r,node_5380.r,node_5380.r)*0.4+0.1),node_4822,i.vertexColor.r))),saturate((_Fertile_var.rgb*node_9705.rgb)),node_626),(lerp(saturate(( node_4822 > 0.5 ? (1.0-(1.0-2.0*(node_4822-0.5))*(1.0-node_542)) : (2.0*node_4822*node_542) )),node_542,node_558)*0.8+0.0),node_1580),(_Cliff_var.rgb*0.8+0.0),i.vertexColor.g); float3 diffuseColor = lerp(saturate((1.0-(1.0-node_8014.rgb)*(1.0-node_7426))),node_7426,0.95); // Need this for specular when using metallic diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, specularColor, specularColor, specularMonochrome ); specularMonochrome = 1.0-specularMonochrome; float NdotV = abs(dot( normalDirection, viewDirection )); float NdotH = saturate(dot( normalDirection, halfDirection )); float VdotH = saturate(dot( viewDirection, halfDirection )); float visTerm = SmithJointGGXVisibilityTerm( NdotL, NdotV, roughness ); float normTerm = GGXTerm(NdotH, roughness); float specularPBL = (visTerm*normTerm) * UNITY_PI; #ifdef UNITY_COLORSPACE_GAMMA specularPBL = sqrt(max(1e-4h, specularPBL)); #endif specularPBL = max(0, specularPBL * NdotL); #if defined(_SPECULARHIGHLIGHTS_OFF) specularPBL = 0.0; #endif half surfaceReduction; #ifdef UNITY_COLORSPACE_GAMMA surfaceReduction = 1.0-0.28*roughness*perceptualRoughness; #else surfaceReduction = 1.0/(roughness*roughness + 1.0); #endif specularPBL *= any(specularColor) ? 1.0 : 0.0; float3 directSpecular = attenColor*specularPBL*FresnelTerm(specularColor, LdotH); half grazingTerm = saturate( gloss + specularMonochrome ); float3 indirectSpecular = (gi.indirect.specular); indirectSpecular *= FresnelLerp (specularColor, grazingTerm, NdotV); indirectSpecular *= surfaceReduction; float3 specular = (directSpecular + indirectSpecular); /////// Diffuse: NdotL = max(0.0,dot( normalDirection, lightDirection )); half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss); float nlPow5 = Pow5(1-NdotL); float nvPow5 = Pow5(1-NdotV); float3 directDiffuse = ((1 +(fd90 - 1)*nlPow5) * (1 + (fd90 - 1)*nvPow5) * NdotL) * attenColor; float3 indirectDiffuse = float3(0,0,0); indirectDiffuse += gi.indirect.diffuse; float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor; /// Final Color: float3 finalColor = diffuse + specular; fixed4 finalRGBA = fixed4(finalColor,1); UNITY_APPLY_FOG(i.fogCoord, finalRGBA); return finalRGBA; } ENDCG } Pass { Name "FORWARD_DELTA" Tags { "LightMode"="ForwardAdd" } Blend One One CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDADD #define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) #define _GLOSSYENV 1 #include "UnityCG.cginc" #include "AutoLight.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" #include "UnityStandardBRDF.cginc" #pragma multi_compile_fwdadd_fullshadows #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON #pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE #pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON #pragma multi_compile_fog #pragma only_renderers d3d9 d3d11 glcore gles #pragma target 3.0 uniform float _positionx; uniform float _positionz; uniform sampler2D _BarrenBNormal; uniform float4 _BarrenBNormal_ST; uniform sampler2D _Cliff; uniform float4 _Cliff_ST; uniform sampler2D _CliffNorm; uniform float4 _CliffNorm_ST; uniform float _Food; uniform sampler2D _Fertile; uniform float4 _Fertile_ST; uniform sampler2D _MaskFertile; uniform float4 _MaskFertile_ST; uniform float _FoodNeighbour0; uniform float _FoodNeighbour1; uniform float _FoodNeighbour2; uniform float _FoodNeighbour3; uniform float _FoodNeighbour4; uniform float _FoodNeighbour5; uniform sampler2D _Ramps; uniform float4 _Ramps_ST; uniform sampler2D _Utility; uniform float4 _Utility_ST; uniform float _BeachHeight; uniform sampler2D _BarrenRGB; uniform float4 _BarrenRGB_ST; uniform sampler2D _FertileNorm; uniform float4 _FertileNorm_ST; uniform sampler2D _BarrenANormal; uniform float4 _BarrenANormal_ST; struct VertexInput { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; float2 texcoord0 : TEXCOORD0; float2 texcoord1 : TEXCOORD1; float2 texcoord2 : TEXCOORD2; float4 vertexColor : COLOR; }; struct VertexOutput { float4 pos : SV_POSITION; float2 uv0 : TEXCOORD0; float2 uv1 : TEXCOORD1; float2 uv2 : TEXCOORD2; float4 posWorld : TEXCOORD3; float3 normalDir : TEXCOORD4; float3 tangentDir : TEXCOORD5; float3 bitangentDir : TEXCOORD6; float4 vertexColor : COLOR; LIGHTING_COORDS(7,8) UNITY_FOG_COORDS(9) }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.uv1 = v.texcoord1; o.uv2 = v.texcoord2; o.vertexColor = v.vertexColor; o.normalDir = UnityObjectToWorldNormal(v.normal); o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz ); o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); o.posWorld = mul(unity_ObjectToWorld, v.vertex); float3 lightColor = _LightColor0.rgb; o.pos = UnityObjectToClipPos( v.vertex ); UNITY_TRANSFER_FOG(o,o.pos); TRANSFER_VERTEX_TO_FRAGMENT(o) return o; } float4 frag(VertexOutput i) : COLOR { i.normalDir = normalize(i.normalDir); float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir); float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); float2 node_57 = ((i.uv0+_positionz*float2(0,0.5))+_positionx*float2(0.5,0)); float2 node_6919 = node_57; float2 node_4818 = (node_6919*1.0); float3 _BarrenANormal_var = UnpackNormal(tex2D(_BarrenANormal,TRANSFORM_TEX(node_4818, _BarrenANormal))); float2 node_9070 = (node_6919*1.2); float3 _BarrenBNormal_var = UnpackNormal(tex2D(_BarrenBNormal,TRANSFORM_TEX(node_9070, _BarrenBNormal))); float3 _FertileNorm_var = UnpackNormal(tex2D(_FertileNorm,TRANSFORM_TEX(node_57, _FertileNorm))); float4 _MaskFertile_var = tex2D(_MaskFertile,TRANSFORM_TEX(node_57, _MaskFertile)); float node_4502 = 3.0; float node_4921 = 0.0; float2 node_3909_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_3909_ty = floor(node_4921 * node_3909_tc_rcp.x); float node_3909_tx = node_4921 - node_4502 * node_3909_ty; float2 node_3909 = (i.uv0 + float2(node_3909_tx, node_3909_ty)) * node_3909_tc_rcp; float4 node_9591 = tex2D(_Utility,TRANSFORM_TEX(node_3909, _Utility)); float node_484 = 1.0; float2 node_7855_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_7855_ty = floor(node_484 * node_7855_tc_rcp.x); float node_7855_tx = node_484 - node_4502 * node_7855_ty; float2 node_7855 = (i.uv0 + float2(node_7855_tx, node_7855_ty)) * node_7855_tc_rcp; float4 node_8087 = tex2D(_Utility,TRANSFORM_TEX(node_7855, _Utility)); float node_9373 = max(_Food,max(max(max(max(max((node_9591.r*_FoodNeighbour0),(node_9591.g*_FoodNeighbour1)),(node_9591.b*_FoodNeighbour2)),(node_8087.r*_FoodNeighbour3)),(node_8087.g*_FoodNeighbour4)),(node_8087.b*_FoodNeighbour5))); float node_626 = saturate((_MaskFertile_var.r+lerp((-1.0),1.0,node_9373))); float node_558 = saturate((1.0-((i.posWorld.g-(-0.15))/(0.1-(-0.15))))); float node_9768 = (_BeachHeight*(-1.0)); float node_9542 = (node_9768*(-3.0)); float node_2570 = 0.01; float node_3333 = ((clamp(i.posWorld.g,(node_9768+node_2570),(node_9542-node_2570))-node_9768)/(node_9542-node_9768)); float2 node_7839 = float2(0.03125,node_3333); float4 node_1179 = tex2D(_Ramps,TRANSFORM_TEX(node_7839, _Ramps)); float node_1580 = node_1179.r; float3 _CliffNorm_var = UnpackNormal(tex2D(_CliffNorm,TRANSFORM_TEX(node_57, _CliffNorm))); float3 normalLocal = lerp(lerp(lerp(lerp(_BarrenANormal_var.rgb,_BarrenBNormal_var.rgb,i.vertexColor.r),_FertileNorm_var.rgb,node_626),lerp(_BarrenBNormal_var.rgb,float3(0.5,0.5,1),node_558),node_1580),_CliffNorm_var.rgb,i.vertexColor.g); float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w)); float3 lightColor = _LightColor0.rgb; float3 halfDirection = normalize(viewDirection+lightDirection); ////// Lighting: float attenuation = LIGHT_ATTENUATION(i); float3 attenColor = attenuation * _LightColor0.xyz; float Pi = 3.141592654; float InvPi = 0.31830988618; ///////// Gloss: float gloss = 0.04; float perceptualRoughness = 1.0 - 0.04; float roughness = perceptualRoughness * perceptualRoughness; float specPow = exp2( gloss * 10.0 + 1.0 ); ////// Specular: float NdotL = saturate(dot( normalDirection, lightDirection )); float LdotH = saturate(dot(lightDirection, halfDirection)); float3 specularColor = 0.0; float specularMonochrome; float node_1847 = 2.0; float2 node_2471_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_2471_ty = floor(node_1847 * node_2471_tc_rcp.x); float node_2471_tx = node_1847 - node_4502 * node_2471_ty; float2 node_2471 = (i.uv0 + float2(node_2471_tx, node_2471_ty)) * node_2471_tc_rcp; float4 node_8014 = tex2D(_Utility,TRANSFORM_TEX(node_2471, _Utility)); float2 node_1990 = float2(0.15625,((i.posWorld.g-(-0.833))/(2.5-(-0.833)))); float4 node_3968 = tex2D(_Ramps,TRANSFORM_TEX(node_1990, _Ramps)); float4 node_5380 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_4818, _BarrenRGB)); float4 node_1592 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_9070, _BarrenRGB)); float3 node_4822 = (float3(node_1592.g,node_1592.g,node_1592.g)*1.0+0.0); float4 _Fertile_var = tex2D(_Fertile,TRANSFORM_TEX(node_57, _Fertile)); float2 node_3222 = float2(0.21875,(node_9373*0.8+0.1)); float4 node_9705 = tex2D(_Ramps,TRANSFORM_TEX(node_3222, _Ramps)); float2 node_5690 = float2(0.09375,node_3333); float4 node_9166 = tex2D(_Ramps,TRANSFORM_TEX(node_5690, _Ramps)); float3 node_542 = (node_9166.rgb*0.8+0.0); float4 _Cliff_var = tex2D(_Cliff,TRANSFORM_TEX(node_57, _Cliff)); float3 node_7426 = lerp(lerp(lerp(saturate((node_3968.rgb*lerp((float3(node_5380.r,node_5380.r,node_5380.r)*0.4+0.1),node_4822,i.vertexColor.r))),saturate((_Fertile_var.rgb*node_9705.rgb)),node_626),(lerp(saturate(( node_4822 > 0.5 ? (1.0-(1.0-2.0*(node_4822-0.5))*(1.0-node_542)) : (2.0*node_4822*node_542) )),node_542,node_558)*0.8+0.0),node_1580),(_Cliff_var.rgb*0.8+0.0),i.vertexColor.g); float3 diffuseColor = lerp(saturate((1.0-(1.0-node_8014.rgb)*(1.0-node_7426))),node_7426,0.95); // Need this for specular when using metallic diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, specularColor, specularColor, specularMonochrome ); specularMonochrome = 1.0-specularMonochrome; float NdotV = abs(dot( normalDirection, viewDirection )); float NdotH = saturate(dot( normalDirection, halfDirection )); float VdotH = saturate(dot( viewDirection, halfDirection )); float visTerm = SmithJointGGXVisibilityTerm( NdotL, NdotV, roughness ); float normTerm = GGXTerm(NdotH, roughness); float specularPBL = (visTerm*normTerm) * UNITY_PI; #ifdef UNITY_COLORSPACE_GAMMA specularPBL = sqrt(max(1e-4h, specularPBL)); #endif specularPBL = max(0, specularPBL * NdotL); #if defined(_SPECULARHIGHLIGHTS_OFF) specularPBL = 0.0; #endif specularPBL *= any(specularColor) ? 1.0 : 0.0; float3 directSpecular = attenColor*specularPBL*FresnelTerm(specularColor, LdotH); float3 specular = directSpecular; /////// Diffuse: NdotL = max(0.0,dot( normalDirection, lightDirection )); half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss); float nlPow5 = Pow5(1-NdotL); float nvPow5 = Pow5(1-NdotV); float3 directDiffuse = ((1 +(fd90 - 1)*nlPow5) * (1 + (fd90 - 1)*nvPow5) * NdotL) * attenColor; float3 diffuse = directDiffuse * diffuseColor; /// Final Color: float3 finalColor = diffuse + specular; fixed4 finalRGBA = fixed4(finalColor * 1,0); UNITY_APPLY_FOG(i.fogCoord, finalRGBA); return finalRGBA; } ENDCG } Pass { Name "Meta" Tags { "LightMode"="Meta" } Cull Off CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_META 1 #define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) #define _GLOSSYENV 1 #include "UnityCG.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" #include "UnityStandardBRDF.cginc" #include "UnityMetaPass.cginc" #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_shadowcaster #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON #pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE #pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON #pragma multi_compile_fog #pragma only_renderers d3d9 d3d11 glcore gles #pragma target 3.0 uniform float _positionx; uniform float _positionz; uniform sampler2D _Cliff; uniform float4 _Cliff_ST; uniform float _Food; uniform sampler2D _Fertile; uniform float4 _Fertile_ST; uniform sampler2D _MaskFertile; uniform float4 _MaskFertile_ST; uniform float _FoodNeighbour0; uniform float _FoodNeighbour1; uniform float _FoodNeighbour2; uniform float _FoodNeighbour3; uniform float _FoodNeighbour4; uniform float _FoodNeighbour5; uniform sampler2D _Ramps; uniform float4 _Ramps_ST; uniform sampler2D _Utility; uniform float4 _Utility_ST; uniform float _BeachHeight; uniform sampler2D _BarrenRGB; uniform float4 _BarrenRGB_ST; struct VertexInput { float4 vertex : POSITION; float2 texcoord0 : TEXCOORD0; float2 texcoord1 : TEXCOORD1; float2 texcoord2 : TEXCOORD2; float4 vertexColor : COLOR; }; struct VertexOutput { float4 pos : SV_POSITION; float2 uv0 : TEXCOORD0; float2 uv1 : TEXCOORD1; float2 uv2 : TEXCOORD2; float4 posWorld : TEXCOORD3; float4 vertexColor : COLOR; }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.uv1 = v.texcoord1; o.uv2 = v.texcoord2; o.vertexColor = v.vertexColor; o.posWorld = mul(unity_ObjectToWorld, v.vertex); o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST ); return o; } float4 frag(VertexOutput i) : SV_Target { float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); UnityMetaInput o; UNITY_INITIALIZE_OUTPUT( UnityMetaInput, o ); o.Emission = 0; float node_4502 = 3.0; float node_1847 = 2.0; float2 node_2471_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_2471_ty = floor(node_1847 * node_2471_tc_rcp.x); float node_2471_tx = node_1847 - node_4502 * node_2471_ty; float2 node_2471 = (i.uv0 + float2(node_2471_tx, node_2471_ty)) * node_2471_tc_rcp; float4 node_8014 = tex2D(_Utility,TRANSFORM_TEX(node_2471, _Utility)); float2 node_1990 = float2(0.15625,((i.posWorld.g-(-0.833))/(2.5-(-0.833)))); float4 node_3968 = tex2D(_Ramps,TRANSFORM_TEX(node_1990, _Ramps)); float2 node_57 = ((i.uv0+_positionz*float2(0,0.5))+_positionx*float2(0.5,0)); float2 node_6919 = node_57; float2 node_4818 = (node_6919*1.0); float4 node_5380 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_4818, _BarrenRGB)); float2 node_9070 = (node_6919*1.2); float4 node_1592 = tex2D(_BarrenRGB,TRANSFORM_TEX(node_9070, _BarrenRGB)); float3 node_4822 = (float3(node_1592.g,node_1592.g,node_1592.g)*1.0+0.0); float4 _Fertile_var = tex2D(_Fertile,TRANSFORM_TEX(node_57, _Fertile)); float node_4921 = 0.0; float2 node_3909_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_3909_ty = floor(node_4921 * node_3909_tc_rcp.x); float node_3909_tx = node_4921 - node_4502 * node_3909_ty; float2 node_3909 = (i.uv0 + float2(node_3909_tx, node_3909_ty)) * node_3909_tc_rcp; float4 node_9591 = tex2D(_Utility,TRANSFORM_TEX(node_3909, _Utility)); float node_484 = 1.0; float2 node_7855_tc_rcp = float2(1.0,1.0)/float2( node_4502, node_4502 ); float node_7855_ty = floor(node_484 * node_7855_tc_rcp.x); float node_7855_tx = node_484 - node_4502 * node_7855_ty; float2 node_7855 = (i.uv0 + float2(node_7855_tx, node_7855_ty)) * node_7855_tc_rcp; float4 node_8087 = tex2D(_Utility,TRANSFORM_TEX(node_7855, _Utility)); float node_9373 = max(_Food,max(max(max(max(max((node_9591.r*_FoodNeighbour0),(node_9591.g*_FoodNeighbour1)),(node_9591.b*_FoodNeighbour2)),(node_8087.r*_FoodNeighbour3)),(node_8087.g*_FoodNeighbour4)),(node_8087.b*_FoodNeighbour5))); float2 node_3222 = float2(0.21875,(node_9373*0.8+0.1)); float4 node_9705 = tex2D(_Ramps,TRANSFORM_TEX(node_3222, _Ramps)); float4 _MaskFertile_var = tex2D(_MaskFertile,TRANSFORM_TEX(node_57, _MaskFertile)); float node_626 = saturate((_MaskFertile_var.r+lerp((-1.0),1.0,node_9373))); float node_9768 = (_BeachHeight*(-1.0)); float node_9542 = (node_9768*(-3.0)); float node_2570 = 0.01; float node_3333 = ((clamp(i.posWorld.g,(node_9768+node_2570),(node_9542-node_2570))-node_9768)/(node_9542-node_9768)); float2 node_5690 = float2(0.09375,node_3333); float4 node_9166 = tex2D(_Ramps,TRANSFORM_TEX(node_5690, _Ramps)); float3 node_542 = (node_9166.rgb*0.8+0.0); float node_558 = saturate((1.0-((i.posWorld.g-(-0.15))/(0.1-(-0.15))))); float2 node_7839 = float2(0.03125,node_3333); float4 node_1179 = tex2D(_Ramps,TRANSFORM_TEX(node_7839, _Ramps)); float node_1580 = node_1179.r; float4 _Cliff_var = tex2D(_Cliff,TRANSFORM_TEX(node_57, _Cliff)); float3 node_7426 = lerp(lerp(lerp(saturate((node_3968.rgb*lerp((float3(node_5380.r,node_5380.r,node_5380.r)*0.4+0.1),node_4822,i.vertexColor.r))),saturate((_Fertile_var.rgb*node_9705.rgb)),node_626),(lerp(saturate(( node_4822 > 0.5 ? (1.0-(1.0-2.0*(node_4822-0.5))*(1.0-node_542)) : (2.0*node_4822*node_542) )),node_542,node_558)*0.8+0.0),node_1580),(_Cliff_var.rgb*0.8+0.0),i.vertexColor.g); float3 diffColor = lerp(saturate((1.0-(1.0-node_8014.rgb)*(1.0-node_7426))),node_7426,0.95); float specularMonochrome; float3 specColor; diffColor = DiffuseAndSpecularFromMetallic( diffColor, 0.0, specColor, specularMonochrome ); float roughness = 1.0 - 0.04; o.Albedo = diffColor + specColor * roughness * roughness * 0.5; return UnityMetaFragment( o ); } ENDCG } } FallBack "Diffuse" CustomEditor "ShaderForgeMaterialInspector" }
Service d'assistance aux clients par UserEcho