浏览代码

Assorted fixes

- added debug modes to Renderer Features
- added respawn option for boats
- removed cloud renderer feature
/demo-work
André McGrail 5 年前
当前提交
ae1ff984
共有 17 个文件被更改,包括 330 次插入205 次删除
  1. 156
      Assets/Data/InputControls.inputactions
  2. 46
      Assets/Data/UniversalRP/BoatDemoRenderer.asset
  3. 40
      Assets/Data/UniversalRP/PlanarReflectionRenderer.asset
  4. 28
      Assets/Objects/Levels/Island/Logic.prefab
  5. 19
      Assets/Scripts/Boat/AIcontroller.cs
  6. 25
      Assets/Scripts/Boat/BoatController.cs
  7. 7
      Assets/Scripts/Boat/Engine.cs
  8. 13
      Assets/Scripts/Boat/HumanController.cs
  9. 4
      Assets/Scripts/Environment/CloudManager.cs
  10. 56
      Assets/Scripts/GameSystem/InputControls.cs
  11. 54
      Assets/Scripts/GameSystem/WaypointGroup.cs
  12. 30
      Assets/scenes/Island.unity
  13. 16
      Packages/com.verasl.water-system/Scripts/Rendering/WaterCausticsFeature.cs
  14. 21
      Packages/com.verasl.water-system/Scripts/Rendering/WaterFXFeature.cs
  15. 20
      Packages/com.verasl.water-system/Shaders/Caustics.shader
  16. 0
      /Assets/Shaders/CliffShader.ShaderGraph.meta
  17. 0
      /Assets/Shaders/CliffShader.ShaderGraph

156
Assets/Data/InputControls.inputactions


{
"name": "New Controls",
"name": "InputControls",
"maps": [
{
"name": "BoatControls",

"name": "Trottle",
"type": "Value",
"expectedControlLayout": "Axis",
"continuous": true,
"passThrough": false,
"initialStateCheck": false,
"expectedControlType": "Axis",
"interactions": "",
"bindings": []
"interactions": ""
"type": "Value",
"expectedControlLayout": "Axis",
"continuous": true,
"passThrough": false,
"initialStateCheck": false,
"expectedControlType": "Axis",
"processors": "AxisDeadzone(min=0.1,max=1)",
"interactions": ""
},
{
"name": "Reset",
"type": "Button",
"id": "218640d2-e6dc-4136-842e-4621c0883e15",
"expectedControlType": "",
"interactions": "",
"bindings": []
"interactions": ""
}
],
"bindings": [

"groups": "",
"action": "Trottle",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Gamepad",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Gamepad",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "Buttons",

"groups": "",
"action": "Trottle",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": ";Gamepad",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": ";Gamepad",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "Arrows",

"groups": "",
"action": "Trottle",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "WSAD",

"groups": "",
"action": "Trottle",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "Alt",

"groups": "",
"action": "Trottle",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Keyboard",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "",

"groups": "TouchScreen",
"action": "Trottle",
"isComposite": false,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "LeftThumbstick",

"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Gamepad",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Gamepad",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "DPad",

"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": ";Gamepad",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": ";Gamepad",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "Arrows",

"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Keyboard",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Keyboard",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "WSAD",

"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "negative",

"groups": "Keyboard",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "positive",

"groups": "Keyboard",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true,
"modifiers": ""
"isPartOfComposite": true
},
{
"name": "",

"groups": "TouchScreen",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": false,
"modifiers": ""
"isPartOfComposite": false
},
{
"name": "",
"id": "7a7ffffc-09c1-403a-b879-7a91dfb5b29d",
"path": "<Gamepad>/select",
"interactions": "Press",
"processors": "",
"groups": "Gamepad",
"action": "Reset",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b449cb97-f7cf-448b-9aa9-900c8085c53d",
"path": "<Keyboard>/#(r)",
"interactions": "",
"processors": "",
"groups": "Keyboard",
"action": "Reset",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f8b1e58a-fd18-487f-ae58-dc92e5273625",
"path": "<Touchscreen>/primaryTouch/tapCount",
"interactions": "MultiTap(tapCount=3)",
"processors": "",
"groups": "TouchScreen",
"action": "Reset",
"isComposite": false,
"isPartOfComposite": false
}
]
}

