Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

46 行
2.3 KiB

diff --git a/Packages/com.verasl.water-system/Scripts/Rendering/PlanerReflections.cs b/Packages/com.verasl.water-system/Scripts/Rendering/PlanerReflections.cs
index 6e39dc7..c70bb4a 100644
--- a/Packages/com.verasl.water-system/Scripts/Rendering/PlanerReflections.cs
+++ b/Packages/com.verasl.water-system/Scripts/Rendering/PlanerReflections.cs
@@ -79,8 +79,13 @@ namespace UnityEngine.Experimental.Rendering.LightweightPipeline
m_ReflectionCamera = CreateMirrorObjects(realCamera);
// find out the reflection plane: position and normal in world space
- Vector3 pos = target.transform.position;
- Vector3 normal = target.transform.up;
+ Vector3 pos = Vector3.zero;
+ Vector3 normal = Vector3.up;
+ if (target != null)
+ {
+ pos = target.transform.position;
+ normal = target.transform.up;
+ }
UpdateCamera(realCamera, m_ReflectionCamera);
@@ -93,7 +98,7 @@ namespace UnityEngine.Experimental.Rendering.LightweightPipeline
reflection *= Matrix4x4.Scale(new Vector3(1, -1, 1));
CalculateReflectionMatrix(ref reflection, reflectionPlane);
- Vector3 oldpos = realCamera.transform.position - new Vector3(0, target.transform.position.y * 2, 0);
+ Vector3 oldpos = realCamera.transform.position - new Vector3(0, pos.y * 2, 0);
Vector3 newpos = ReflectPosition(oldpos);
m_ReflectionCamera.transform.forward = Vector3.Scale(realCamera.transform.forward, new Vector3(1, -1, 1));
m_ReflectionCamera.worldToCameraMatrix = realCamera.worldToCameraMatrix * reflection;
@@ -226,6 +231,8 @@ namespace UnityEngine.Experimental.Rendering.LightweightPipeline
GL.invertCulling = true;
RenderSettings.fog = false;
+ var bias = QualitySettings.lodBias;
+ QualitySettings.lodBias = bias * 0.25f;
UpdateReflectionCamera(camera);
@@ -234,6 +241,7 @@ namespace UnityEngine.Experimental.Rendering.LightweightPipeline
GL.invertCulling = false;
RenderSettings.fog = true;
+ QualitySettings.lodBias = bias;
}
}
}