Commit 309b13d2 authored by Tommé Nöll's avatar Tommé Nöll
Browse files

added exponent to corruption zone rendering

parent 19efb4a6
......@@ -126,6 +126,40 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 2030130258}
m_PrefabAsset: {fileID: 0}
--- !u!84 &25395476
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: 1093
m_Height: 539
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 &35719956
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -3986,40 +4020,6 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7ef06ffc179d97098a6c30d5f8570a4e, type: 3}
--- !u!84 &1665183317
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: 1090
m_Height: 539
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
......@@ -5487,15 +5487,30 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: exponent
value: 2.19
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrengthDistanceFactor
value: 0.348
objectReference: {fileID: 0}
- target: {fileID: 6635821371766515316, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: maxStrength
value: 0.862
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_LocalPosition.x
value: 4.48
value: 4.41
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.37
value: 0.92
objectReference: {fileID: 0}
- target: {fileID: 5546039070061430727, guid: 5f19e99694f67a245b4244a6b9f38023,
type: 3}
......@@ -5530,7 +5545,7 @@ PrefabInstance:
type: 3}
propertyPath: m_TargetTexture
value:
objectReference: {fileID: 1665183317}
objectReference: {fileID: 25395476}
- target: {fileID: 8811539148413200178, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: orthographic size
......@@ -5606,6 +5621,11 @@ PrefabInstance:
propertyPath: corruptionMap
value:
objectReference: {fileID: 120497678}
- target: {fileID: 8811539149977030271, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: showCorruptionMap
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5104620888276671122, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: m_Enabled
......
......@@ -46,7 +46,6 @@ public class CorruptionCamera : MonoBehaviour
}
//Debug.Log(bounds.min + ", " + bounds.max);
//match bounds center to camera position by increasing bounds size
Debug.Log(bounds);
Vector3 min = bounds.min;
Vector3 max = bounds.max;
if (bounds.center.x < transform.position.x)
......@@ -68,7 +67,6 @@ public class CorruptionCamera : MonoBehaviour
}
bounds.SetMinMax(min, max);
Debug.Log(bounds);
CameraZone.FindCamera();
float targetSize = CameraZone.CalculateCameraSize(bounds, CameraZone.FitMode.grow);
......
......@@ -8,6 +8,8 @@ public class CorruptionZone : MonoBehaviour
{
[Range (0f, 1f)] public float maxStrength;
[Range (0f, 0.99f)] public float maxStrengthDistanceFactor;
[Range (0f, 10f)] public float exponent = 2f;
private new Renderer renderer;
//private CircleCollider2D collider;
......@@ -25,6 +27,7 @@ public class CorruptionZone : MonoBehaviour
//Debug.Log(transform.position);
properties.SetFloat("_MaxStrength", maxStrength);
properties.SetFloat("_MaxStrengthDistanceFactor", maxStrengthDistanceFactor);
properties.SetFloat("_Exponent", exponent);
renderer.SetPropertyBlock(properties);
}
......
......@@ -39,6 +39,7 @@
float4 _MainTex_ST;
float _MaxStrength;
float _MaxStrengthDistanceFactor;
float _Exponent;
sampler2D _GrabTexture;
......@@ -60,10 +61,13 @@
// sample the texture
//fixed4 col = tex2D(_MainTex, i.uv);
float dist = distance(i.uv, (0.5, 0.5)) * 2;
dist = max(dist - _MaxStrengthDistanceFactor, 0);
dist -= _MaxStrengthDistanceFactor;
dist = max(dist, 0);
dist /= 1 - _MaxStrengthDistanceFactor;
dist = 1 - dist;
dist = max(dist, 0);
dist = pow(dist, _Exponent);
return dist * _MaxStrength;
}
......
Markdown is supported
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