"name": "Gamepad",
"basedOn": "",
"bindingGroup": "Gamepad",
"devices": [
{

},
{
"devicePath": "<SwitchProControllerHID>",
"isOptional": true,
"isOR": false
"basedOn": "",
"bindingGroup": "Keyboard",
"devices": [
{

},
{
"name": "TouchScreen",
"basedOn": "",
"bindingGroup": "TouchScreen",
"devices": [
{

46
Assets/Data/UniversalRP/BoatDemoRenderer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5739757023391478601
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b3d386ba5cd94485973aee1479b272e, type: 3}
m_Name: Clouds
m_EditorClassIdentifier:
settings:
passTag: Clouds
Event: 400
filterSettings:
RenderQueueType: 0
LayerMask:
serializedVersion: 2
m_Bits: 256
PassNames: []
overrideMaterial: {fileID: 0}
overrideMaterialPassIndex: 0
overrideDepthState: 0
depthCompareFunction: 0
enableWrite: 0
stencilSettings:
overrideStencilState: 1
stencilReference: 0
stencilCompareFunction: 3
passOperation: 0
failOperation: 0
zFailOperation: 0
cameraSettings:
overrideCamera: 0
restoreCamera: 1
offset: {x: 0, y: 0, z: 0, w: 0}
cameraFieldOfView: 60
--- !u!114 &-5007552800156170450
MonoBehaviour:
m_ObjectHideFlags: 0

m_RendererFeatures:
- {fileID: 7749027049794126836}
- {fileID: -5007552800156170450}
- {fileID: -5739757023391478601}
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}

samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3}
m_OpaqueLayerMask:
serializedVersion: 2
m_Bits: 2147548727
m_Bits: 4294967295
m_Bits: 2147548727
m_Bits: 4294967295
overrideStencilState: 1
overrideStencilState: 0
stencilReference: 1
stencilCompareFunction: 8
passOperation: 2

settings:
material: {fileID: 2100000, guid: 7e6ea000873112847bd146ddb78ac67d, type: 2}
mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
debug: 0

40
Assets/Data/UniversalRP/PlanarReflectionRenderer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-770662509796182357
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b3d386ba5cd94485973aee1479b272e, type: 3}
m_Name: Clouds
m_EditorClassIdentifier:
settings:
passTag: Clouds
Event: 400
filterSettings:
RenderQueueType: 0
LayerMask:
serializedVersion: 2
m_Bits: 256
PassNames: []
overrideMaterial: {fileID: 0}
overrideMaterialPassIndex: 0
overrideDepthState: 1
depthCompareFunction: 4
enableWrite: 0
stencilSettings:
overrideStencilState: 1
stencilReference: 0
stencilCompareFunction: 3
passOperation: 0
failOperation: 0
zFailOperation: 0
cameraSettings:
overrideCamera: 0
restoreCamera: 1
offset: {x: 0, y: 0, z: 0, w: 0}
cameraFieldOfView: 60
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0

m_Name: PlanarReflectionRenderer
m_EditorClassIdentifier:
m_RendererFeatures:
- {fileID: -770662509796182357}
- {fileID: 0}
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}

28
Assets/Objects/Levels/Island/Logic.prefab


- point: {x: -89.091484, y: 0, z: 0.08934003}
WPwidth: 6.4
rotation: {x: 0, y: -0.13860865, z: 0, w: 0.9903472}
WPnumber: 0
WPnumber: 1
WPnumber: 0
WPnumber: 2
WPnumber: 0
WPnumber: 3
WPnumber: 0
WPnumber: 4
WPnumber: 0
WPnumber: 5
WPnumber: 0
WPnumber: 6
WPnumber: 0
WPnumber: 7
WPnumber: 0
WPnumber: 8
WPnumber: 0
WPnumber: 9
WPnumber: 0
WPnumber: 10
WPnumber: 0
WPnumber: 11
WPnumber: 0
WPnumber: 12
WPnumber: 0
WPnumber: 13
WPnumber: 0
WPnumber: 14
WPgroup: 0
--- !u!1 &5076232291228677030
GameObject:

19
Assets/Scripts/Boat/AIcontroller.cs


public bool foundPath;
private int pathPointNum;
public Engine engine;//cache for AIs engine
public BoatController controller;
private float idleTime;
private Vector3 tempFrom;//nav from position
private Vector3 tempTo;//nav to position
private float targetSide;//side of destination, positive on right side, negative on left side

}
}
}
if (idleTime > 4f)
{
Debug.Log($"AI boat {gameObject.name} was stuck, respawing.");
controller.ResetPosition();
}
if (engine.velocityMag < 0.1f)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}
}

