Commit 931d6abb authored by Tommé Nöll's avatar Tommé Nöll
Browse files

added variables to change how strongly each color influences the effect

parent 2cb6a194
......@@ -61,6 +61,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorStrengthExponent: 5
- _Corruption: -2.45
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
......@@ -68,7 +69,7 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _GreenExponent: 5.91
- _GreenExponent: 5.16
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
......@@ -84,5 +85,8 @@ Material:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _ColorDividers: {r: 1, g: 1.72, b: 1, a: 1}
- _ColorFactors: {r: 9.31, g: -18.34, b: 7.17, a: 1}
- _ColorInFactors: {r: -0.17, g: 1.19, b: -0.24, a: 0}
- _ColorOutFactors: {r: 10, g: -20, b: 9, a: 0}
- _ColorStrengthFactors: {r: -0.18, g: 1.18, b: -0.21, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _MainCameraPos: {r: 5.35, g: 1.67, b: -10, a: 0}
......@@ -760,40 +760,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 299385464}
m_PrefabAsset: {fileID: 0}
--- !u!84 &326032995
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1261
m_Height: 566
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 21
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1001 &339069304
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -1588,7 +1554,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.262, g: 0, b: 0, a: 1}
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
......@@ -1611,7 +1577,7 @@ Camera:
serializedVersion: 2
m_Bits: 4096
m_RenderingPath: -1
m_TargetTexture: {fileID: 326032995}
m_TargetTexture: {fileID: 1455027376}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
......@@ -3645,6 +3611,40 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1398391205}
m_PrefabAsset: {fileID: 0}
--- !u!84 &1455027376
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1181
m_Height: 563
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 21
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1001 &1458074145
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -4237,6 +4237,40 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7ef06ffc179d97098a6c30d5f8570a4e, type: 3}
--- !u!84 &1658530543
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1261
m_Height: 563
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 21
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1001 &1673005932
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -4469,16 +4503,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 561089203}
m_Modifications:
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Layer
value: 12
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Name
value: CorruptionZone (1)
objectReference: {fileID: 0}
- target: {fileID: 146384502658720480, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_RootOrder
......@@ -4487,12 +4511,12 @@ PrefabInstance:
- target: {fileID: 146384502658720480, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_LocalPosition.x
value: 6.13
value: 8.22
objectReference: {fileID: 0}
- target: {fileID: 146384502658720480, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_LocalPosition.y
value: 1.91
value: 1.32
objectReference: {fileID: 0}
- target: {fileID: 146384502658720480, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
......@@ -4504,6 +4528,16 @@ PrefabInstance:
propertyPath: m_LocalScale.y
value: 6.89
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Layer
value: 12
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Name
value: CorruptionZone (1)
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441875, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: maxStrengthDistanceFactor
......@@ -5575,7 +5609,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142912997}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.35, y: 1.67, z: -10}
m_LocalPosition: {x: 5.92, y: 2.85, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 552839326}
......@@ -5715,7 +5749,7 @@ PrefabInstance:
- target: {fileID: 8565205532968054277, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: globalCorruption
value: 0.262
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8565205532968054277, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
......@@ -5726,7 +5760,7 @@ PrefabInstance:
type: 3}
propertyPath: mapTexture
value:
objectReference: {fileID: 326032995}
objectReference: {fileID: 1658530543}
- target: {fileID: 8565205532968054277, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: zones.Array.data[0]
......@@ -5742,21 +5776,6 @@ PrefabInstance:
propertyPath: zones.Array.data[1]
value:
objectReference: {fileID: 1762265941}
- target: {fileID: 6635821371766515317, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_Layer
value: 12
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrength
value: 0.344
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrengthDistanceFactor
value: 0.453
objectReference: {fileID: 0}
- target: {fileID: 5524515208459548046, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_LocalPosition.x
......@@ -5812,15 +5831,30 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515317, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_Layer
value: 12
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrength
value: 0.344
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrengthDistanceFactor
value: 0.453
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_LocalPosition.x
value: 9.84
value: 20.7
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.11
value: 9.35
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
......
......@@ -9,8 +9,9 @@ Shader "Custom/PlantSurfaceShader"
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_GreenExponent("GreenExponent", Float) = 3.0
_ColorFactors("ColorFactors", Vector) = (10, 10, 10, 0)
_ColorStrengthFactors("ColorStrengthFactors", Vector) = (0, 1, 0, 0)
_ColorStrengthExponent("ColorStrengthExponent", Float) = 5.0
_ColorOutFactors("ColorChangeFactors", Vector) = (10, -20, 9, 0)
_PulsatingSpeed("PulsatingSpeed", Float) = 1.3
_PulsatingStrength("PulsatingStrength", Float) = 0.8
}
......@@ -39,8 +40,9 @@ Shader "Custom/PlantSurfaceShader"
half _Metallic;
fixed4 _Color;
sampler2D _CorruptionMap;
float _GreenExponent;
float4 _ColorFactors;
float4 _ColorStrengthFactors;
float _ColorStrengthExponent;
float4 _ColorOutFactors;
float4x4 _ToMainCameraMatrix;
float _PulsatingSpeed;
float _PulsatingStrength;
......@@ -54,20 +56,21 @@ Shader "Custom/PlantSurfaceShader"
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
fixed4 color = tex2D (_MainTex, IN.uv_MainTex) * _Color;
float2 screenPos = ComputeScreenPos(UnityObjectToClipPos(IN.worldPos));
#if EDITOR_ON
screenPos = ComputeScreenPos(mul(_ToMainCameraMatrix, float4 (IN.worldPos, 1.0)));
#endif
float corruption = tex2D(_CorruptionMap, screenPos) * 3;
float colorshift = max(pow(c.g, _GreenExponent) * corruption * (0.5 + _PulsatingStrength / 50 * (sin(_Time[1] * _PulsatingSpeed) / 2)), 0);
c += colorshift * _ColorFactors;
float colorstrength = dot(_ColorStrengthFactors, color);
float colorshift = max(pow(colorstrength, _ColorStrengthExponent) * corruption * (0.5 + _PulsatingStrength / 50 * (sin(_Time[1] * _PulsatingSpeed) / 2)), 0);
color += colorshift * _ColorOutFactors;
// Albedo comes from a texture tinted by color
o.Albedo = c.rgb;
o.Albedo = color.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
o.Alpha = color.a;
}
ENDCG
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment