Search Unity

Antonov Suit - Physically Based Shader - First Release

Discussion in 'Works In Progress - Archive' started by Charkes, Apr 24, 2013.

  1. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Ah right....you are working on forward, i forgot about that my bad...sorry
     
  2. RUBILYN

    RUBILYN

    Joined:
    Jun 22, 2013
    Posts:
    54

    Hi Charles !

    This is Quite a Amazing Result here !

    0) Its Possible to Keep Both Burley As Default And Lambert As Optional if we Want ?


    - It Seams Burley is a amazing model to Simulate All kind of "Porous Surfaces" ..

    - Wille Seams The Old fashioned Lambert Is Definitively Still Better for Simulating "Plastics"

    The more Options the Merrier Longer Spectre of Usage !​

    1) Dear Charles Can you Please Upload those Burley and Planar Reflections

    ( Even if broken ) Or If you dont want to Submith Anything But majors At Github !

    Can you Just Please Upload In a Post here ... For us to work with ?

    Thanks so much !​



    2) The Planar Reflections look Incredible ! Congratulations !


    You already did a Unreal like Shader in Unity ! You added Screen Space Reflections ! And Now Planar !
    :D
    (Giggles ) You are almost doing a "Livenda" like Product BUT FOR FREE here on your own ! Hahaha...

    Next big Thing would be some kind of Screen Space GI Bleeding Hack hum ? ;)

    I think this Framework Reached a Maturity level to be Considered a "Free Product" ...

    Its Still Sad We dont listen to many People Using it ...​

    3) ( About Improvments Ideas ) Iv found out Some Cool UNITY FREE Sky / Sun / Phisical Fx .. etc !

    As well Some other Cool Stuffs Even Codes Ported from Unreal Sources to Unity @ ArmedUnity ..
    Check it out !

    http://armedunity.com/topic/8446-improving-the-visual-fidelity-of-your-games-advanced/
    http://armedunity.com/topic/7177-indie-sky/page-2
    http://armedunity.com/topic/9133-horizon-based-directional-occlusion/?hl=hbao
    http://armedunity.com/topic/7064-simple-sun/

    As Most of those are all cooked and ready to use ..
    Would be reaaly cool to Integrate those in "Antonov Suite"

    Im Reaaly visioning Already this work yours If Treated as a "suite" instead of just Shaders Could be quite a Revolution ...
    If you Keep adding Experimental Playground Features / as well Integrating Many Other Free codes in it ^^

    Antonov Can Become a For all kinds Next gen Defacto "phisical based Free Suite" For Unity ...​


    4) Charles! Wenever you have time ... You Could look At Lux and Get Some Lux Inspired Physical Terrain / Vegetation Shaders There / Get Some Early UNITY 5 Compatibility ... Pack All & Submit this to Assets Store ! For More Exposure ! And After having The Exposure in Assets store Store Open Some Kind of Donation Account ... Seriously !

    Expecially the fact of beying the First To Integrate Unity 5 Will Make Antonov a High Requested Package ^^

    If you Can Integrate Antonov in the Unity 5 SHaders Improving Them ...
    ANd bring Same Results With UNITY 4 as in UNITY 5 ...

    Expecially if Antonov Integrates a Single Simple Phisical based MOBILE Shader Variance as well .... Like Skyshop : ) For Unity 4 or It Uses the Unity 5 Mobile Stuff ...

    This Of GettinG Antonov Working Both With Unity 5/4 Defaults will make Antonov Open Package a High Need Standart ...

    - Now with Unity 5 PHISICAL Shaders ... Around
    We Reaaly need a Hero to "Basicaly" Bring For free The Unity 5 PBS Shaders to Unity 4 ...

    ANd i Guess if Antonov Suite can Integrate Same Time in Unity 5 SHaders ...Including its Physical Features to be Driven in a Unity 5 Shader With a Antonov.Cginc / As well bring Those Same Unity 5 Capabilities to Unity 4 ... In a Same Shader Driven on its options With Simple Includes.cginc

    ( People will Seriously Prefer using the ANTONOV Suite Instead Unity 5 Shader . )

    ( Well if we Go Straight Facts - This is something UNITY3D Should Contract you to do it - or Do themselfs lol ... Instead of Breacking the "Unity 4 / Unity 5 " Proper Flow Integration for smoother Transition of projects betwen unity 4 and 5 They SHould Seriously Make a Reaaly UNIVERSAL Unity Shader That Works Exactly Same Features and as Good in Unity 5 and Unity 4 Same time ... )
    As i guess ( just for not having the assle ) they will not do That for a Loong time even after Unity 5 Released
    ...
    And even If Unity 5 is Oficially Released at this New Year .. Im sure It will take like a Whole year or even more for the big majority of Unity 4 Existing Projects outhere to Translate their works in Unity 5 ... People Will be afraid of Unity 5 Bugs and wasting time ... So Most of them they will not Transition to Unity 5 that quickly ...

    I guess ANTONOV SUITE Could beCome This way That Most Universal UNITY5 / UNITY4 Integrated Shader ... !

    Right ? :D

    Iv seen you Around the Unity 5 forum ...

    So i know You are already testing Antonov in Unity 5 !
    Thanks so much for that ! Is Freaking Amazing !​

    5 ) Any news On Any Solution for a "Relief Oclusion" Pom SOlution in Antonov ?

    ANd how ABout Triplanar Mapping To add as Extra "snow" or "Moss" ?

    I got here Two or Tree SHaderForge Builded SHaders We and SOme Friends Builded
    ... With Some Code Ready to Integrate And Translate to Antonov Freely ...

    I WOULD REAALY LOVE TO SEE THIS ONES IN ANTONOV !
    ( And i guess many People would ! )

    Check it out ! I got SOme Codes i made And Mixed in SHaderforge For you !

    Proper TRIPLANAR MAPPING With Smoother Blend Zones .. Normal & SPecular & Difuse

    Code (CSharp):
    1.  
    2.  
    3. // Shader created with Shader Forge Beta 0.36
    4. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    6. /*SF_DATA;ver:0.36;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:3,uamb:True,mssp:True,lmpd:True,lprd:True,enco:False,frtr:True,vitr:True,dbil:True,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,blpr:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:True,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.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:32522,y:33082|diff-82-OUT,spec-9-RGB,gloss-2-OUT,normal-13-OUT,emission-18-OUT,amdfl-22-OUT,amspl-26-OUT;n:type:ShaderForge.SFN_RemapRangeAdvanced,id:2,x:33022,y:32881|IN-81-OUT,IMIN-3-OUT,IMAX-4-OUT,OMIN-5-OUT,OMAX-6-OUT;n:type:ShaderForge.SFN_Vector1,id:3,x:33249,y:32831,v1:0;n:type:ShaderForge.SFN_Vector1,id:4,x:33249,y:32881,v1:1;n:type:ShaderForge.SFN_ValueProperty,id:5,x:33243,y:32959,ptlb:Gloss Min,ptin:_GlossMin,glob:False,v1:0.231991;n:type:ShaderForge.SFN_ValueProperty,id:6,x:33252,y:33074,ptlb:Gloss Max,ptin:_GlossMax,glob:False,v1:0.7645723;n:type:ShaderForge.SFN_Lerp,id:7,x:33301,y:32649|A-12-OUT,B-48-RGB,T-67-OUT;n:type:ShaderForge.SFN_Color,id:9,x:33049,y:33045,ptlb:Specular color,ptin:_Specularcolor,glob:False,c1:0.1,c2:0.1,c3:0.1,c4:1;n:type:ShaderForge.SFN_Lerp,id:10,x:33249,y:32433|A-11-OUT,B-37-RGB,T-67-OUT;n:type:ShaderForge.SFN_Lerp,id:11,x:33490,y:32313|A-29-RGB,B-34-RGB,T-65-OUT;n:type:ShaderForge.SFN_Lerp,id:12,x:33525,y:32556|A-44-RGB,B-46-RGB,T-65-OUT;n:type:ShaderForge.SFN_Lerp,id:13,x:33289,y:33214|A-28-OUT,B-56-RGB,T-67-OUT;n:type:ShaderForge.SFN_Cubemap,id:14,x:33231,y:33387,ptlb:Cubemap,ptin:_Cubemap;n:type:ShaderForge.SFN_Color,id:15,x:33162,y:33584,ptlb:Cubemap Color,ptin:_CubemapColor,glob:False,c1:0.1,c2:0.2,c3:0.3,c4:1;n:type:ShaderForge.SFN_Multiply,id:16,x:32995,y:33424|A-14-RGB,B-15-RGB;n:type:ShaderForge.SFN_ValueProperty,id:17,x:33071,y:33275,ptlb:CubeMap Emision,ptin:_CubeMapEmision,glob:False,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:18,x:32854,y:33275|A-17-OUT,B-16-OUT;n:type:ShaderForge.SFN_ValueProperty,id:20,x:32987,y:33594,ptlb:Difuse Ambient Intensity,ptin:_DifuseAmbientIntensity,glob:False,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:22,x:32811,y:33594|A-20-OUT,B-16-OUT;n:type:ShaderForge.SFN_ValueProperty,id:24,x:32987,y:33799,ptlb:Specular Ambient Intensity,ptin:_SpecularAmbientIntensity,glob:False,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:26,x:32811,y:33799|A-24-OUT,B-16-OUT;n:type:ShaderForge.SFN_Lerp,id:28,x:33523,y:33093|A-52-RGB,B-54-RGB,T-65-OUT;n:type:ShaderForge.SFN_Tex2d,id:29,x:33968,y:31990,ntxv:0,isnm:False|UVIN-59-OUT,TEX-39-TEX;n:type:ShaderForge.SFN_Tex2d,id:34,x:33983,y:32212,ntxv:0,isnm:False|UVIN-60-OUT,TEX-39-TEX;n:type:ShaderForge.SFN_Tex2d,id:37,x:33983,y:32442,ntxv:0,isnm:False|UVIN-61-OUT,TEX-39-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:39,x:34321,y:32013,ptlb:Difuse Map,ptin:_DifuseMap,glob:False;n:type:ShaderForge.SFN_Tex2d,id:44,x:33946,y:32638,ntxv:0,isnm:False|UVIN-59-OUT,TEX-50-TEX;n:type:ShaderForge.SFN_Tex2d,id:46,x:33961,y:32860,ntxv:0,isnm:False|UVIN-60-OUT,TEX-50-TEX;n:type:ShaderForge.SFN_Tex2d,id:48,x:33961,y:33090,ntxv:0,isnm:False|UVIN-61-OUT,TEX-50-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:50,x:34294,y:32862,ptlb:Gloss Map,ptin:_GlossMap,glob:False;n:type:ShaderForge.SFN_Tex2d,id:52,x:33991,y:33293,ntxv:0,isnm:False|UVIN-59-OUT,TEX-58-TEX;n:type:ShaderForge.SFN_Tex2d,id:54,x:34006,y:33515,ntxv:0,isnm:False|UVIN-60-OUT,TEX-58-TEX;n:type:ShaderForge.SFN_Tex2d,id:56,x:34016,y:33685,ntxv:0,isnm:False|UVIN-61-OUT,TEX-58-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:58,x:34401,y:33591,ptlb:Normal Map,ptin:_NormalMap,glob:False;n:type:ShaderForge.SFN_Append,id:59,x:34745,y:32720|A-62-Y,B-62-Z;n:type:ShaderForge.SFN_Append,id:60,x:34745,y:32883|A-62-X,B-62-Z;n:type:ShaderForge.SFN_Append,id:61,x:34745,y:33073|A-62-X,B-62-Y;n:type:ShaderForge.SFN_FragmentPosition,id:62,x:35006,y:32789;n:type:ShaderForge.SFN_Blend,id:65,x:33605,y:33771,blmd:13,clmp:True|SRC-66-OUT,DST-34-RGB;n:type:ShaderForge.SFN_ComponentMask,id:66,x:33853,y:33878,cc1:1,cc2:-1,cc3:-1,cc4:-1|IN-68-OUT;n:type:ShaderForge.SFN_Blend,id:67,x:33591,y:33964,blmd:10,clmp:True|SRC-72-OUT,DST-37-RGB;n:type:ShaderForge.SFN_Clamp01,id:68,x:34057,y:33878|IN-69-OUT;n:type:ShaderForge.SFN_RemapRange,id:69,x:34283,y:33872,frmn:0.2,frmx:0.65,tomn:0,tomx:1|IN-77-OUT;n:type:ShaderForge.SFN_ComponentMask,id:72,x:33853,y:34074,cc1:2,cc2:-1,cc3:-1,cc4:-1|IN-74-OUT;n:type:ShaderForge.SFN_Clamp01,id:74,x:34057,y:34074|IN-76-OUT;n:type:ShaderForge.SFN_RemapRange,id:76,x:34283,y:34074,frmn:0.1,frmx:0.75,tomn:0,tomx:1|IN-77-OUT;n:type:ShaderForge.SFN_Abs,id:77,x:34440,y:33967|IN-78-OUT;n:type:ShaderForge.SFN_NormalVector,id:78,x:34624,y:33961,pt:False;n:type:ShaderForge.SFN_Desaturate,id:81,x:33116,y:32681|COL-7-OUT;n:type:ShaderForge.SFN_Multiply,id:82,x:32768,y:32786|A-83-RGB,B-10-OUT;n:type:ShaderForge.SFN_Color,id:83,x:32907,y:32526,ptlb:Difuse Color,ptin:_DifuseColor,glob:False,c1:0.5,c2:0.5,c3:0.5,c4:1;proporder:39-58-50-83-9-5-6-14-15-17-20-24;pass:END;sub:END;*/
    7.  
    8. Shader "3DLABS/ AdvancedTriplanar" {
    9.     Properties {
    10.         _DifuseMap ("Difuse Map", 2D) = "white" {}
    11.         _NormalMap ("Normal Map", 2D) = "bump" {}
    12.         _GlossMap ("Gloss Map", 2D) = "white" {}
    13.         _DifuseColor ("Difuse Color", Color) = (0.5,0.5,0.5,1)
    14.         _Specularcolor ("Specular color", Color) = (0.1,0.1,0.1,1)
    15.         _GlossMin ("Gloss Min", Float ) = 0.231991
    16.         _GlossMax ("Gloss Max", Float ) = 0.7645723
    17.         _Cubemap ("Cubemap", Cube) = "_Skybox" {}
    18.         _CubemapColor ("Cubemap Color", Color) = (0.1,0.2,0.3,1)
    19.         _CubeMapEmision ("CubeMap Emision", Float ) = 0.5
    20.         _DifuseAmbientIntensity ("Difuse Ambient Intensity", Float ) = 0.5
    21.         _SpecularAmbientIntensity ("Specular Ambient Intensity", Float ) = 0.5
    22.     }
    23.     SubShader {
    24.         Tags {
    25.             "RenderType"="Opaque"
    26.         }
    27.         LOD 200
    28.         Pass {
    29.             Name "ForwardBase"
    30.             Tags {
    31.                 "LightMode"="ForwardBase"
    32.             }
    33.          
    34.          
    35.             CGPROGRAM
    36.             #pragma vertex vert
    37.             #pragma fragment frag
    38.             #define UNITY_PASS_FORWARDBASE
    39.             #include "UnityCG.cginc"
    40.             #include "AutoLight.cginc"
    41.             #include "Lighting.cginc"
    42.             #pragma multi_compile_fwdbase_fullshadows
    43.             #pragma exclude_renderers d3d11 opengl gles xbox360 ps3 flash d3d11_9x
    44.             #pragma target 3.0
    45.             #ifndef LIGHTMAP_OFF
    46.                 float4 unity_LightmapST;
    47.                 sampler2D unity_Lightmap;
    48.                 #ifndef DIRLIGHTMAP_OFF
    49.                     sampler2D unity_LightmapInd;
    50.                 #endif
    51.             #endif
    52.             uniform float _GlossMin;
    53.             uniform float _GlossMax;
    54.             uniform float4 _Specularcolor;
    55.             uniform samplerCUBE _Cubemap;
    56.             uniform float4 _CubemapColor;
    57.             uniform float _CubeMapEmision;
    58.             uniform float _DifuseAmbientIntensity;
    59.             uniform float _SpecularAmbientIntensity;
    60.             uniform sampler2D _DifuseMap; uniform float4 _DifuseMap_ST;
    61.             uniform sampler2D _GlossMap; uniform float4 _GlossMap_ST;
    62.             uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST;
    63.             uniform float4 _DifuseColor;
    64.             struct VertexInput {
    65.                 float4 vertex : POSITION;
    66.                 float3 normal : NORMAL;
    67.                 float4 tangent : TANGENT;
    68.                 float2 texcoord1 : TEXCOORD1;
    69.             };
    70.             struct VertexOutput {
    71.                 float4 pos : SV_POSITION;
    72.                 float4 posWorld : TEXCOORD0;
    73.                 float3 normalDir : TEXCOORD1;
    74.                 float3 tangentDir : TEXCOORD2;
    75.                 float3 binormalDir : TEXCOORD3;
    76.                 LIGHTING_COORDS(4,5)
    77.                 #ifndef LIGHTMAP_OFF
    78.                     float2 uvLM : TEXCOORD6;
    79.                 #else
    80.                     float3 shLight : TEXCOORD6;
    81.                 #endif
    82.             };
    83.             VertexOutput vert (VertexInput v) {
    84.                 VertexOutput o;
    85.                 #ifdef LIGHTMAP_OFF
    86.                     o.shLight = ShadeSH9(float4(mul(_Object2World, float4(v.normal,0)).xyz * unity_Scale.w,1));
    87.                 #endif
    88.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    89.                 o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    90.                 o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    91.                 o.posWorld = mul(_Object2World, v.vertex);
    92.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    93.                 #ifndef LIGHTMAP_OFF
    94.                     o.uvLM = v.texcoord1 * unity_LightmapST.xy + unity_LightmapST.zw;
    95.                 #endif
    96.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    97.                 return o;
    98.             }
    99.             fixed4 frag(VertexOutput i) : COLOR {
    100.                 i.normalDir = normalize(i.normalDir);
    101.                 float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    102.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    103. /////// Normals:
    104.                 float4 node_62 = i.posWorld;
    105.                 float2 node_59 = float2(node_62.g,node_62.b);
    106.                 float2 node_60 = float2(node_62.r,node_62.b);
    107.                 float3 node_77 = abs(i.normalDir);
    108.                 float4 node_34 = tex2D(_DifuseMap,TRANSFORM_TEX(node_60, _DifuseMap));
    109.                 float3 node_65 = saturate(( saturate((node_77*2.222222+-0.4444445)).g > 0.5 ? (node_34.rgb/((1.0-saturate((node_77*2.222222+-0.4444445)).g)*2.0)) : (1.0-(((1.0-node_34.rgb)*0.5)/saturate((node_77*2.222222+-0.4444445)).g))));
    110.                 float2 node_61 = float2(node_62.r,node_62.g);
    111.                 float4 node_37 = tex2D(_DifuseMap,TRANSFORM_TEX(node_61, _DifuseMap));
    112.                 float3 node_67 = saturate(( node_37.rgb > 0.5 ? (1.0-(1.0-2.0*(node_37.rgb-0.5))*(1.0-saturate((node_77*1.538462+-0.1538462)).b)) : (2.0*node_37.rgb*saturate((node_77*1.538462+-0.1538462)).b) ));
    113.                 float3 normalLocal = lerp(lerp(UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_59, _NormalMap))).rgb,UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_60, _NormalMap))).rgb,node_65),UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_61, _NormalMap))).rgb,node_67);
    114.                 float3 normalDirection =  normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
    115.                 float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
    116.                 #ifndef LIGHTMAP_OFF
    117.                     float4 lmtex = tex2D(unity_Lightmap,i.uvLM);
    118.                     #ifndef DIRLIGHTMAP_OFF
    119.                         float3 lightmap = DecodeLightmap(lmtex);
    120.                         float3 scalePerBasisVector = DecodeLightmap(tex2D(unity_LightmapInd,i.uvLM));
    121.                         UNITY_DIRBASIS
    122.                         half3 normalInRnmBasis = saturate (mul (unity_DirBasis, normalLocal));
    123.                         lightmap *= dot (normalInRnmBasis, scalePerBasisVector);
    124.                     #else
    125.                         float3 lightmap = DecodeLightmap(lmtex);
    126.                     #endif
    127.                 #endif
    128.                 #ifndef LIGHTMAP_OFF
    129.                     #ifdef DIRLIGHTMAP_OFF
    130.                         float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    131.                     #else
    132.                         float3 lightDirection = normalize (scalePerBasisVector.x * unity_DirBasis[0] + scalePerBasisVector.y * unity_DirBasis[1] + scalePerBasisVector.z * unity_DirBasis[2]);
    133.                         lightDirection = mul(lightDirection,tangentTransform); // Tangent to world
    134.                     #endif
    135.                 #else
    136.                     float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    137.                 #endif
    138.                 float3 halfDirection = normalize(viewDirection+lightDirection);
    139. ////// Lighting:
    140.                 float attenuation = LIGHT_ATTENUATION(i)*2;
    141.                 float3 attenColor = attenuation * _LightColor0.xyz;
    142.                 float Pi = 3.141592654;
    143.                 float InvPi = 0.31830988618;
    144. /////// Diffuse:
    145.                 float NdotL = dot( normalDirection, lightDirection );
    146.                 #ifndef LIGHTMAP_OFF
    147.                     float3 diffuse = lightmap.rgb;
    148.                 #else
    149.                     float3 diffuse = max( 0.0, NdotL)*InvPi * attenColor;
    150.                 #endif
    151. ////// Emissive:
    152.                 float3 node_16 = (texCUBE(_Cubemap,viewReflectDirection).rgb*_CubemapColor.rgb);
    153.                 float3 emissive = (_CubeMapEmision*node_16);
    154. ///////// Gloss:
    155.                 float node_3 = 0.0;
    156.                 float gloss = (_GlossMin + ( (dot(lerp(lerp(tex2D(_GlossMap,TRANSFORM_TEX(node_59, _GlossMap)).rgb,tex2D(_GlossMap,TRANSFORM_TEX(node_60, _GlossMap)).rgb,node_65),tex2D(_GlossMap,TRANSFORM_TEX(node_61, _GlossMap)).rgb,node_67),float3(0.3,0.59,0.11)) - node_3) * (_GlossMax - _GlossMin) ) / (1.0 - node_3));
    157.                 float specPow = exp2( gloss * 10.0+1.0);
    158. ////// Specular:
    159.                 NdotL = max(0.0, NdotL);
    160.                 float3 specularColor = _Specularcolor.rgb;
    161.                 float specularMonochrome = dot(specularColor,float3(0.3,0.59,0.11));
    162.                 float HdotL = max(0.0,dot(halfDirection,lightDirection));
    163.                 float3 fresnelTerm = specularColor + ( 1.0 - specularColor ) * pow((1.0 - HdotL),5);
    164.                 float NdotV = max(0.0,dot( normalDirection, viewDirection ));
    165.                 float3 fresnelTermAmb = specularColor + ( 1.0 - specularColor ) * ( pow((1.0 - NdotV),5) / (4-3*gloss) );
    166.                 float alpha = 1.0 / ( sqrt( (Pi/4.0) * specPow + Pi/2.0 ) );
    167.                 float visTerm = ( NdotL * ( 1.0 - alpha ) + alpha ) * ( NdotV * ( 1.0 - alpha ) + alpha );
    168.                 visTerm = 1.0 / visTerm;
    169.                 float normTerm = (specPow + 8.0 ) / (8.0 * Pi);
    170.                 float3 specularAmb = (_SpecularAmbientIntensity*node_16) * fresnelTermAmb;
    171.                 float3 specular = 1*NdotL * pow(max(0,dot(halfDirection,normalDirection)),specPow)*fresnelTerm*visTerm*normTerm + specularAmb;
    172.                 #ifndef LIGHTMAP_OFF
    173.                     #ifndef DIRLIGHTMAP_OFF
    174.                         specular *= lightmap;
    175.                     #else
    176.                         specular *= (floor(attenuation) * _LightColor0.xyz);
    177.                     #endif
    178.                 #else
    179.                     specular *= (floor(attenuation) * _LightColor0.xyz);
    180.                 #endif
    181.                 float3 finalColor = 0;
    182.                 float3 diffuseLight = diffuse;
    183.                 diffuseLight += (_DifuseAmbientIntensity*node_16); // Diffuse Ambient Light
    184.                 #ifdef LIGHTMAP_OFF
    185.                     diffuseLight += i.shLight; // Per-Vertex Light Probes / Spherical harmonics
    186.                 #endif
    187.                 diffuseLight *= 1-specularMonochrome;
    188.                 finalColor += diffuseLight * (_DifuseColor.rgb*lerp(lerp(tex2D(_DifuseMap,TRANSFORM_TEX(node_59, _DifuseMap)).rgb,node_34.rgb,node_65),node_37.rgb,node_67));
    189.                 finalColor += specular;
    190.                 finalColor += emissive;
    191. /// Final Color:
    192.                 return fixed4(finalColor,1);
    193.             }
    194.             ENDCG
    195.         }
    196.         Pass {
    197.             Name "ForwardAdd"
    198.             Tags {
    199.                 "LightMode"="ForwardAdd"
    200.             }
    201.             Blend One One
    202.          
    203.          
    204.             Fog { Color (0,0,0,0) }
    205.             CGPROGRAM
    206.             #pragma vertex vert
    207.             #pragma fragment frag
    208.             #define UNITY_PASS_FORWARDADD
    209.             #include "UnityCG.cginc"
    210.             #include "AutoLight.cginc"
    211.             #include "Lighting.cginc"
    212.             #pragma multi_compile_fwdadd_fullshadows
    213.             #pragma exclude_renderers d3d11 opengl gles xbox360 ps3 flash d3d11_9x
    214.             #pragma target 3.0
    215.             #ifndef LIGHTMAP_OFF
    216.                 float4 unity_LightmapST;
    217.                 sampler2D unity_Lightmap;
    218.                 #ifndef DIRLIGHTMAP_OFF
    219.                     sampler2D unity_LightmapInd;
    220.                 #endif
    221.             #endif
    222.             uniform float _GlossMin;
    223.             uniform float _GlossMax;
    224.             uniform float4 _Specularcolor;
    225.             uniform samplerCUBE _Cubemap;
    226.             uniform float4 _CubemapColor;
    227.             uniform float _CubeMapEmision;
    228.             uniform sampler2D _DifuseMap; uniform float4 _DifuseMap_ST;
    229.             uniform sampler2D _GlossMap; uniform float4 _GlossMap_ST;
    230.             uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST;
    231.             uniform float4 _DifuseColor;
    232.             struct VertexInput {
    233.                 float4 vertex : POSITION;
    234.                 float3 normal : NORMAL;
    235.                 float4 tangent : TANGENT;
    236.                 float2 texcoord1 : TEXCOORD1;
    237.             };
    238.             struct VertexOutput {
    239.                 float4 pos : SV_POSITION;
    240.                 float4 posWorld : TEXCOORD0;
    241.                 float3 normalDir : TEXCOORD1;
    242.                 float3 tangentDir : TEXCOORD2;
    243.                 float3 binormalDir : TEXCOORD3;
    244.                 LIGHTING_COORDS(4,5)
    245.             };
    246.             VertexOutput vert (VertexInput v) {
    247.                 VertexOutput o;
    248.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    249.                 o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    250.                 o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    251.                 o.posWorld = mul(_Object2World, v.vertex);
    252.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    253.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    254.                 return o;
    255.             }
    256.             fixed4 frag(VertexOutput i) : COLOR {
    257.                 i.normalDir = normalize(i.normalDir);
    258.                 float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    259.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    260. /////// Normals:
    261.                 float4 node_62 = i.posWorld;
    262.                 float2 node_59 = float2(node_62.g,node_62.b);
    263.                 float2 node_60 = float2(node_62.r,node_62.b);
    264.                 float3 node_77 = abs(i.normalDir);
    265.                 float4 node_34 = tex2D(_DifuseMap,TRANSFORM_TEX(node_60, _DifuseMap));
    266.                 float3 node_65 = saturate(( saturate((node_77*2.222222+-0.4444445)).g > 0.5 ? (node_34.rgb/((1.0-saturate((node_77*2.222222+-0.4444445)).g)*2.0)) : (1.0-(((1.0-node_34.rgb)*0.5)/saturate((node_77*2.222222+-0.4444445)).g))));
    267.                 float2 node_61 = float2(node_62.r,node_62.g);
    268.                 float4 node_37 = tex2D(_DifuseMap,TRANSFORM_TEX(node_61, _DifuseMap));
    269.                 float3 node_67 = saturate(( node_37.rgb > 0.5 ? (1.0-(1.0-2.0*(node_37.rgb-0.5))*(1.0-saturate((node_77*1.538462+-0.1538462)).b)) : (2.0*node_37.rgb*saturate((node_77*1.538462+-0.1538462)).b) ));
    270.                 float3 normalLocal = lerp(lerp(UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_59, _NormalMap))).rgb,UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_60, _NormalMap))).rgb,node_65),UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(node_61, _NormalMap))).rgb,node_67);
    271.                 float3 normalDirection =  normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
    272.                 float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
    273.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    274.                 float3 halfDirection = normalize(viewDirection+lightDirection);
    275. ////// Lighting:
    276.                 float attenuation = LIGHT_ATTENUATION(i)*2;
    277.                 float3 attenColor = attenuation * _LightColor0.xyz;
    278.                 float Pi = 3.141592654;
    279.                 float InvPi = 0.31830988618;
    280. /////// Diffuse:
    281.                 float NdotL = dot( normalDirection, lightDirection );
    282.                 float3 diffuse = max( 0.0, NdotL)*InvPi * attenColor;
    283. ///////// Gloss:
    284.                 float node_3 = 0.0;
    285.                 float gloss = (_GlossMin + ( (dot(lerp(lerp(tex2D(_GlossMap,TRANSFORM_TEX(node_59, _GlossMap)).rgb,tex2D(_GlossMap,TRANSFORM_TEX(node_60, _GlossMap)).rgb,node_65),tex2D(_GlossMap,TRANSFORM_TEX(node_61, _GlossMap)).rgb,node_67),float3(0.3,0.59,0.11)) - node_3) * (_GlossMax - _GlossMin) ) / (1.0 - node_3));
    286.                 float specPow = exp2( gloss * 10.0+1.0);
    287. ////// Specular:
    288.                 NdotL = max(0.0, NdotL);
    289.                 float3 specularColor = _Specularcolor.rgb;
    290.                 float specularMonochrome = dot(specularColor,float3(0.3,0.59,0.11));
    291.                 float HdotL = max(0.0,dot(halfDirection,lightDirection));
    292.                 float3 fresnelTerm = specularColor + ( 1.0 - specularColor ) * pow((1.0 - HdotL),5);
    293.                 float NdotV = max(0.0,dot( normalDirection, viewDirection ));
    294.                 float alpha = 1.0 / ( sqrt( (Pi/4.0) * specPow + Pi/2.0 ) );
    295.                 float visTerm = ( NdotL * ( 1.0 - alpha ) + alpha ) * ( NdotV * ( 1.0 - alpha ) + alpha );
    296.                 visTerm = 1.0 / visTerm;
    297.                 float normTerm = (specPow + 8.0 ) / (8.0 * Pi);
    298.                 float3 specular = attenColor*NdotL * pow(max(0,dot(halfDirection,normalDirection)),specPow)*fresnelTerm*visTerm*normTerm;
    299.                 float3 finalColor = 0;
    300.                 float3 diffuseLight = diffuse;
    301.                 diffuseLight *= 1-specularMonochrome;
    302.                 finalColor += diffuseLight * (_DifuseColor.rgb*lerp(lerp(tex2D(_DifuseMap,TRANSFORM_TEX(node_59, _DifuseMap)).rgb,node_34.rgb,node_65),node_37.rgb,node_67));
    303.                 finalColor += specular;
    304. /// Final Color:
    305.                 return fixed4(finalColor * 1,0);
    306.             }
    307.             ENDCG
    308.         }
    309.     }
    310.     FallBack "Diffuse"
    311.     CustomEditor "ShaderForgeMaterialInspector"
    312. }
    313.  
    ( Above Its a Phisical Based SPecular Triplanar SHader ... I made This ACtually myself ... After SOme Online Tuttorials : )

    Is Quite Complicated actually, comparing to some More Easy Triplanar Methods As for example Bellow ...
    But Welds Better Smooter Triplanar Results .. And it will even become more dificult In a Phisical Based Mode with So many maps .... : )

    Anyway Here a Easier Less intensive Triplanar Code one ...

    Code (CSharp):
    1.  
    2.  
    3. // Shader created with Shader Forge Beta 0.36
    4. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    6. /*SF_DATA;ver:0.36;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:3,uamb:True,mssp:True,lmpd:True,lprd:True,enco:False,frtr:True,vitr:True,dbil:True,rmgx:True,rpth:0,hqsc:True,hqlp:True,tesm:0,blpr:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:True,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.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:32719,y:32712|diff-2-OUT;n:type:ShaderForge.SFN_ChannelBlend,id:2,x:33017,y:32695,chbt:0|M-3-OUT,R-6-RGB,G-7-RGB,B-8-RGB;n:type:ShaderForge.SFN_Multiply,id:3,x:33290,y:32576|A-4-OUT,B-4-OUT;n:type:ShaderForge.SFN_Abs,id:4,x:33493,y:32548|IN-5-OUT;n:type:ShaderForge.SFN_NormalVector,id:5,x:33659,y:32559,pt:True;n:type:ShaderForge.SFN_Tex2d,id:6,x:33293,y:32736,ptlb:R Text,ptin:_RText,ntxv:0,isnm:False|UVIN-11-OUT;n:type:ShaderForge.SFN_Tex2d,id:7,x:33278,y:32945,ptlb:G Text,ptin:_GText,ntxv:0,isnm:False|UVIN-12-OUT;n:type:ShaderForge.SFN_Tex2d,id:8,x:33269,y:33170,ptlb:B text,ptin:_Btext,ntxv:0,isnm:False|UVIN-13-OUT;n:type:ShaderForge.SFN_FragmentPosition,id:10,x:33694,y:32833;n:type:ShaderForge.SFN_Append,id:11,x:33512,y:32749|A-10-Y,B-10-Z;n:type:ShaderForge.SFN_Append,id:12,x:33512,y:32935|A-10-Z,B-10-X;n:type:ShaderForge.SFN_Append,id:13,x:33484,y:33137|A-10-X,B-10-Y;proporder:6-7-8;pass:END;sub:END;*/
    7.  
    8. Shader "3DLABS/SimpleTriplanar" {
    9.   Properties {
    10.   _RText ("R Text", 2D) = "white" {}
    11.   _GText ("G Text", 2D) = "white" {}
    12.   _Btext ("B text", 2D) = "white" {}
    13.   }
    14.   SubShader {
    15.   Tags {
    16.   "RenderType"="Opaque"
    17.   }
    18.   LOD 200
    19.   Pass {
    20.   Name "ForwardBase"
    21.   Tags {
    22.   "LightMode"="ForwardBase"
    23.   }
    24.  
    25.  
    26.   CGPROGRAM
    27.   #pragma vertex vert
    28.   #pragma fragment frag
    29.   #define UNITY_PASS_FORWARDBASE
    30.   #include "UnityCG.cginc"
    31.   #include "AutoLight.cginc"
    32.   #include "Lighting.cginc"
    33.   #pragma multi_compile_fwdbase_fullshadows
    34.   #pragma exclude_renderers d3d11 opengl gles xbox360 ps3 flash d3d11_9x
    35.   #pragma target 3.0
    36.   #ifndef LIGHTMAP_OFF
    37.   float4 unity_LightmapST;
    38.   sampler2D unity_Lightmap;
    39.   #ifndef DIRLIGHTMAP_OFF
    40.   sampler2D unity_LightmapInd;
    41.   #endif
    42.   #endif
    43.   uniform sampler2D _RText; uniform float4 _RText_ST;
    44.   uniform sampler2D _GText; uniform float4 _GText_ST;
    45.   uniform sampler2D _Btext; uniform float4 _Btext_ST;
    46.   struct VertexInput {
    47.   float4 vertex : POSITION;
    48.   float3 normal : NORMAL;
    49.   float4 tangent : TANGENT;
    50.   float2 texcoord1 : TEXCOORD1;
    51.   };
    52.   struct VertexOutput {
    53.   float4 pos : SV_POSITION;
    54.   float4 posWorld : TEXCOORD0;
    55.   float3 normalDir : TEXCOORD1;
    56.   float3 tangentDir : TEXCOORD2;
    57.   float3 binormalDir : TEXCOORD3;
    58.   LIGHTING_COORDS(4,5)
    59.   #ifndef LIGHTMAP_OFF
    60.   float2 uvLM : TEXCOORD6;
    61.   #endif
    62.   };
    63.   VertexOutput vert (VertexInput v) {
    64.   VertexOutput o;
    65.   o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    66.   o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    67.   o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    68.   o.posWorld = mul(_Object2World, v.vertex);
    69.   o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    70.   #ifndef LIGHTMAP_OFF
    71.   o.uvLM = v.texcoord1 * unity_LightmapST.xy + unity_LightmapST.zw;
    72.   #endif
    73.   TRANSFER_VERTEX_TO_FRAGMENT(o)
    74.   return o;
    75.   }
    76.   fixed4 frag(VertexOutput i) : COLOR {
    77.   i.normalDir = normalize(i.normalDir);
    78.   float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    79. /////// Normals:
    80.   float3 normalDirection =  i.normalDir;
    81.   #ifndef LIGHTMAP_OFF
    82.   float4 lmtex = tex2D(unity_Lightmap,i.uvLM);
    83.   #ifndef DIRLIGHTMAP_OFF
    84.   float3 lightmap = DecodeLightmap(lmtex);
    85.   float3 scalePerBasisVector = DecodeLightmap(tex2D(unity_LightmapInd,i.uvLM));
    86.   UNITY_DIRBASIS
    87.   half3 normalInRnmBasis = saturate (mul (unity_DirBasis, float3(0,0,1)));
    88.   lightmap *= dot (normalInRnmBasis, scalePerBasisVector);
    89.   #else
    90.   float3 lightmap = DecodeLightmap(lmtex);
    91.   #endif
    92.   #endif
    93.   #ifndef LIGHTMAP_OFF
    94.   #ifdef DIRLIGHTMAP_OFF
    95.   float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    96.   #else
    97.   float3 lightDirection = normalize (scalePerBasisVector.x * unity_DirBasis[0] + scalePerBasisVector.y * unity_DirBasis[1] + scalePerBasisVector.z * unity_DirBasis[2]);
    98.   lightDirection = mul(lightDirection,tangentTransform); // Tangent to world
    99.   #endif
    100.   #else
    101.   float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    102.   #endif
    103. ////// Lighting:
    104.   float attenuation = LIGHT_ATTENUATION(i)*2;
    105.   float3 attenColor = attenuation * _LightColor0.xyz;
    106.   float Pi = 3.141592654;
    107.   float InvPi = 0.31830988618;
    108. /////// Diffuse:
    109.   float NdotL = dot( normalDirection, lightDirection );
    110.   #ifndef LIGHTMAP_OFF
    111.   float3 diffuse = lightmap.rgb;
    112.   #else
    113.   float3 diffuse = max( 0.0, NdotL)*InvPi * attenColor;
    114.   #endif
    115.   float3 finalColor = 0;
    116.   float3 diffuseLight = diffuse;
    117.   #ifdef LIGHTMAP_OFF
    118.   diffuseLight += ShadeSH9(float4(normalDirection,1));
    119.   #endif
    120.   float3 node_4 = abs(normalDirection);
    121.   float3 node_3 = (node_4*node_4);
    122.   float4 node_10 = i.posWorld;
    123.   float2 node_11 = float2(node_10.g,node_10.b);
    124.   float2 node_12 = float2(node_10.b,node_10.r);
    125.   float2 node_13 = float2(node_10.r,node_10.g);
    126.   finalColor += diffuseLight * (node_3.r*tex2D(_RText,TRANSFORM_TEX(node_11, _RText)).rgb + node_3.g*tex2D(_GText,TRANSFORM_TEX(node_12, _GText)).rgb + node_3.b*tex2D(_Btext,TRANSFORM_TEX(node_13, _Btext)).rgb);
    127. /// Final Color:
    128.   return fixed4(finalColor,1);
    129.   }
    130.   ENDCG
    131.   }
    132.   Pass {
    133.   Name "ForwardAdd"
    134.   Tags {
    135.   "LightMode"="ForwardAdd"
    136.   }
    137.   Blend One One
    138.  
    139.  
    140.   Fog { Color (0,0,0,0) }
    141.   CGPROGRAM
    142.   #pragma vertex vert
    143.   #pragma fragment frag
    144.   #define UNITY_PASS_FORWARDADD
    145.   #include "UnityCG.cginc"
    146.   #include "AutoLight.cginc"
    147.   #include "Lighting.cginc"
    148.   #pragma multi_compile_fwdadd_fullshadows
    149.   #pragma exclude_renderers d3d11 opengl gles xbox360 ps3 flash d3d11_9x
    150.   #pragma target 3.0
    151.   #ifndef LIGHTMAP_OFF
    152.   float4 unity_LightmapST;
    153.   sampler2D unity_Lightmap;
    154.   #ifndef DIRLIGHTMAP_OFF
    155.   sampler2D unity_LightmapInd;
    156.   #endif
    157.   #endif
    158.   uniform sampler2D _RText; uniform float4 _RText_ST;
    159.   uniform sampler2D _GText; uniform float4 _GText_ST;
    160.   uniform sampler2D _Btext; uniform float4 _Btext_ST;
    161.   struct VertexInput {
    162.   float4 vertex : POSITION;
    163.   float3 normal : NORMAL;
    164.   float4 tangent : TANGENT;
    165.   float2 texcoord1 : TEXCOORD1;
    166.   };
    167.   struct VertexOutput {
    168.   float4 pos : SV_POSITION;
    169.   float4 posWorld : TEXCOORD0;
    170.   float3 normalDir : TEXCOORD1;
    171.   float3 tangentDir : TEXCOORD2;
    172.   float3 binormalDir : TEXCOORD3;
    173.   LIGHTING_COORDS(4,5)
    174.   };
    175.   VertexOutput vert (VertexInput v) {
    176.   VertexOutput o;
    177.   o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    178.   o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    179.   o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    180.   o.posWorld = mul(_Object2World, v.vertex);
    181.   o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    182.   TRANSFER_VERTEX_TO_FRAGMENT(o)
    183.   return o;
    184.   }
    185.   fixed4 frag(VertexOutput i) : COLOR {
    186.   i.normalDir = normalize(i.normalDir);
    187.   float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    188. /////// Normals:
    189.   float3 normalDirection =  i.normalDir;
    190.   float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    191. ////// Lighting:
    192.   float attenuation = LIGHT_ATTENUATION(i)*2;
    193.   float3 attenColor = attenuation * _LightColor0.xyz;
    194.   float Pi = 3.141592654;
    195.   float InvPi = 0.31830988618;
    196. /////// Diffuse:
    197.   float NdotL = dot( normalDirection, lightDirection );
    198.   float3 diffuse = max( 0.0, NdotL)*InvPi * attenColor;
    199.   float3 finalColor = 0;
    200.   float3 diffuseLight = diffuse;
    201.   float3 node_4 = abs(normalDirection);
    202.   float3 node_3 = (node_4*node_4);
    203.   float4 node_10 = i.posWorld;
    204.   float2 node_11 = float2(node_10.g,node_10.b);
    205.   float2 node_12 = float2(node_10.b,node_10.r);
    206.   float2 node_13 = float2(node_10.r,node_10.g);
    207.   finalColor += diffuseLight * (node_3.r*tex2D(_RText,TRANSFORM_TEX(node_11, _RText)).rgb + node_3.g*tex2D(_GText,TRANSFORM_TEX(node_12, _GText)).rgb + node_3.b*tex2D(_Btext,TRANSFORM_TEX(node_13, _Btext)).rgb);
    208. /// Final Color:
    209.   return fixed4(finalColor * 1,0);
    210.   }
    211.   ENDCG
    212.   }
    213.   }
    214.   FallBack "Diffuse"
    215.   CustomEditor "ShaderForgeMaterialInspector"
    216. }
    217.  
    218.  
    TOP MATERIAL BY NORMALS BLEND - Cool for Moss & Snow Efects ...

    Code (CSharp):
    1. // Shader created with Shader Forge Beta 0.34
    2. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:0.34;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:1,uamb:True,mssp:True,lmpd:False,lprd:False,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,blpr:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:True,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.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:32628,y:32722|diff-4-OUT;n:type:ShaderForge.SFN_Tex2d,id:2,x:33687,y:32455,ptlb:Mat A,ptin:_MatA,tex:428d95604a13bee44819f9d4e9ccb58a,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Lerp,id:4,x:32877,y:32722|A-2-RGB,B-5-RGB,T-39-OUT;n:type:ShaderForge.SFN_Tex2d,id:5,x:33677,y:33125,ptlb:Mat B,ptin:_MatB,tex:061e7400320f76f438bf8934565fcef4,ntxv:0,isnm:False;n:type:ShaderForge.SFN_RemapRange,id:15,x:33401,y:32585,frmn:0,frmx:1,tomn:-8,tomx:9|IN-52-OUT;n:type:ShaderForge.SFN_Slider,id:17,x:33677,y:33026,ptlb:Mask Blend,ptin:_MaskBlend,min:0,cur:0.9849624,max:1;n:type:ShaderForge.SFN_Clamp01,id:32,x:33228,y:32585|IN-15-OUT;n:type:ShaderForge.SFN_Desaturate,id:39,x:33054,y:32585|COL-32-OUT,DES-41-OUT;n:type:ShaderForge.SFN_Vector1,id:41,x:33054,y:32523,v1:1;n:type:ShaderForge.SFN_Lerp,id:50,x:33401,y:32764|A-113-OUT,B-72-OUT,T-51-OUT;n:type:ShaderForge.SFN_Vector1,id:51,x:33687,y:32899,v1:0.5;n:type:ShaderForge.SFN_Blend,id:52,x:33207,y:32764,blmd:10,clmp:True|SRC-50-OUT,DST-17-OUT;n:type:ShaderForge.SFN_OneMinus,id:60,x:33687,y:32631|IN-2-RGB;n:type:ShaderForge.SFN_NormalVector,id:68,x:34093,y:32841,pt:False;n:type:ShaderForge.SFN_ComponentMask,id:72,x:33917,y:32841,cc1:1,cc2:-1,cc3:-1,cc4:-1|IN-68-OUT;n:type:ShaderForge.SFN_Blend,id:113,x:33196,y:33102,blmd:10,clmp:True|SRC-60-OUT,DST-135-OUT;n:type:ShaderForge.SFN_Slider,id:134,x:33677,y:33319,ptlb:Blend Sharpness,ptin:_BlendSharpness,min:1,cur:0,max:0;n:type:ShaderForge.SFN_Lerp,id:135,x:33403,y:33119|A-5-RGB,B-138-OUT,T-134-OUT;n:type:ShaderForge.SFN_Vector1,id:138,x:33403,y:33259,v1:0.5;proporder:2-5-17-134;pass:END;sub:END;*/
    5.  
    6. Shader "3DLABS/ Top Mat Normals Blend " {
    7.     Properties {
    8.         _MatA ("Mat A", 2D) = "white" {}
    9.         _MatB ("Mat B", 2D) = "white" {}
    10.         _MaskBlend ("Mask Blend", Range(0, 1)) = 0.9849624
    11.         _BlendSharpness ("Blend Sharpness", Range(1, 0)) = 0
    12.     }
    13.     SubShader {
    14.         Tags {
    15.             "RenderType"="Opaque"
    16.         }
    17.         Pass {
    18.             Name "ForwardBase"
    19.             Tags {
    20.                 "LightMode"="ForwardBase"
    21.             }
    22.          
    23.          
    24.             CGPROGRAM
    25.             #pragma vertex vert
    26.             #pragma fragment frag
    27.             #define UNITY_PASS_FORWARDBASE
    28.             #include "UnityCG.cginc"
    29.             #include "AutoLight.cginc"
    30.             #pragma multi_compile_fwdbase_fullshadows
    31.             #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
    32.             #pragma target 3.0
    33.             uniform float4 _LightColor0;
    34.             uniform sampler2D _MatA; uniform float4 _MatA_ST;
    35.             uniform sampler2D _MatB; uniform float4 _MatB_ST;
    36.             uniform float _MaskBlend;
    37.             uniform float _BlendSharpness;
    38.             struct VertexInput {
    39.                 float4 vertex : POSITION;
    40.                 float3 normal : NORMAL;
    41.                 float2 texcoord0 : TEXCOORD0;
    42.             };
    43.             struct VertexOutput {
    44.                 float4 pos : SV_POSITION;
    45.                 float2 uv0 : TEXCOORD0;
    46.                 float4 posWorld : TEXCOORD1;
    47.                 float3 normalDir : TEXCOORD2;
    48.                 LIGHTING_COORDS(3,4)
    49.             };
    50.             VertexOutput vert (VertexInput v) {
    51.                 VertexOutput o;
    52.                 o.uv0 = v.texcoord0;
    53.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    54.                 o.posWorld = mul(_Object2World, v.vertex);
    55.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    56.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    57.                 return o;
    58.             }
    59.             fixed4 frag(VertexOutput i) : COLOR {
    60.                 i.normalDir = normalize(i.normalDir);
    61. /////// Normals:
    62.                 float3 normalDirection =  i.normalDir;
    63.                 float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    64. ////// Lighting:
    65.                 float attenuation = LIGHT_ATTENUATION(i);
    66.                 float3 attenColor = attenuation * _LightColor0.xyz;
    67. /////// Diffuse:
    68.                 float NdotL = dot( normalDirection, lightDirection );
    69.                 float3 diffuse = max( 0.0, NdotL) * attenColor + UNITY_LIGHTMODEL_AMBIENT.rgb;
    70.                 float3 finalColor = 0;
    71.                 float3 diffuseLight = diffuse;
    72.                 float2 node_153 = i.uv0;
    73.                 float4 node_2 = tex2D(_MatA,TRANSFORM_TEX(node_153.rg, _MatA));
    74.                 float4 node_5 = tex2D(_MatB,TRANSFORM_TEX(node_153.rg, _MatB));
    75.                 float node_138 = 0.5;
    76.                 float node_72 = i.normalDir.g;
    77.                 finalColor += diffuseLight * lerp(node_2.rgb,node_5.rgb,lerp(saturate((saturate(( _MaskBlend > 0.5 ? (1.0-(1.0-2.0*(_MaskBlend-0.5))*(1.0-lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5))) : (2.0*_MaskBlend*lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5)) ))*17.0+-8.0)),dot(saturate((saturate(( _MaskBlend > 0.5 ? (1.0-(1.0-2.0*(_MaskBlend-0.5))*(1.0-lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5))) : (2.0*_MaskBlend*lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5)) ))*17.0+-8.0)),float3(0.3,0.59,0.11)),1.0));
    78. /// Final Color:
    79.                 return fixed4(finalColor,1);
    80.             }
    81.             ENDCG
    82.         }
    83.         Pass {
    84.             Name "ForwardAdd"
    85.             Tags {
    86.                 "LightMode"="ForwardAdd"
    87.             }
    88.             Blend One One
    89.          
    90.          
    91.             Fog { Color (0,0,0,0) }
    92.             CGPROGRAM
    93.             #pragma vertex vert
    94.             #pragma fragment frag
    95.             #define UNITY_PASS_FORWARDADD
    96.             #include "UnityCG.cginc"
    97.             #include "AutoLight.cginc"
    98.             #pragma multi_compile_fwdadd_fullshadows
    99.             #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
    100.             #pragma target 3.0
    101.             uniform float4 _LightColor0;
    102.             uniform sampler2D _MatA; uniform float4 _MatA_ST;
    103.             uniform sampler2D _MatB; uniform float4 _MatB_ST;
    104.             uniform float _MaskBlend;
    105.             uniform float _BlendSharpness;
    106.             struct VertexInput {
    107.                 float4 vertex : POSITION;
    108.                 float3 normal : NORMAL;
    109.                 float2 texcoord0 : TEXCOORD0;
    110.             };
    111.             struct VertexOutput {
    112.                 float4 pos : SV_POSITION;
    113.                 float2 uv0 : TEXCOORD0;
    114.                 float4 posWorld : TEXCOORD1;
    115.                 float3 normalDir : TEXCOORD2;
    116.                 LIGHTING_COORDS(3,4)
    117.             };
    118.             VertexOutput vert (VertexInput v) {
    119.                 VertexOutput o;
    120.                 o.uv0 = v.texcoord0;
    121.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    122.                 o.posWorld = mul(_Object2World, v.vertex);
    123.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    124.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    125.                 return o;
    126.             }
    127.             fixed4 frag(VertexOutput i) : COLOR {
    128.                 i.normalDir = normalize(i.normalDir);
    129. /////// Normals:
    130.                 float3 normalDirection =  i.normalDir;
    131.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    132. ////// Lighting:
    133.                 float attenuation = LIGHT_ATTENUATION(i);
    134.                 float3 attenColor = attenuation * _LightColor0.xyz;
    135. /////// Diffuse:
    136.                 float NdotL = dot( normalDirection, lightDirection );
    137.                 float3 diffuse = max( 0.0, NdotL) * attenColor;
    138.                 float3 finalColor = 0;
    139.                 float3 diffuseLight = diffuse;
    140.                 float2 node_154 = i.uv0;
    141.                 float4 node_2 = tex2D(_MatA,TRANSFORM_TEX(node_154.rg, _MatA));
    142.                 float4 node_5 = tex2D(_MatB,TRANSFORM_TEX(node_154.rg, _MatB));
    143.                 float node_138 = 0.5;
    144.                 float node_72 = i.normalDir.g;
    145.                 finalColor += diffuseLight * lerp(node_2.rgb,node_5.rgb,lerp(saturate((saturate(( _MaskBlend > 0.5 ? (1.0-(1.0-2.0*(_MaskBlend-0.5))*(1.0-lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5))) : (2.0*_MaskBlend*lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5)) ))*17.0+-8.0)),dot(saturate((saturate(( _MaskBlend > 0.5 ? (1.0-(1.0-2.0*(_MaskBlend-0.5))*(1.0-lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5))) : (2.0*_MaskBlend*lerp(saturate(( lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness) > 0.5 ? (1.0-(1.0-2.0*(lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)-0.5))*(1.0-(1.0 - node_2.rgb))) : (2.0*lerp(node_5.rgb,float3(node_138,node_138,node_138),_BlendSharpness)*(1.0 - node_2.rgb)) )),float3(node_72,node_72,node_72),0.5)) ))*17.0+-8.0)),float3(0.3,0.59,0.11)),1.0));
    146. /// Final Color:
    147.                 return fixed4(finalColor * 1,0);
    148.             }
    149.             ENDCG
    150.         }
    151.     }
    152.     FallBack "Diffuse"
    153.     CustomEditor "ShaderForgeMaterialInspector"
    154. }
    155.  
    And latest Adiction ...

    PARALAX RELIEF MAPPING ! ...
    ( No oclusion or Clipping ... ) But at Least is a more Proper Paralax Relief Mapping than Unity Default xD !
    Thanks to User Eideren for its Cool contribution At Our Request xD

    Code (CSharp):
    1. // Shader created with Shader Forge Beta 0.36
    2. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:0.36;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:0,uamb:True,mssp:True,lmpd:False,lprd:False,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,blpr:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:True,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.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:32221,y:32711|custl-14-RGB;n:type:ShaderForge.SFN_Code,id:2,x:32918,y:32930,code:IAB2AGkAZQB3AEQAaQByACAAPQAgAG4AbwByAG0AYQBsAGkAegBlACgAdgBpAGUAdwBEAGkAcgApADsACgAKACAAZgBsAG8AYQB0ADMAIABwACAAPQAgAGYAbABvAGEAdAAzACgAVQBWACwAIAAwACkAOwAKACAAZgBsAG8AYQB0ADMAIABuAGUAdwBWAGkAZQB3ACAAPQAgAG4AbwByAG0AYQBsAGkAegBlACgAdgBpAGUAdwBEAGkAcgAgACoAIAAtADEAKQA7AAoAIABuAGUAdwBWAGkAZQB3AC4AegAgACAAIAAgACAAIAA9ACAAYQBiAHMAKABuAGUAdwBWAGkAZQB3AC4AegApADsACgAKACAAZgBsAG8AYQB0ACAAZABlAHAAdABoAEIAaQBhAHMAIAA9ACAAMQAuADAAIAAtACAAbgBlAHcAVgBpAGUAdwAuAHoAOwAKACAAZABlAHAAdABoAEIAaQBhAHMAIAAqAD0AIABkAGUAcAB0AGgAQgBpAGEAcwA7AAoAIABkAGUAcAB0AGgAQgBpAGEAcwAgACoAPQAgAGQAZQBwAHQAaABCAGkAYQBzADsACgAgAGQAZQBwAHQAaABCAGkAYQBzACAAPQAgADEALgAwACAALQAgAGQAZQBwAHQAaABCAGkAYQBzACAAKgAgAGQAZQBwAHQAaABCAGkAYQBzADsACgAKACAAbgBlAHcAVgBpAGUAdwAuAHgAeQAgACoAPQAgAGQAZQBwAHQAaABCAGkAYQBzADsACgAgAG4AZQB3AFYAaQBlAHcALgB4AHkAIAAqAD0AIABEAGUAcAB0AGgAOwAKAAoAIABjAG8AbgBzAHQAIABpAG4AdAAgAGIAaQBuAGEAcgB5AFMAZQBhAHIAYwBoAFMAdABlAHAAcwAgAD0AIAAxADAAOwAKAAoAIABuAGUAdwBWAGkAZQB3ACAALwA9ACAAbgBlAHcAVgBpAGUAdwAuAHoAIAAqACAAbABpAG4AZQBhAHIAUwBlAGEAcgBjAGgAUwB0AGUAcABzADsACgAKACAALwAvAHAAcgBvAGQAdQBjAGUAcwAgAGQAZQBwAHQAaAAKACAAaQBuAHQAIABpADsACgAgAGYAbwByACgAIABpAD0AMAA7ACAAaQA8AGwAaQBuAGUAYQByAFMAZQBhAHIAYwBoAFMAdABlAHAAcwA7ACAAaQArACsAKQB7AAoAIAAgAGYAbABvAGEAdAAgAHQAZQB4ACAAPQAgAHQAZQB4ADIARAAoAEgAZQBpAGcAaAB0AE0AYQBwACwAIABwAC4AeAB5ACkALgByADsACgAgACAAaQBmACAAKABwAC4AegA8AHQAZQB4ACkAIABwACsAPQBuAGUAdwBWAGkAZQB3ADsACgAgAH0ACgAKACAAZgBvAHIAKAAgAGkAPQAwADsAIABpADwAYgBpAG4AYQByAHkAUwBlAGEAcgBjAGgAUwB0AGUAcABzADsAIABpACsAKwAgACkAewAKACAAIABuAGUAdwBWAGkAZQB3ACAAKgA9ACAAMAAuADUAOwAKACAAIABmAGwAbwBhAHQAIAB0AGUAeAAgAD0AIAB0AGUAeAAyAEQAKABIAGUAaQBnAGgAdABNAGEAcAAsACAAcAAuAHgAeQApAC4AcgA7AAoAIAAgAGkAZgAoAHAALgB6ACAAPAAgAHQAZQB4ACkAIABwACsAPQAgAG4AZQB3AFYAaQBlAHcAOwAKACAAIABlAGwAcwBlACAAcAAgAC0APQAgAG4AZQB3AFYAaQBlAHcAOwAKACAAfQAKACAAcgBlAHQAdQByAG4AIABwADsA,output:2,fname:Relief,width:573,height:510,input:2,input:12,input:0,input:0,input:1,input_1_label:viewDir,input_2_label:HeightMap,input_3_label:Depth,input_4_label:linearSearchSteps,input_5_label:UV|A-28-XYZ,B-5-TEX,C-6-OUT,D-8-OUT,E-12-UVOUT;n:type:ShaderForge.SFN_ViewVector,id:3,x:34072,y:32570;n:type:ShaderForge.SFN_Tex2dAsset,id:5,x:33916,y:32750,ptlb:HeightMap,ptin:_HeightMap,glob:False;n:type:ShaderForge.SFN_ValueProperty,id:6,x:33916,y:32928,ptlb:Depth,ptin:_Depth,glob:False,v1:1;n:type:ShaderForge.SFN_ValueProperty,id:8,x:33916,y:33006,ptlb:Quality,ptin:_Quality,glob:False,v1:60;n:type:ShaderForge.SFN_TexCoord,id:12,x:33916,y:33058,uv:0;n:type:ShaderForge.SFN_ComponentMask,id:13,x:32714,y:32923,cc1:0,cc2:1,cc3:-1,cc4:-1|IN-2-OUT;n:type:ShaderForge.SFN_Tex2d,id:14,x:32532,y:32923,ptlb:Texture,ptin:_Texture,ntxv:0,isnm:False|UVIN-13-OUT;n:type:ShaderForge.SFN_Transform,id:28,x:33916,y:32570,tffrom:0,tfto:2|IN-3-OUT;proporder:14-5-6-8;pass:END;sub:END;*/
    5.  
    6. Shader "3DLABS/ReliefParallax" {
    7.     Properties {
    8.         _Texture ("Texture", 2D) = "white" {}
    9.         _HeightMap ("HeightMap", 2D) = "white" {}
    10.         _Depth ("Depth", Float ) = 1
    11.         _Quality ("Quality", Float ) = 60
    12.     }
    13.     SubShader {
    14.         Tags {
    15.             "RenderType"="Opaque"
    16.         }
    17.         LOD 200
    18.         Pass {
    19.             Name "ForwardBase"
    20.             Tags {
    21.                 "LightMode"="ForwardBase"
    22.             }
    23.          
    24.          
    25.             CGPROGRAM
    26.             #pragma vertex vert
    27.             #pragma fragment frag
    28.             #define UNITY_PASS_FORWARDBASE
    29.             #include "UnityCG.cginc"
    30.             #pragma multi_compile_fwdbase_fullshadows
    31.             #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
    32.             #pragma target 3.0
    33.             float3 Relief( float3 viewDir , sampler2D HeightMap , float Depth , float linearSearchSteps , float2 UV ){
    34.              viewDir = normalize(viewDir);
    35.          
    36.              float3 p = float3(UV, 0);
    37.              float3 newView = normalize(viewDir * -1);
    38.              newView.z      = abs(newView.z);
    39.          
    40.              float depthBias = 1.0 - newView.z;
    41.              depthBias *= depthBias;
    42.              depthBias *= depthBias;
    43.              depthBias = 1.0 - depthBias * depthBias;
    44.          
    45.              newView.xy *= depthBias;
    46.              newView.xy *= Depth;
    47.          
    48.              const int binarySearchSteps = 10;
    49.          
    50.              newView /= newView.z * linearSearchSteps;
    51.          
    52.              //produces depth
    53.              int i;
    54.              for( i=0; i<linearSearchSteps; i++){
    55.               float tex = tex2D(HeightMap, p.xy).r;
    56.               if (p.z<tex) p+=newView;
    57.              }
    58.          
    59.              for( i=0; i<binarySearchSteps; i++ ){
    60.               newView *= 0.5;
    61.               float tex = tex2D(HeightMap, p.xy).r;
    62.               if(p.z < tex) p+= newView;
    63.               else p -= newView;
    64.              }
    65.              return p;
    66.             }
    67.          
    68.             uniform sampler2D _HeightMap; uniform float4 _HeightMap_ST;
    69.             uniform float _Depth;
    70.             uniform float _Quality;
    71.             uniform sampler2D _Texture; uniform float4 _Texture_ST;
    72.             struct VertexInput {
    73.                 float4 vertex : POSITION;
    74.                 float3 normal : NORMAL;
    75.                 float4 tangent : TANGENT;
    76.                 float2 texcoord0 : TEXCOORD0;
    77.             };
    78.             struct VertexOutput {
    79.                 float4 pos : SV_POSITION;
    80.                 float2 uv0 : TEXCOORD0;
    81.                 float4 posWorld : TEXCOORD1;
    82.                 float3 normalDir : TEXCOORD2;
    83.                 float3 tangentDir : TEXCOORD3;
    84.                 float3 binormalDir : TEXCOORD4;
    85.             };
    86.             VertexOutput vert (VertexInput v) {
    87.                 VertexOutput o;
    88.                 o.uv0 = v.texcoord0;
    89.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    90.                 o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    91.                 o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    92.                 o.posWorld = mul(_Object2World, v.vertex);
    93.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    94.                 return o;
    95.             }
    96.             fixed4 frag(VertexOutput i) : COLOR {
    97.                 i.normalDir = normalize(i.normalDir);
    98.                 float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    99.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    100. /////// Normals:
    101.                 float3 normalDirection =  i.normalDir;
    102. ////// Lighting:
    103.                 float2 node_13 = Relief( mul( tangentTransform, viewDirection ).xyz.rgb , _HeightMap , _Depth , _Quality , i.uv0.rg ).rg;
    104.                 float3 finalColor = tex2D(_Texture,TRANSFORM_TEX(node_13, _Texture)).rgb;
    105. /// Final Color:
    106.                 return fixed4(finalColor,1);
    107.             }
    108.             ENDCG
    109.         }
    110.     }
    111.     FallBack "Diffuse"
    112.     CustomEditor "ShaderForgeMaterialInspector"
    113. }
    114.  
    There is Also the Standart Unity Relief Method : For Less Expensive stuffs ...

    Code (CSharp):
    1. // Shader created with Shader Forge Beta 0.36
    2. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:0.34;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:1,uamb:True,mssp:True,lmpd:False,lprd:True,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,rpth:0,hqsc:True,hqlp:True,blpr:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:True,ufog:True,aust:False,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.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:0,x:32640,y:32624|diff-123-RGB,spec-46-OUT,gloss-42-OUT,normal-47-RGB;n:type:ShaderForge.SFN_Multiply,id:35,x:33552,y:32736|A-37-UVOUT,B-36-OUT;n:type:ShaderForge.SFN_Vector1,id:36,x:33749,y:32828,v1:8;n:type:ShaderForge.SFN_TexCoord,id:37,x:33749,y:32682,uv:0;n:type:ShaderForge.SFN_Vector1,id:42,x:32891,y:32729,v1:0.7;n:type:ShaderForge.SFN_Vector1,id:46,x:32891,y:32673,v1:0.8;n:type:ShaderForge.SFN_Tex2d,id:47,x:32891,y:32821,ptlb:Normal,ptin:_Normal,tex:cf20bfced7e912046a9ce991a4d775ec,ntxv:3,isnm:True|UVIN-110-UVOUT;n:type:ShaderForge.SFN_Parallax,id:110,x:33151,y:32714|UVIN-35-OUT,HEI-111-A,DEP-112-OUT;n:type:ShaderForge.SFN_Tex2d,id:111,x:33355,y:32608,tex:5fb7986dd6d0a8e4093ba82369dd6a4d,ntxv:0,isnm:False|UVIN-35-OUT,TEX-113-TEX;n:type:ShaderForge.SFN_Vector1,id:112,x:33355,y:32793,v1:0.15;n:type:ShaderForge.SFN_Tex2dAsset,id:113,x:33552,y:32571,ptlb:AO (RGB) Height (A),ptin:_AORGBHeightA,glob:False,tex:5fb7986dd6d0a8e4093ba82369dd6a4d;n:type:ShaderForge.SFN_Tex2d,id:123,x:32891,y:32544,tex:5fb7986dd6d0a8e4093ba82369dd6a4d,ntxv:0,isnm:False|UVIN-110-UVOUT,TEX-113-TEX;proporder:113-47;pass:END;sub:END;*/
    5.  
    6. Shader "3DLABS/Parallax" {
    7.     Properties {
    8.         _AORGBHeightA ("AO (RGB) Height (A)", 2D) = "white" {}
    9.         _Normal ("Normal", 2D) = "bump" {}
    10.     }
    11.     SubShader {
    12.         Tags {
    13.             "RenderType"="Opaque"
    14.         }
    15.         LOD 128
    16.         Pass {
    17.             Name "ForwardBase"
    18.             Tags {
    19.                 "LightMode"="ForwardBase"
    20.             }
    21.          
    22.          
    23.             CGPROGRAM
    24.             #pragma vertex vert
    25.             #pragma fragment frag
    26.             #define UNITY_PASS_FORWARDBASE
    27.             #include "UnityCG.cginc"
    28.             #include "AutoLight.cginc"
    29.             #pragma multi_compile_fwdbase_fullshadows
    30.             #pragma exclude_renderers gles xbox360 ps3 flash
    31.             #pragma target 3.0
    32.             uniform float4 _LightColor0;
    33.             uniform sampler2D _Normal; uniform float4 _Normal_ST;
    34.             uniform sampler2D _AORGBHeightA; uniform float4 _AORGBHeightA_ST;
    35.             struct VertexInput {
    36.                 float4 vertex : POSITION;
    37.                 float3 normal : NORMAL;
    38.                 float4 tangent : TANGENT;
    39.                 float2 texcoord0 : TEXCOORD0;
    40.             };
    41.             struct VertexOutput {
    42.                 float4 pos : SV_POSITION;
    43.                 float2 uv0 : TEXCOORD0;
    44.                 float4 posWorld : TEXCOORD1;
    45.                 float3 normalDir : TEXCOORD2;
    46.                 float3 tangentDir : TEXCOORD3;
    47.                 float3 binormalDir : TEXCOORD4;
    48.                 LIGHTING_COORDS(5,6)
    49.             };
    50.             VertexOutput vert (VertexInput v) {
    51.                 VertexOutput o;
    52.                 o.uv0 = v.texcoord0;
    53.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    54.                 o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    55.                 o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    56.                 o.posWorld = mul(_Object2World, v.vertex);
    57.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    58.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    59.                 return o;
    60.             }
    61.             fixed4 frag(VertexOutput i) : COLOR {
    62.                 i.normalDir = normalize(i.normalDir);
    63.                 float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    64.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    65. /////// Normals:
    66.                 float2 node_35 = (i.uv0.rg*8.0);
    67.                 float2 node_110 = (0.15*(tex2D(_AORGBHeightA,TRANSFORM_TEX(node_35, _AORGBHeightA)).a - 0.5)*mul(tangentTransform, viewDirection).xy + node_35);
    68.                 float3 normalLocal = UnpackNormal(tex2D(_Normal,TRANSFORM_TEX(node_110.rg, _Normal))).rgb;
    69.                 float3 normalDirection =  normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
    70.                 float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    71.                 float3 halfDirection = normalize(viewDirection+lightDirection);
    72. ////// Lighting:
    73.                 float attenuation = LIGHT_ATTENUATION(i);
    74.                 float3 attenColor = attenuation * _LightColor0.xyz;
    75. /////// Diffuse:
    76.                 float NdotL = dot( normalDirection, lightDirection );
    77.                 float3 diffuse = max( 0.0, NdotL) * attenColor;
    78. ///////// Gloss:
    79.                 float gloss = 0.7;
    80.                 float specPow = exp2( gloss * 10.0+1.0);
    81. ////// Specular:
    82.                 NdotL = max(0.0, NdotL);
    83.                 float node_46 = 0.8;
    84.                 float3 specularColor = float3(node_46,node_46,node_46);
    85.                 float3 specular = (floor(attenuation) * _LightColor0.xyz) * pow(max(0,dot(halfDirection,normalDirection)),specPow) * specularColor;
    86.                 float3 finalColor = 0;
    87.                 float3 diffuseLight = diffuse;
    88.                 diffuseLight += ShadeSH9(float4(normalDirection,1)) * 0.5; // Per-Pixel Light Probes / Spherical harmonics
    89.                 finalColor += diffuseLight * tex2D(_AORGBHeightA,TRANSFORM_TEX(node_110.rg, _AORGBHeightA)).rgb;
    90.                 finalColor += specular;
    91. /// Final Color:
    92.                 return fixed4(finalColor,1);
    93.             }
    94.             ENDCG
    95.         }
    96.         Pass {
    97.             Name "ForwardAdd"
    98.             Tags {
    99.                 "LightMode"="ForwardAdd"
    100.             }
    101.             Blend One One
    102.          
    103.          
    104.             Fog { Color (0,0,0,0) }
    105.             CGPROGRAM
    106.             #pragma vertex vert
    107.             #pragma fragment frag
    108.             #define UNITY_PASS_FORWARDADD
    109.             #include "UnityCG.cginc"
    110.             #include "AutoLight.cginc"
    111.             #pragma multi_compile_fwdadd_fullshadows
    112.             #pragma exclude_renderers gles xbox360 ps3 flash
    113.             #pragma target 3.0
    114.             uniform float4 _LightColor0;
    115.             uniform sampler2D _Normal; uniform float4 _Normal_ST;
    116.             uniform sampler2D _AORGBHeightA; uniform float4 _AORGBHeightA_ST;
    117.             struct VertexInput {
    118.                 float4 vertex : POSITION;
    119.                 float3 normal : NORMAL;
    120.                 float4 tangent : TANGENT;
    121.                 float2 texcoord0 : TEXCOORD0;
    122.             };
    123.             struct VertexOutput {
    124.                 float4 pos : SV_POSITION;
    125.                 float2 uv0 : TEXCOORD0;
    126.                 float4 posWorld : TEXCOORD1;
    127.                 float3 normalDir : TEXCOORD2;
    128.                 float3 tangentDir : TEXCOORD3;
    129.                 float3 binormalDir : TEXCOORD4;
    130.                 LIGHTING_COORDS(5,6)
    131.             };
    132.             VertexOutput vert (VertexInput v) {
    133.                 VertexOutput o;
    134.                 o.uv0 = v.texcoord0;
    135.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    136.                 o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz );
    137.                 o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
    138.                 o.posWorld = mul(_Object2World, v.vertex);
    139.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    140.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    141.                 return o;
    142.             }
    143.             fixed4 frag(VertexOutput i) : COLOR {
    144.                 i.normalDir = normalize(i.normalDir);
    145.                 float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir);
    146.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    147. /////// Normals:
    148.                 float2 node_35 = (i.uv0.rg*8.0);
    149.                 float2 node_110 = (0.15*(tex2D(_AORGBHeightA,TRANSFORM_TEX(node_35, _AORGBHeightA)).a - 0.5)*mul(tangentTransform, viewDirection).xy + node_35);
    150.                 float3 normalLocal = UnpackNormal(tex2D(_Normal,TRANSFORM_TEX(node_110.rg, _Normal))).rgb;
    151.                 float3 normalDirection =  normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
    152.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    153.                 float3 halfDirection = normalize(viewDirection+lightDirection);
    154. ////// Lighting:
    155.                 float attenuation = LIGHT_ATTENUATION(i);
    156.                 float3 attenColor = attenuation * _LightColor0.xyz;
    157. /////// Diffuse:
    158.                 float NdotL = dot( normalDirection, lightDirection );
    159.                 float3 diffuse = max( 0.0, NdotL) * attenColor;
    160. ///////// Gloss:
    161.                 float gloss = 0.7;
    162.                 float specPow = exp2( gloss * 10.0+1.0);
    163. ////// Specular:
    164.                 NdotL = max(0.0, NdotL);
    165.                 float node_46 = 0.8;
    166.                 float3 specularColor = float3(node_46,node_46,node_46);
    167.                 float3 specular = attenColor * pow(max(0,dot(halfDirection,normalDirection)),specPow) * specularColor;
    168.                 float3 finalColor = 0;
    169.                 float3 diffuseLight = diffuse;
    170.                 finalColor += diffuseLight * tex2D(_AORGBHeightA,TRANSFORM_TEX(node_110.rg, _AORGBHeightA)).rgb;
    171.                 finalColor += specular;
    172. /// Final Color:
    173.                 return fixed4(finalColor * 1,0);
    174.             }
    175.             ENDCG
    176.         }
    177.     }
    178.     FallBack "Diffuse"
    179.     CustomEditor "ShaderForgeMaterialInspector"
    180. }
    181.  
    My goal is to try to Convert all those 3 SHaders in 1 Ubber Antonov SHader !

    We are all Artists here .. but ... :p
    I will try to Mess with AnTonov Code And Try to Integrate Myself Those codes in Antonov
    Antonov Suit Metallic Dielectric.shader

    https://github.com/cCharkes/AntonovSuit/blob/master/Antonov Suit/Shaders/Antonov Suit Metallic Dielectric.shader

    I will try to Mess Up with this Includes. Cginc :rolleyes:

    #include "AntonovSuitInput.cginc"
    #include "AntonovSuitLib.cginc"
    #include "AntonovSuitBRDF.cginc"

    #include "AntonovSuitFrag.cginc"​

    But i Actually dont even know Were to Start ... :oops:
    Haha...
    Lol ..Can you Please Give me some Indications Were i Should STart to Put things Above in your SHader code ?

    I am the Responsable for Shaders in our Alpha Orion The game Team ...
    And i Seriously I dont know nothing ABout SHading language at all .. So i DO all SHaders in SHaderforge ...

    But i Guess if i Make Some Shaders nodes in "SHaderForge" And Analize the Diferences The Program Makes "node by node" with Some "file Diferences merge" Program like http://meldmerge.org/ or SOmething ... I can Actually Check And Extract the Exact codes Data That i Should Copy Paste to Have Some SHaderforge Nodes Integrated "Hacked" into ANtonov!

    Well It will be a Hell of a work But ! I need Antonov Features ...
    I got to do it SOMEHOW !

    Dont laught at me ... :D
    But Thats My Big Plan to Make Any custom SHaderforge Shaders / Integrated Into ANTONOV Shaders ...​
    Im SUre im gona mess it big time xD hahah ... ;)


    PS: In The Spoler there are some Shader Codes we Will be Trying to Translate to Antonov ...
    Can you give Some Hints Were We can Start please ? And were to do The Inserts ..

    WOuld be cool to Have Those Shaders Translated to Antonov "properly" ...

    But i will give my Try to Contribute alitle more : )

    We Will Keep you Updated..

    THANKS SO MUCH FOR YOUR AWESOMENESS CHARLES !

    I guess thats it for this Week Latest news From me this sides !

    BEST REGARDS


    /3DLABS
     
    Last edited: Dec 8, 2014
  3. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi Charles,

    I was fiddling around with Unity 5 PBR and lighting system. I noticed that emissive objects are the one that gives specular reflection to an object. Light source directional / point / spot light should only give light source but do not contribute specular reflection to an object. Sorry for my bad english. Also U5 default reflection probe still looks bad compared to Antonov Suit's reflection probe. Yours is still the best to be honest :)
     

    Attached Files:

  4. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    Does Antonov works on Unity 5. ;)
     
  5. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    wait, is this still being updated?
     
  6. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Hey sorry for the lack news and update.

    Ive been pretty busy with personnal stuff.

    Im converting Antonov Suit to Unity 5 but the process takes time.

    Actually it works with Unity 5 in forward but with no lightmap.
     
    ZJP likes this.
  7. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    WOW I'm excited please I'll look forward to it @Charkes . Antonov Suit works well with U4 however the lighting is not that good so I temporarily stop the development of my game in Unity3D I ported it to UE4 but I'm planning to continue it still when Antonov Suit is compatible with U5. Hey @Charkes theres this guy I'm also following on YouTube Yaboiicey he is really good as well he also made Unity 5 looks similar to UE4 the graphics is damn good :
     
    Lex4art and Charkes like this.
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Hmm i think i know who that guy is.....
    Edit : yeahhh i know him :p
     
    MegsTan likes this.
  9. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
  10. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Let me correct myself here.... I meant the Unity3D Lighting.
     
    Charkes likes this.
  11. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    @MegsTan Yup I've seen some of his stuff on youtube, looks cool :). Hope your projects is going well, send me some progress if you can !

    I've reworked a bit my SSR and made a version just for Unity 5 :

    https://dl.dropboxusercontent.com/u/1812933/Unity 5 Charkes SSR.unitypackage

    It has a proper blur now based on the roughness/smoothness.

    You will need the Effects packages from Standard Assets to make it working and also it require DX11 at the moment.

    There's no special blending with reflection probes because probes are accumulated with Emission, Lighting and GI in the same G-Buffer.



     
    AcidArrow and Reanimate_L like this.
  12. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi @Charkes Thanks I will test the Screen Space. I Stopped at the moment due to Unity 4's default lighting and it makes me feel frustrated. I'm aiming for the Unity 5 lighting. Probably when I'm done with some work stuff I will get back to Unity 4 and continue the game. Yup I will, for the meantime I'll show you some of the screenshots of the assets that uses Antonov Suit probably next weekend. :)
     
  13. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Cool!

    Quick view of the SSR, I've used my old scene as test but had to convert all textures to make it work with Unity 5.

     
    ddutchie, Luckymouse and MegsTan like this.
  14. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi @Charkes you mean that is Unity 5??? :D using Antonov Suit? WOW and the SSR is soo sweet :D
     
  15. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    @MegsTan Only SSR and Unity 5 for this one but while doing more test I've noticed a huge difference in smothness with metallic and specular workflow !

    EDIT : Oups it was my mistake haha
     
  16. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Hey Charkes, glad you are back again. Just wonder hows your plan for Antonov Suit in Unity 5, will Antonov Suit use Unity 5 ambient and reflection probe?
     
  17. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    :)

    Basically what I want is to do a sort of mix, I think ambient lighting is great so I can leave what I've done and use Uinty 5 ambient lighting but for reflection I think they could have made them better.

    The convolution is really sharp and sometimes really uggly, so I'm trying to port my convolution to Unity 5 reflection probes, but it's not easy to do.

    Currently I've already ported Antonov Suit to Unity 5 but only the direct lighting part.
     
    Reanimate_L and kenshin like this.
  18. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    I agree that unity could have made the convolution of reflection probe better, especially the skybox reflection doesn't look very convincing.
    Your SSR looks great. I know it is dx11 now but hopefully it will be mac compatible, can't wait to try it.:)
     
    Charkes likes this.
  19. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    @Charkes Any update for Unity5 Antonov? or the SSR ? :D
     
  20. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Yeah I can at least gives this rough conversion :

    https://dl.dropboxusercontent.com/u/1812933/AntonovSuit/AntonovSuit Unity 5.unitypackage

    To use it go to "Edit/ProjectSettings/Graphics" then in Deferred change "Built-in shader" to "Custom Shader" add AntonovSuitDeferredShading.shader to it.



    Then just create your material and choose Antonov Suit/Metallic or Specular as shader, currently the shader are just a copy of the standard shader, so it use same input as Unity 5 Standard shader.

    It should work on deferred, forward and legacy however I use Unity 5 cubemap, not my convolution script.

    Also I made a GitHub for the ssr : https://github.com/cCharkes/UnitySSR

    This ssr is a different project and it is made to work with Unity 5 not Antonov Suit for Unity 4 but it should work with Antonov Suit for Unity 5 I think.
     
    AcidArrow and Luckymouse like this.
  21. K-E-I

    K-E-I

    Joined:
    Oct 6, 2012
    Posts:
    17
    @Charkes, you have a really good SSR system, but when I tried to use it in different lighting conditions I had some problems with combining it with reflection probes.
    So, I wrote some small addition to blend probes and SSR correctly.
    Here's screenshot and comparison. SSR.jpg SSR_comparison.jpg
     
    e_Glyde and Charkes like this.
  22. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Wow that's really nice, great results ! Can you explain how you manage to make the blending happend ?

    Thanks !
     
  23. K-E-I

    K-E-I

    Joined:
    Oct 6, 2012
    Posts:
    17
    I modified lighting .cginc files and added a camera which render reflections only.
    I multiplying it by ssr mask and subtract it from rendering where ssr is visible.
    I know, rendering scene twice isn't fast option, but for now it's only way to get reflection buffer. Maybe later unity will get ability to create custom deferred buffers, and there will no need to render scene twice.

    Here's screenshot of reflection buffer screenshot_2015_05_15_22_42_23.jpg
     
    Charkes likes this.
  24. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Nice!

    Yeah not the fastest but at least it works as a short term solution. Hope custom deferred will come soon.
     
  25. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Thank you Charkes, i will test your package.
     
    Charkes likes this.
  26. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Charkes and Luckymouse like this.
  27. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Hello! Your shader suit looks impressive! Lots of respect=)
    I would like to ask you, is it possible to use your bake cubemaps and involves systems in realtime (without editor)?
    I understand that is expensive, but we need completely realtime solution for our project
    Thanks!
     
  28. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112


    Just a litle material test) Antonov VS ShaderForge simple pbr+simple cubemap
     
    Charkes likes this.
  29. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112


    Reflections aliased like crazy. So toksving factor don't affect to reflections? No way to fix it?
     
    Last edited: Jun 4, 2015
    rebit likes this.
  30. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Antonov Suite Shader + SMAA + uSky + CharquesSSR



     
    Last edited: Jun 7, 2015
    Charkes likes this.
  31. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  32. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Yes, ZJP !
     
    ZJP likes this.
  33. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi Charkes,

    I was really busy work mode. I just tried the Antonov Suit for Unity 5 and doing some test so far I'm just wondering where the skin shader is? Are you planning to include it back? I tried the SSR and it works perfectly not much frame drop if I'm using Low and 128 Texture Size. Good Job :)
     
    Charkes likes this.
  34. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
     
    Charkes and MegsTan like this.
  35. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi Rebit,

    How do you control the reflection on the texture? If you want it to be non reflective?
     
    rebit likes this.
  36. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi,

    Sorry I forgot to add reflection probe thats why it uses the skies reflection hahaha
     
    rebit likes this.
  37. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Hi Charkes,

    I'm still using the Antonov Suit for Quixel Suit. I remember that it works well with Antonov Suit for Unity 4 however, it does not work with Antonov Suit for Unity 5 the roughness is does not change no matter how much I change it. The first image is what I want it to look like the second image is how it actually looks like even if I make the roughness completely black or white.

    R - Metallic
    G - Roughness
    B - Occlusion

    Suppose To Be.jpg Too Much Roughness.jpg
     
  38. e_Glyde

    e_Glyde

    Joined:
    Apr 20, 2013
    Posts:
    42
    Antonov Suit uses the same texture input as Unity 5's Standard shader.
    So with that in mind Unity 5's Standard shader uses the metallic map's alpha as the roughness.
     
    Charkes and MegsTan like this.
  39. MegsTan

    MegsTan

    Joined:
    Oct 19, 2013
    Posts:
    55
    Charkes likes this.
  40. e_Glyde

    e_Glyde

    Joined:
    Apr 20, 2013
    Posts:
    42
    MegsTan and Charkes like this.
  41. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Sorry for late response guys.

    @RockSPb
    1 - Well doing convolution in real time is really expensive but possible, what is your need ?


    2 - Toksvig is only for direct specular reflection, occlusion texture can help to hide such artefacts, and did you tried the #define ANTONOV_HORYZON_OCCLUSION inside your shader ?

    @MegsTan 1 - Thanks! Yeah skin shader will be added too as a forward shader with an eye and cloth shader type.

    2 - @EpicLilg answered perfectly :).

    Got a new update for the SSR : https://github.com/cCharkes/UnitySSR

    Basically I've added more options to the blur solution and you can choose GGX or Blinn.


    Thanks!
     
    e_Glyde, rebit and Reanimate_L like this.
  42. e_Glyde

    e_Glyde

    Joined:
    Apr 20, 2013
    Posts:
    42
    That update to your SSR solution has made it a whole lot better for older machines(i.e me). Even though it makes the whole thing nosier I don't care, it actually makes it look better(personally).


    None

    "Noise" Sampling Method
    Frame rate killer "Hammersley" Sampling Method
     
    Charkes likes this.
  43. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    @EpicLilg Nice !

    That's a good one :).



    As some of you may have noticed, sky is not reflected by ssr or it is but with really low far clip ( like 10 or 20 and it is uggly), so I'm trying to fix this. Could be a good add as proper blending with cubemap is quit hard to achieve.
     
    Last edited: Jul 4, 2015
    e_Glyde and minhdaubu2 like this.
  44. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    76
    Which are your current unity version? :D
     
  45. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    I'm using Unity 5.0 now and in deferred.
     
    minhdaubu2 likes this.
  46. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Might want to wait for the deferred reflection buffer in 5.2. . .
     
  47. e_Glyde

    e_Glyde

    Joined:
    Apr 20, 2013
    Posts:
    42
    I personally think he can just upgrade when it arrives but it can let us implement it in our projects now.

    Edit: Just read a 5.2 doc on the SSR implementation. The SSR Unity plans to provide will only work in "Deferred Shading"
    "SSRR requires Deferred Shading to be used (since it needs information from the g-buffer: depth, normals, specular, smoothness, occlusion)."
    Full Doc
     
    Last edited: Jul 3, 2015
    Charkes likes this.
  48. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Well i didn't said that he shouldn't, i'm just suggesting :D, Since they give warning that with the change in deferred rendering in 5.2 some old deferred stuff need to be re-written
     
    Charkes likes this.
  49. e_Glyde

    e_Glyde

    Joined:
    Apr 20, 2013
    Posts:
    42
    Well no prob, also I just found out that the SSR doesn't work in Forward.So that's part me being dumb as well. :p
    And I know what your saying, but I'm kind of impatient and I really like using this Image Effect.
     
  50. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    No worries as well, yeah i understand that SSR is really an important part in PBR.
    @Charkes : any plan to support SSR in transparent object, might be a doable solution for water?