25
Assets/Scripts/Boat/BoatController.cs


public Renderer boatRenderer; // The renderer for the boat mesh
public Renderer engineRenderer; // The renderer for the boat mesh
public Engine engine;
private Matrix4x4 spawnPosition;
public CinemachineVirtualCamera cam;

void Awake()
{
Colourize();
}
spawnPosition = transform.localToWorldMatrix;
}
// Use this for initialization
void Start()
{

{
gameObject.AddComponent<HumanController>().engine = engine; // Adds a human controller if human
var humanController = gameObject.AddComponent<HumanController>();
humanController.engine = engine;
humanController.controller = this;
gameObject.AddComponent<AIcontroller>().engine = engine; // Adds an AI controller if AI
var aiController = gameObject.AddComponent<AIcontroller>();
aiController.engine = engine; // Adds an AI controller if AI
aiController.controller = this; // Adds an AI controller if AI
}
}

boatRenderer.material.SetColor("_Color2", TrimColor);
engineRenderer.material.SetColor("_Color2", TrimColor);
}
}
}
public void ResetPosition()
{
if (WaypointGroup.instance)
{
var resetMatrix = WaypointGroup.instance.GetClosestPointOnWaypoint(transform.position);
var resetPoint = resetMatrix.GetColumn(3);
resetPoint.y = spawnPosition.GetColumn(3).y;
transform.SetPositionAndRotation(resetPoint, resetMatrix.rotation);
engine.RB.velocity = Vector3.zero;
engine.RB.angularVelocity = Vector3.zero;
}
}

7
Assets/Scripts/Boat/Engine.cs


public class Engine : MonoBehaviour
{
public Rigidbody RB; // The rigid body attatched to the boat
public Vector3 vel; // Boats velocity
public float velocityMag; // Boats velocity
public AudioSource engineSound; // Engine sound clip
public AudioSource waterSound; // Water sound clip

void FixedUpdate()
{
vel = RB.velocity; // store the velocity
float velMag = vel.sqrMagnitude; // get the sqr mag
engineSound.pitch = Mathf.Max(velMag * 0.01f, 0.3f); // use some magice numbers to control the pitch of the engine sound
velocityMag = RB.velocity.sqrMagnitude; // get the sqr mag
engineSound.pitch = Mathf.Max(velocityMag * 0.01f, 0.3f); // use some magice numbers to control the pitch of the engine sound
// Get the water level from the engines position and store it
point[0] = transform.TransformPoint(enginePosition);

13
Assets/Scripts/Boat/HumanController.cs


using UnityEngine;
using System.Threading;
using UnityEngine;
using UnityEngine.InputSystem;
namespace BoatAttack.Boat
{

public class HumanController : MonoBehaviour
{
public BoatController controller; // the boat controller
public Engine engine; // the engine script
public InputControls controls;

controls.BoatControls.Steering.performed += context => steering = context.ReadValue<float>();
controls.BoatControls.Steering.canceled += context => steering = 0f;
controls.BoatControls.Reset.performed += ResetBoat;
engine = GetComponent<Engine>(); // get the engine script
}

private void OnDisable()
{
controls.BoatControls.Disable();
}
private void ResetBoat(InputAction.CallbackContext context)
{
controller.ResetPosition();
}
void FixedUpdate()

4
Assets/Scripts/Environment/CloudManager.cs


{
transform.localScale = Vector3.one * scale;
/* clouds = new Cloud[transform.childCount];
clouds = new Cloud[transform.childCount];
for (int i = 0; i < clouds.Length; i++)
{

cloud.mesh = cloud.t.GetComponent<MeshFilter>().sharedMesh;
cloud.t.GetComponent<Renderer>().enabled = false;
clouds[i] = cloud;
}*/
}
}
private void OnDisable()

56
Assets/Scripts/GameSystem/InputControls.cs


""expectedControlType"": ""Axis"",
""processors"": ""AxisDeadzone(min=0.1,max=1)"",
""interactions"": """"
},
{
""name"": ""Reset"",
""type"": ""Button"",
""id"": ""218640d2-e6dc-4136-842e-4621c0883e15"",
""expectedControlType"": """",
""processors"": ""AxisDeadzone(min=0.1,max=1)"",
""interactions"": """"
}
],
""bindings"": [

""action"": ""Steering"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""7a7ffffc-09c1-403a-b879-7a91dfb5b29d"",
""path"": ""<Gamepad>/select"",
""interactions"": ""Press"",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Reset"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""b449cb97-f7cf-448b-9aa9-900c8085c53d"",
""path"": ""<Keyboard>/#(r)"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Reset"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f8b1e58a-fd18-487f-ae58-dc92e5273625"",
""path"": ""<Touchscreen>/primaryTouch/tapCount"",
""interactions"": ""MultiTap(tapCount=3)"",
""processors"": """",
""groups"": ""TouchScreen"",
""action"": ""Reset"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}

""devicePath"": ""<Gamepad>"",
""isOptional"": false,
""isOR"": false
},
{
""devicePath"": ""<SwitchProControllerHID>"",
""isOptional"": true,
""isOR"": false
}
]
},

