Hey forum,
I’ve been willing to target this one shader to 3.0. But it seems to be forcing me to target 4.0 constantly.
I need all those struct input values in order for the effect on the walls to work with:
- The uv’s that come with the model for mask texture.
- Vertex color,
- Local coord and local normal for triplanar texture mapping
Shader "Oot3D/effects/triplanar scroll"
{
Properties
{
[NoScaleOffset] _MaskTexture ("Mask", 2D) = "white" {}
[NoScaleOffset] _TriplanarTexture("Triplanar Texture", 2D) = "white" {}
_MapScale("", Float) = 1
_ScrollX ("Scroll X Speed", Float ) = 0.0
_ScrollY ("Scroll Y Speed", Float ) = 0.0
_ScrollZ ("Scroll Z Speed", Float ) = 0.0
_ColorSpeed ("Color Change Speed", Float ) = 2.0
_Intensity ("Intensity", Range(0,16)) = 2.0
_Gamma ("Gamma", Range(1,2)) = 1.0
_Contrast ("Contrast", Range(0,1)) = 1.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
Blend SrcAlpha One
CGPROGRAM
#include "includes\output_adjust.cginc"
#include "includes\hue_adjust.cginc"
#pragma surface surf StandardSpecular vertex:vert
#pragma target 3.0
sampler2D _MaskTexture,_TriplanarTexture;
half _MapScale;
float _Intensity, _Contrast, _Gamma, _ColorSpeed;
uniform float _ScrollX, _ScrollY, _ScrollZ;
struct Input
{
float2 uv_MaskTexture : TEXCOORD0;
float3 localCoord : POSITION;
float3 localNormal : NORMAL;
float4 vertColor : COLOR;
};
void vert(inout appdata_full v, out Input data)
{
UNITY_INITIALIZE_OUTPUT(Input, data);
data.localCoord = v.vertex.xyz;
data.localCoord.x += _ScrollX * _Time.y;
data.localCoord.y += _ScrollY * _Time.y;
data.localCoord.z += _ScrollZ * _Time.y;
data.localNormal = v.normal.xyz;
}
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
float3 bf = normalize(abs(IN.localNormal));
bf /= dot(bf, (float3)1);
float2 tx = IN.localCoord.yz * _MapScale;
float2 ty = IN.localCoord.zx * _MapScale;
float2 tz = IN.localCoord.xy * _MapScale;
half4 cx = tex2D(_TriplanarTexture, tx) * bf.x;
half4 cy = tex2D(_TriplanarTexture, ty) * bf.y;
half4 cz = tex2D(_TriplanarTexture, tz) * bf.z;
half4 color = (cx + cy + cz);
float3 v = IN.vertColor;
color.rgb = Contrast(color.rgb, _Contrast);
color.rgb = Gamma(color.rgb, _Gamma);
_Intensity *= .5 + (cos((_ColorSpeed * _Time.y)*32)*.5);
v *= _Intensity;
color.rgb *= v.rgb;
o.Specular = float3(0,0,0);
float3 AddColor = float3(1,0,0);
AddColor = applyHue(AddColor,(_ColorSpeed * _Time.y) * 255);
o.Emission = color.rgb * AddColor;
o.Emission.rgb *= tex2D (_MaskTexture, IN.uv_MaskTexture);
o.Alpha = color.a;
}
ENDCG
}
FallBack "Diffuse"
}
Anyone knows how I can cut off a part of the code without breaking the effect and allowing me to target 3.0?
Thanks in advance!