m_BoatControls = asset.GetActionMap("BoatControls");
m_BoatControls_Trottle = m_BoatControls.GetAction("Trottle");
m_BoatControls_Steering = m_BoatControls.GetAction("Steering");
m_BoatControls_Reset = m_BoatControls.GetAction("Reset");
}
~InputControls()

private IBoatControlsActions m_BoatControlsActionsCallbackInterface;
private readonly InputAction m_BoatControls_Trottle;
private readonly InputAction m_BoatControls_Steering;
private readonly InputAction m_BoatControls_Reset;
public struct BoatControlsActions
{
private InputControls m_Wrapper;

public InputAction @Reset => m_Wrapper.m_BoatControls_Reset;
public InputActionMap Get() { return m_Wrapper.m_BoatControls; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }

Steering.started -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering;
Steering.performed -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering;
Steering.canceled -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering;
Reset.started -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnReset;
Reset.performed -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnReset;
Reset.canceled -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnReset;
}
m_Wrapper.m_BoatControlsActionsCallbackInterface = instance;
if (instance != null)

Steering.started += instance.OnSteering;
Steering.performed += instance.OnSteering;
Steering.canceled += instance.OnSteering;
Reset.started += instance.OnReset;
Reset.performed += instance.OnReset;
Reset.canceled += instance.OnReset;
}
}
}

{
void OnTrottle(InputAction.CallbackContext context);
void OnSteering(InputAction.CallbackContext context);
void OnReset(InputAction.CallbackContext context);
}
}

54
Assets/Scripts/GameSystem/WaypointGroup.cs


return closest;
}
public Matrix4x4 GetClosestPointOnWaypoint(Vector3 point)
{
Vector3 respawnPoint = Vector3.zero;
Waypoint wpA;
Waypoint wpB;
Waypoint[] sortedWPs = WPs.OrderBy(wp => Vector3.Distance(point, wp.point)).ToArray();
wpA = sortedWPs[0];
wpB = sortedWPs[1];
if (Mathf.Abs(wpA.WPnumber - wpB.WPnumber) > 1)
wpB = WPs[(int)Mathf.Repeat(wpA.WPnumber + 2, WPs.Count)];
var closetToLine = FindNearestPointOnLine(new Vector2(wpA.point.x, wpA.point.z),
new Vector2(wpB.point.x, wpB.point.z),
new Vector2(point.x, point.z));
var lookVec = Vector3.forward;
if (wpA.WPnumber > wpB.WPnumber)
{
lookVec = wpA.point - wpB.point;
}
else
{
lookVec = wpB.point - wpA.point;
}
if ((wpA.WPnumber == 0 && wpB.WPnumber == WPs.Count - 1) || (wpB.WPnumber == 0 && wpA.WPnumber == WPs.Count - 1)) // if at the loop point we need to revese the lookVec
lookVec = -lookVec;
Quaternion facing = Quaternion.LookRotation(Vector3.Normalize(lookVec * (reverse ? -1f : 1f)), Vector3.up);
respawnPoint.x = closetToLine.x;
respawnPoint.z = closetToLine.y;
Matrix4x4 matrix = Matrix4x4.TRS(respawnPoint, facing, Vector3.one);
return matrix;
}
public Matrix4x4[] GetStartPositions()
{
var position = WPs[0].point + Vector3.up;

{
WPs.Clear();
curWpID = 0;
}
public Vector2 FindNearestPointOnLine(Vector2 origin, Vector2 end, Vector2 point)
{
//Get heading
Vector2 heading = (end - origin);
float magnitudeMax = heading.magnitude;
heading.Normalize();
//Do projection from the point but clamp it
Vector2 lhs = point - origin;
float dotP = Vector2.Dot(lhs, heading);
dotP = Mathf.Clamp(dotP, 0f, magnitudeMax);
return origin + heading * dotP;
}
void OnDrawGizmos()

30
Assets/scenes/Island.unity


m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 1
m_FogColor: {r: 1.2201045, g: 1.5598984, b: 1.5180036, a: 1}
m_FogColor: {r: 1.076271, g: 1.0390205, b: 0.7361599, a: 1}
m_AmbientSkyColor: {r: 0.9257443, g: 0.9165691, b: 0.89853483, a: 1}
m_AmbientSkyColor: {r: 0.7215085, g: 0.68709767, b: 0.6194611, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1

- target: {fileID: 7357475664972103680, guid: 860f73418635b430596220c04821a36c,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.21354194
value: 0.26387304
objectReference: {fileID: 0}
- target: {fileID: 7357475664972103680, guid: 860f73418635b430596220c04821a36c,
type: 3}

- target: {fileID: 7357475664972103680, guid: 860f73418635b430596220c04821a36c,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.9769339
value: 0.9645574
objectReference: {fileID: 0}
- target: {fileID: 642770860795607900, guid: 860f73418635b430596220c04821a36c,
type: 3}

- boatName: Boogie
boatPrefab: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6,
type: 3}
Human: 1
Human: 0
- boatName: Frooper
boatPrefab: {fileID: 8572136798535523618, guid: 70d78230a0527e74dabc4f14906eef98,
type: 3}

m_Script: {fileID: 11500000, guid: 30b50fc06dfa846f189e6a884ed7088f, type: 3}
m_Name:
m_EditorClassIdentifier:
_time: 0.548
_time: 0.68
_autoIcrement: 1
_speed: 0.0025
_skybox: {fileID: 0}

m_Mode: 0
m_NumColorKeys: 7
m_NumAlphaKeys: 2
_northHeading: 258
_northHeading: 255
_tilt: 33.8
_ambientColour:
serializedVersion: 2

- target: {fileID: 7312333174115242941, guid: 7ad8269e6bbda4db3a76a6e41c11a5db,
type: 3}
propertyPath: m_Enabled
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3829577903138488074, guid: 7ad8269e6bbda4db3a76a6e41c11a5db,
type: 3}

- target: {fileID: 7096263784801332180, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_Color.g
value: 0.9254922
value: 0.8058285
value: 0.7893066
value: 0.54865235
value: 0.99767536
value: 0.9926642
objectReference: {fileID: 0}
- target: {fileID: 7096263784801332180, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}

- target: {fileID: 8115735017685696522, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.61884695
value: -0.6187537
value: -0.58816576
value: -0.3382969
value: 0.49035385
value: 0.7022055
value: -0.17505059
value: 0.09801313
objectReference: {fileID: 0}
- target: {fileID: 6589000190219289651, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}

16
Packages/com.verasl.water-system/Scripts/Rendering/WaterCausticsFeature.cs


{
public Material material;
public Mesh mesh;
public bool debug;
if (settings.debug)
{
settings.material.SetFloat("_SrcBlend", 1f);
settings.material.SetFloat("_DstBlend", 0f);
settings.material.EnableKeyword("_DEBUG");
m_WaterCausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
}
else
{
settings.material.SetFloat("_SrcBlend", 2f);
settings.material.SetFloat("_DstBlend", 0f);
settings.material.DisableKeyword("_DEBUG");
m_WaterCausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1;
}
m_WaterCausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1;
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)

21
Packages/com.verasl.water-system/Scripts/Rendering/WaterFXFeature.cs


public class WaterFXFeature : UnityEngine.Rendering.Universal.ScriptableRendererFeature
{
WaterFXPass m_WaterFXPass;
public WaterFXSettings settings = new WaterFXSettings();
[System.Serializable]
public class WaterFXSettings
{
public bool debug;
}
m_WaterFXPass.renderPassEvent = UnityEngine.Rendering.Universal.RenderPassEvent.BeforeRenderingOpaques;
m_WaterFXPass.debug = settings.debug;
if (settings.debug)
{
m_WaterFXPass.renderPassEvent = UnityEngine.Rendering.Universal.RenderPassEvent.AfterRendering;
}
else
{
m_WaterFXPass.renderPassEvent = UnityEngine.Rendering.Universal.RenderPassEvent.BeforeRenderingOpaques;
}
}
public override void AddRenderPasses(UnityEngine.Rendering.Universal.ScriptableRenderer renderer, ref UnityEngine.Rendering.Universal.RenderingData renderingData)

public class WaterFXPass : UnityEngine.Rendering.Universal.ScriptableRenderPass
{
const string k_RenderWaterFXTag = "Render Water FX";
public bool debug;
ShaderTagId m_WaterFXShaderTag = new ShaderTagId("WaterFX");
Color m_ClearColor = new Color(0.0f, 0.5f, 0.5f, 0.5f);
UnityEngine.Rendering.Universal.RenderTargetHandle m_WaterFX = UnityEngine.Rendering.Universal.RenderTargetHandle.CameraTarget;

public override void FrameCleanup(CommandBuffer cmd)
{
cmd.ReleaseTemporaryRT(m_WaterFX.id);
if(!debug)
cmd.ReleaseTemporaryRT(m_WaterFX.id);
}
}
}

20
Packages/com.verasl.water-system/Shaders/Caustics.shader


_WaterLevel("WaterLevel", Float) = -0.25
_BlendDistance("BlendDistance", Float) = 0.1
//Vector1_CD857B77("CausticsRGB Split", Float) = 2
//Color blends
[HideInInspector] _SrcBlend("__src", Float) = 4.0
[HideInInspector] _DstBlend("__dst", Float) = 1.0
}
SubShader
{

//ZTest Always
Blend DstColor Zero, One Zero
Blend [_SrcBlend] [_DstBlend], One Zero
#pragma shader_feature _DEBUG
#pragma vertex vert
#pragma fragment frag

real depth = SAMPLE_DEPTH_TEXTURE( _CameraDepthTexture, sampler_CameraDepthTexture, screenPos.xy);
float3 worldPos = ReconstructWorldPos(screenPos.xy, depth);
float waveOffset = SAMPLE_TEXTURE2D(_CausticMap, sampler_CausticMap, worldPos.xz * 0.025 + _Time.x * 0.25).w - 0.5;
float2 uv = worldPos.xz * 0.025 + _Time.x * 0.25;
float waveOffset = SAMPLE_TEXTURE2D(_CausticMap, sampler_CausticMap, uv).w - 0.5;
float3 caustics = SAMPLE_TEXTURE2D(_CausticMap, sampler_CausticMap, causticUV).bbb;
float3 caustics = SAMPLE_TEXTURE2D_LOD(_CausticMap, sampler_CausticMap, causticUV, abs(worldPos.y - _WaterLevel) * 5 / _BlendDistance).bbb;
#ifdef _DEBUG
return half4(caustics * min(upperMask, lowerMask), 1);
#endif
//return half4(1, 0, 0, 1);
return half4(caustics + 1, 1);
}
ENDHLSL

/Assets/Shaders/UtilityGraphs/CliffShader.ShaderGraph.meta → /Assets/Shaders/CliffShader.ShaderGraph.meta

/Assets/Shaders/UtilityGraphs/CliffShader.ShaderGraph → /Assets/Shaders/CliffShader.ShaderGraph

正在加载...
取消
保存