Closes #81 Restaurant floor

This commit is contained in:
IDMhan 2023-12-14 23:58:32 +09:00
parent 3a4b65e947
commit 9986606b09
314 changed files with 202561 additions and 10333 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,207 @@
using System.Collections;
using System.Collections.Generic;
using BlueWaterProject.Type;
using PixelCrushers.DialogueSystem;
using UnityEngine;
using UnityEngine.InputSystem;
using DialogueSystemTrigger = PixelCrushers.DialogueSystem.Wrappers.DialogueSystemTrigger;
public class TycoonPlayer : MonoBehaviour
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
// Start is called before the first frame update
void Start()
[RequireComponent(typeof(Rigidbody))]
public class TycoonPlayer : MonoBehaviour
{
private float characterSpeed;
private Transform interactionTarget;
private Transform visualLook;
private Rigidbody rb;
//test character ani TODO : 나중에 스파인으로 바꾸고 삭제
public SpriteRenderer spriteRenderer;
public Sprite sideSprite;
public Sprite backSprite;
public Sprite frontSprite;
//test character ani
}
protected PlayerInput playerInput;
protected Vector2 movementInput;
public ProximitySelector ProximitySelector { get; set; }
// Update is called once per frame
void Update()
{
private void Init()
{
characterSpeed = 10;
visualLook = transform.Find("UnitRoot");
ProximitySelector = GetComponent<ProximitySelector>();
rb = GetComponent<Rigidbody>();
spriteRenderer = visualLook.GetComponent<SpriteRenderer>();
playerInput = GetComponent<PlayerInput>();
}
private void Awake()
{
Init();
}
private void Start()
{
ProximitySelector.enabled = false;
}
private void FixedUpdate()
{
MoveCharacterPlayer();
}
public void OnMove(InputValue value) // WASD
{
movementInput = value.Get<Vector2>();
}
private void OnMouse0(InputValue value)
{
}
private void OnInteraction(InputValue value)
{
}
private void OnCancel(InputValue value)
{
}
private void MoveCharacterPlayer()
{
var extraGravityForce = (Physics.gravity * rb.mass) * 2f;
rb.AddForce(extraGravityForce);
Vector3 movement = Vector3.zero;
movement = transform.rotation * new Vector3(movementInput.x, 0, movementInput.y) *
(characterSpeed * Time.deltaTime);
gameObject.transform.position += movement;
var localScale = visualLook.localScale;
// 왼쪽
if (movement.x < 0)
{
localScale.x = Mathf.Abs(localScale.x);
spriteRenderer.sprite = sideSprite;
}
// 오른쪽
else if (movement.x > 0)
{
localScale.x = -Mathf.Abs(localScale.x);
spriteRenderer.sprite = sideSprite;
}
// 뒤로
else if (movement.z > 0)
{
spriteRenderer.sprite = backSprite;
}
// 앞으로
else if (movement.z < 0)
{
spriteRenderer.sprite = frontSprite;
}
visualLook.localScale = localScale;
// var movement = transform.rotation * new Vector3(-movementInput.y, 0, movementInput.x) * (characterSpeed * Time.deltaTime);
// rb.MovePosition(rb.position + movement);
}
private IEnumerator MoveCharacterToPosition(Vector3 position, float scaleX)
{
var elapsedTime = 0f;
var duration = 1f; // 이동에 걸리는 시간 (초)
var startingPosition = transform.position;
// 방향 즉시 변경
visualLook.localScale = new Vector3(scaleX, visualLook.localScale.y, visualLook.localScale.z);
while (elapsedTime < duration)
{
transform.position = Vector3.Lerp(startingPosition, position, elapsedTime / duration);
elapsedTime += Time.deltaTime;
yield return null;
}
transform.position = position;
}
public void GotoShipDeck()
{
var point = GameManager.Inst.ShipPlayer.transform.Find("TeleportPoint");
transform.position = point.position;
}
public void StartInteraction(Transform target)
{
ProximitySelector.enabled = false;
interactionTarget = target;
interactionTarget.GetComponent<InShipNpc>()?.ChangeStateToInteraction();
var targetPosition = interactionTarget.position;
var playerPosition = transform.position;
var directionToTarget = (targetPosition - playerPosition).normalized;
// 캐릭터가 NPC의 왼쪽 또는 오른쪽에 있는지 확인
var crossProduct = Vector3.Cross(directionToTarget, transform.forward).y;
Vector3 desiredPosition;
float desiredScaleX; // 캐릭터의 방
if (crossProduct > 0) // 캐릭터가 NPC의 왼쪽에 있는 경우
{
desiredPosition = targetPosition + interactionTarget.right * 2f;
desiredScaleX = 1f; // 오른쪽을 바라봄
}
else // 캐릭터가 NPC의 오른쪽에 있는 경우
{
desiredPosition = targetPosition + interactionTarget.right * -2f;
desiredScaleX = -1f; // 왼쪽을 바라봄
}
// 장애물 감지
if (Physics.Raycast(playerPosition, (desiredPosition - playerPosition).normalized, Vector3.Distance(playerPosition, desiredPosition), LayerMask.GetMask("Obstacle")))
{
// 장애물이 감지되면, 반대쪽으로 이동
desiredPosition = crossProduct > 0 ? targetPosition + interactionTarget.right * -2f : targetPosition + interactionTarget.right * 2f;
desiredScaleX = -desiredScaleX; // 방향을 반전
}
// 캐릭터를 원하는 위치와 방향으로 부드럽게 이동 및 회전
StartCoroutine(MoveCharacterToPosition(desiredPosition, desiredScaleX));
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
}
public void StartConversation()
{
if (interactionTarget != null)
{
interactionTarget.GetComponent<DialogueSystemTrigger>().OnConversationStart(interactionTarget);
UiManager.Inst.InShipInteraction.gameObject.SetActive(false);
}
}
public void EndInteraction()
{
ProximitySelector.enabled = true;
interactionTarget.GetComponent<InShipNpc>()?.RestoreState();
}
public void EndConversation()
{
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d7c017c4be4fff94daca8578ebc3991f
guid: 2239a306bbee64ff49f9ef1b3eacbd3d
folderAsset: yes
DefaultImporter:
externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: ccc4fe16e36294b3994602b22defa4a1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b2b5c4b3b11cf664f92d82ad1f52ea3f
guid: 8467995d463174a0b9eaa8c8e2f9f18b
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -7,44 +7,32 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Material
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_Name: Hammer
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3050
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- SRPDEFAULTUNLIT
- DepthOnly
- SHADOWCASTER
RenderType: TransparentCutout
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: ccc4fe16e36294b3994602b22defa4a1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CelCurveTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CelStepTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@ -62,7 +50,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: ccc4fe16e36294b3994602b22defa4a1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
@ -96,92 +84,42 @@ Material:
m_Ints: []
m_Floats:
- _AlphaClip: 1
- _AlphaToMask: 0
- _Blend: 1
- _AlphaToMask: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _CameraDistanceImpact: 0
- _CelExtraEnabled: 0
- _CelNumSteps: 3
- _CelPrimaryMode: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FlatRimEdgeSmoothness: 0.5
- _FlatRimLightAlign: 0
- _FlatRimSize: 0.5
- _FlatSpecularEdgeSmoothness: 0
- _FlatSpecularSize: 0.1
- _Flatness: 1
- _FlatnessExtra: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _GradientAngle: 0
- _GradientCenterX: 0
- _GradientCenterY: 0
- _GradientEnabled: 0
- _GradientSize: 10
- _LightContribution: 0
- _LightFalloffSize: 0
- _LightmapDirectionPitch: 0
- _LightmapDirectionYaw: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _OutlineDepthOffset: 0
- _OutlineEnabled: 0
- _OutlineScale: 1
- _OutlineWidth: 1
- _OverrideLightmapDir: 0
- _Parallax: 0.005
- _QueueOffset: 50
- _QueueOffset: 0
- _ReceiveShadows: 1
- _RimEnabled: 0
- _SampleGI: 0
- _SelfShadingSize: 0.5
- _SelfShadingSizeExtra: 0.6
- _ShadowEdgeSize: 0.05
- _ShadowEdgeSizeExtra: 0.05
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularEnabled: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 1
- _TextureBlendingMode: 0
- _TextureImpact: 1
- _UnityShadowMode: 0
- _UnityShadowOcclusion: 0
- _UnityShadowPower: 0.2
- _UnityShadowSharpness: 1
- _VertexColorsEnabled: 0
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 0
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 0, b: 0.1404495, a: 1}
- _Color: {r: 1, g: 0, b: 0.14044946, a: 1}
- _ColorDim: {r: 0.7432748, g: 0.9150943, b: 0.038848326, a: 0.84313726}
- _ColorDimCurve: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
- _ColorDimExtra: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
- _ColorDimSteps: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
- _ColorGradient: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FlatRimColor: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _FlatSpecularColor: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _LightmapDirection: {r: 0, g: 1, b: 0, a: 0}
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _UnityShadowColor: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
m_BuildTextureStacks: []
--- !u!114 &5978755544101657664
--- !u!114 &8838058183107425683
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dc5e65b18f3e24503bc0014cc6d2fffe
guid: 6f3acab677b7f45eab0464e2ae2db716
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: df5110677ce394f5588fd8c8bf473444
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: 12
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: d08c8cd3647c646568aa26bf0a971b5b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: 12
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,34 +8,30 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: InShipFloor
m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3}
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _NORMALMAP
- _SURFACE_TYPE_TRANSPARENT
- _ALPHATEST_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3000
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: Transparent
RenderType: TransparentCutout
disabledShaderPasses:
- SRPDEFAULTUNLIT
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 1eca6f8276ae14713855e3238036f048, type: 3}
m_Scale: {x: 12, y: 4}
m_Texture: {fileID: 2800000, guid: d08c8cd3647c646568aa26bf0a971b5b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: f41bae6e3036a454f907faf63295aff4, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CelCurveTexture:
@ -67,8 +63,8 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1eca6f8276ae14713855e3238036f048, type: 3}
m_Scale: {x: 12, y: 4}
m_Texture: {fileID: 2800000, guid: d08c8cd3647c646568aa26bf0a971b5b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
@ -100,8 +96,8 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _AlphaClip: 1
- _AlphaToMask: 1
- _BaseMapPremultiply: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
@ -112,14 +108,14 @@ Material:
- _CelPrimaryMode: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailMapBlendingMode: 0
- _DetailMapImpact: 0
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FlatRimEdgeSmoothness: 0.5
- _FlatRimLightAlign: 0
@ -165,7 +161,7 @@ Material:
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 1
- _Surface: 0
- _TextureBlendingMode: 0
- _TextureImpact: 1
- _UnityShadowMode: 0
@ -174,7 +170,7 @@ Material:
- _UnityShadowSharpness: 1
- _VertexColorsEnabled: 0
- _WorkflowMode: 1
- _ZWrite: 0
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.764151, g: 0.764151, b: 0.764151, a: 1}
- _Color: {r: 0.764151, g: 0.764151, b: 0.764151, a: 1}

View File

@ -0,0 +1,138 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4699683836954726633
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Material 1
m_Shader: {fileID: -6465566751694194690, guid: e03227e46aac8bf4b88f2825417d00d2,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Vector1_1FFEA4D9: 10
- Vector1_3F7A129E: 10
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FADING: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Opacity: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 7d476d19bc658e34784926e0220faf57
guid: b70a911fa0b8b493b8ffd51f57dad18e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 60431f40c0e3b47a19dc69f418d720a0
guid: e6dad3da70c424125bb7863c9b94c8c9
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Rock1
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: df5110677ce394f5588fd8c8bf473444, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: df5110677ce394f5588fd8c8bf473444, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 1
- _AlphaToMask: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &7942972604738223078
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 3844da643c9d844259d02c8fa266eae8
guid: 0cd0c330f14034eb18a177b2524c3b6b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,314 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: StylizedWater2_DynamicEffectsDemo 1
m_Shader: {fileID: 482279110045391116, guid: d7b0192b9bf19c949900035fa781fdc4, type: 3}
m_ValidKeywords:
- _ADVANCED_SHADING
- _CAUSTICS
- _DISTANCE_NORMALS
- _FOAM
- _NORMALMAP
- _REFRACTION
- _TRANSLUCENCY
- _WAVES
m_InvalidKeywords:
- _DEPTHEXP_ON
- _VERTEXCOLORWAVEFLATTENING_ON
- _ZCLIP_ON
- _ZWRITE_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: ec6f0adef15b52448a82f3f183525d84, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapLarge:
m_Texture: {fileID: 2800000, guid: 88908a7c7a1f0ed418d1048378c17411, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapSlope:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CausticsTex:
m_Texture: {fileID: 2800000, guid: 36b7496f7c0078b49a44468d3e120e62, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DepthTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 2800000, guid: e91f048fea6b6b94eb864b2124843ce9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTexDynamic:
m_Texture: {fileID: 2800000, guid: 6a4aa5aa1ed7b9e4e9204a95f56f4d29, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: b8850342fb8b1e846ac3807e35ec1685, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normals:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflectionLeft:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Shadermap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Vector1_1942CF3A: 1
- Vector1_BE75C478: 32
- Vector1_E23F9E57: 0.5
- Vector1_E796673B: 10
- _ADVANCED_LIGHTING: 1
- _AdvancedLighting: 1
- _Advanced_Lighting: 1
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AnimationSpeed: 1
- _Blend: 0
- _BumpScale: 1
- _CROSSPAN_INTERSECTIONOn: 1
- _CausticsBrightness: 1
- _CausticsDistortion: 0.106
- _CausticsOn: 1
- _CausticsSpeed: 0.080000006
- _CausticsTiling: 0.2
- _ColorAbsorption: 0.002
- _CrossPan_IntersectionOn: 0
- _Cull: 0
- _Cutoff: 0.5
- _Depth: 0.94
- _DepthExp: 1
- _DepthHorizontal: 1
- _DepthMode: 0
- _DepthTexture: 1
- _DepthVertical: 4
- _DisableDepthTexture: 0
- _DistanceNormalsOn: 1
- _DistanceNormalsTiling: 0.050000004
- _DstBlend: 0
- _EdgeFade: 20
- _EnvironmentReflections: 1
- _EnvironmentReflectionsOn: 1
- _FlatShadingOn: 0
- _FlowSpeed: 1
- _FoamBaseAmount: 0.021
- _FoamClipping: 0
- _FoamDistortion: 1
- _FoamOn: 1
- _FoamOpacity: 0
- _FoamSize: 0.01
- _FoamSpeed: 0.01999994
- _FoamSpeedDynamic: 0.1
- _FoamSubSpeed: 0.1
- _FoamSubSpeedDynamic: -1
- _FoamSubTiling: 1.9300001
- _FoamSubTilingDynamic: 2
- _FoamTiling: 0.060000025
- _FoamTilingDynamic: 0.07000002
- _FoamWaveAmount: 2
- _FoamWaveMask: 0
- _FoamWaveMaskExp: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 10.4
- _IntersectionClipping: 0.395
- _IntersectionFalloff: 1
- _IntersectionLength: 2.27
- _IntersectionRippleDist: 16
- _IntersectionRippleStrength: 0.125
- _IntersectionSize: 0.944
- _IntersectionSource: 0
- _IntersectionSpeed: 0.06999999
- _IntersectionStyle: 0
- _IntersectionTiling: 0.13999975
- _IntersectionWaveDist: 33.28
- _LightingMode: 2
- _LightingOn: 1
- _Metallic: 0
- _Metallicness: 0.1
- _NORMALMAPOn: 1
- _NormalMap: 1
- _NormalMapOn: 1
- _NormalSpeed: 0.4
- _NormalStrength: 0.02
- _NormalSubSpeed: -0.1
- _NormalSubTiling: 0.5
- _NormalTiling: 0.4800001
- _OcclusionStrength: 1
- _PlanarReflectionsEnabled: 0
- _PlanarReflectionsParams: 0
- _PointSpotLightReflectionDistortion: 0.5
- _PointSpotLightReflectionExp: 64
- _PointSpotLightReflectionSize: 0
- _PointSpotLightReflectionStrength: 10
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReflectionBlur: 0
- _ReflectionDistortion: 0.393
- _ReflectionFresnel: 20
- _ReflectionLighting: 0
- _ReflectionStrength: 1
- _Reflectivity: 1
- _RefractionAmount: 0.05
- _RefractionChromaticAberration: 1
- _RefractionOn: 1
- _RefractionStrength: 0.315
- _RimRize: 1
- _RimTiling: 0.025
- _RiverModeOn: 0
- _SHARP_INERSECTIONOn: 1
- _ShadingMode: 1
- _ShadowStrength: 1
- _ShoreLineLength: 0
- _ShoreLineWaveDistance: 23
- _ShoreLineWaveStr: 1
- _SimpleLighting: 1
- _SlopeAngleFalloff: 25
- _SlopeAngleThreshold: 15
- _SlopeFoam: 1
- _SlopeSpeed: 4
- _SlopeStretching: 0.5
- _SlopeThreshold: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SparkleIntensity: 0
- _SparkleSize: 0
- _SpecularHighlights: 1
- _SpecularReflectionsOn: 1
- _Speed: 1
- _SrcBlend: 1
- _SunReflectionDistortion: 0.5
- _SunReflectionPerturbance: 0.386
- _SunReflectionSize: 0.755
- _SunReflectionStrength: 5
- _Surface: 0
- _TEXTURE_INTERSECTIONOn: 0
- _TessMax: 100
- _TessMin: 0
- _TessValue: 32
- _Texture_IntersectionOn: 1
- _Tiling: 0.5
- _Translucency: 1
- _TranslucencyCurvatureMask: 1
- _TranslucencyExp: 4
- _TranslucencyOn: 1
- _TranslucencyReflectionMask: 1
- _TranslucencyStrength: 0.36
- _TranslucencyStrengthDirect: 0.05
- _UnderwaterRefractionOffset: 0.2
- _UnderwaterSurfaceSmoothness: 0.8
- _VertexColorDepth: 0
- _VertexColorFoam: 0
- _VertexColorWaveFlattening: 1
- _WaveCount: 2
- _WaveDistance: 0.952
- _WaveHeight: 0.2
- _WaveNormalStr: 1
- _WaveSpeed: 2
- _WaveSteepness: 0
- _WaveTint: 0
- _WavesOn: 1
- _WorkflowMode: 1
- _WorldSpaceUV: 1
- _ZClip: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0.16451614, b: 0.34, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _DepthMapBounds: {r: -402.3, g: -459.43, b: 0.0012693577, a: 0}
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _DistanceNormalsFadeDist: {r: 0, g: 100, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 1, b: 1, a: 1}
- _HorizonColor: {r: 0.68, g: 1, b: 0.99, a: 0}
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _ShallowColor: {r: 0, g: 1, b: 0.9803922, a: 0}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _WaterColor: {r: 0.21176466, g: 0.6745098, b: 1, a: 1}
- _WaterShallowColor: {r: 0, g: 0.9394503, b: 1, a: 1}
- _WaveDirection: {r: 1, g: 1, b: 1, a: 1}
- _WaveFadeDistance: {r: 55.88745, g: 500, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!114 &6498140463000427223
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5fafa8676906446259d1790e3543945a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TyPlayer
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: c21e822c2c1ca418fa2695be70e90ddb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: c21e822c2c1ca418fa2695be70e90ddb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 1
- _AlphaToMask: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &2717827248994446342
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 250cc5fbcea5148d1a7fc950da6b463c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -261,10 +261,10 @@ Material:
- Color_1139F668: {r: 0, g: 0.6439421, b: 0.9921569, a: 0.38431373}
- Color_198818EE: {r: 0.341151, g: 0.5477178, b: 0.9245283, a: 0.79607844}
- Color_626750DD: {r: 2, g: 2, b: 2, a: 1}
- Color_77A2EDE9: {r: 32, g: 32, b: 32, a: 1}
- Vector2_1E1B6943: {r: 0, g: 0, b: 0, a: 0}
- Color_77A2EDE9: {r: 0, g: 13.712623, b: 29.019062, a: 1}
- Vector2_1E1B6943: {r: 5, g: 5, b: 5, a: 5}
- Vector2_D06E76BC: {r: 0.1, g: 0.05, b: 0, a: 0}
- Vector2_D26C9C89: {r: 0, g: 0, b: 0, a: 0}
- Vector2_D26C9C89: {r: 5, g: 5, b: 5, a: 5}
- Vector2_F678228C: {r: 0.5, g: 0.5, b: 0, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0, g: 1, b: 0.7287984, a: 1}

View File

@ -14,11 +14,13 @@ Material:
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ENVIRONMENTREFLECTIONS_OFF
- _FOAM
- _NORMALMAP
- _RECEIVE_SHADOWS_OFF
- _REFRACTION
- _SHARP_INERSECTION
- _SPECULARHIGHLIGHTS_OFF
- _UNLIT
- _WAVES
m_InvalidKeywords:
- ADVANCED_LIGHTING
- _CROSSPAN_INTERSECTION
@ -33,7 +35,7 @@ Material:
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_LockedProperties: _DepthVertical
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -69,6 +71,10 @@ Material:
m_Texture: {fileID: 2800000, guid: 2e10c404ec8e1ff41bff06b82e5569df, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTexDynamic:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: b8850342fb8b1e846ac3807e35ec1685, type: 3}
m_Scale: {x: 1, y: 1}
@ -109,6 +115,18 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Vector1_1942CF3A: 1
@ -129,6 +147,7 @@ Material:
- _CausticsOn: 0
- _CausticsSpeed: 0.1
- _CausticsTiling: 0.5
- _ColorAbsorption: 0
- _CrossPan_IntersectionOn: 0
- _Cull: 2
- _Cutoff: 0.5
@ -147,11 +166,21 @@ Material:
- _EnvironmentReflectionsOn: 0
- _FlatShadingOn: 0
- _FlowSpeed: 1
- _FoamOn: 1
- _FoamBaseAmount: 0.335
- _FoamClipping: 0
- _FoamDistortion: 0.1
- _FoamOn: 0
- _FoamOpacity: 0.253
- _FoamSize: 0.01
- _FoamSpeed: 0.030000014
- _FoamSpeedDynamic: 0.1
- _FoamSubSpeed: -0.25
- _FoamSubSpeedDynamic: -0.1
- _FoamSubTiling: 0.5
- _FoamSubTilingDynamic: 2
- _FoamTiling: 0.049999908
- _FoamTilingDynamic: 0.1
- _FoamWaveAmount: 0.61
- _FoamWaveMask: 0
- _FoamWaveMaskExp: 1
- _GlossMapScale: 0
@ -178,6 +207,8 @@ Material:
- _NormalMapOn: 1
- _NormalSpeed: 0.2
- _NormalStrength: 1
- _NormalSubSpeed: -0.5
- _NormalSubTiling: 0.5
- _NormalTiling: 0.29999992
- _OcclusionStrength: 1
- _PlanarReflectionsEnabled: 0
@ -196,7 +227,8 @@ Material:
- _ReflectionStrength: 0.248
- _Reflectivity: 1
- _RefractionAmount: 0.05
- _RefractionOn: 0
- _RefractionChromaticAberration: 1
- _RefractionOn: 1
- _RefractionStrength: 0.267
- _RimRize: 1
- _RimTiling: 0.025
@ -208,16 +240,18 @@ Material:
- _ShoreLineWaveDistance: 23
- _ShoreLineWaveStr: 1
- _SimpleLighting: 1
- _SlopeAngleFalloff: 25
- _SlopeAngleThreshold: 15
- _SlopeFoam: 1
- _SlopeSpeed: 4
- _SlopeStretching: 0.5
- _SlopeThreshold: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SparkleIntensity: 4.53
- _SparkleIntensity: 0
- _SparkleSize: 0.7
- _SpecularHighlights: 1
- _SpecularReflectionsOn: 1
- _SpecularReflectionsOn: 0
- _Speed: 1
- _SrcBlend: 1
- _SunReflectionDistortion: 0.49
@ -226,6 +260,9 @@ Material:
- _SunReflectionStrength: 3
- _Surface: 0
- _TEXTURE_INTERSECTIONOn: 0
- _TessMax: 15
- _TessMin: 0
- _TessValue: 16
- _Texture_IntersectionOn: 1
- _Tiling: 0.5
- _Translucency: 0
@ -234,25 +271,26 @@ Material:
- _TranslucencyOn: 0
- _TranslucencyReflectionMask: 0
- _TranslucencyStrength: 1
- _TranslucencyStrengthDirect: 0.05
- _UnderwaterRefractionOffset: 0.2
- _UnderwaterSurfaceSmoothness: 0.8
- _VertexColorDepth: 0
- _VertexColorFoam: 0
- _VertexColorWaveFlattening: 0
- _WaveCount: 5
- _WaveDistance: 0.509
- _WaveHeight: 5.48
- _WaveCount: 2
- _WaveDistance: 0.815
- _WaveHeight: 1
- _WaveNormalStr: 0.291
- _WaveSpeed: 1
- _WaveSteepness: 0
- _WaveTint: 0.029
- _WavesOn: 0
- _WavesOn: 1
- _WorkflowMode: 1
- _WorldSpaceUV: 1
- _ZClip: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0.36434606, b: 0.754717, a: 0.9647059}
- _BaseColor: {r: 0, g: 0.092688814, b: 0.14901961, a: 0.9647059}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _DepthMapBounds: {r: -402.3, g: -459.43, b: 0.0012693577, a: 0}
- _Direction: {r: 1, g: 1, b: 0, a: 0}

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 57d9676b747e04a54943269ac00aa478
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Demo/Demo.unity
uploadId: 630560

View File

@ -1,3 +0,0 @@
This demo scene is for the Built-in render pipeline.
For URP and HDRP demos look inside their respective folders.
You might have to toggle the SSCC component on the camera off and back on again.

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: ade6b4cfebd3fb848a02000f8e236d59
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Demo/Demo_Readme.txt
uploadId: 630560

View File

@ -1,333 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-9139891969420624701
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1
--- !u!114 &-6363685895679108359
MonoBehaviour:
m_ObjectHideFlags: 11
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 2
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Grey
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- DistortionVectors
- MOTIONVECTORS
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CoatMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AddPrecomputedVelocity: 0
- _AlbedoAffectEmissive: 0
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaCutoffPostpass: 0.5
- _AlphaCutoffPrepass: 0.5
- _AlphaCutoffShadow: 0.5
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _Anisotropy: 0
- _Blend: 0
- _BlendMode: 0
- _BumpScale: 1
- _CoatMask: 0
- _Cull: 2
- _CullMode: 2
- _CullModeForward: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalMapScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DiffusionProfile: 0
- _DiffusionProfileHash: 0
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 1
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 1
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EmissiveExposureWeight: 1
- _EmissiveIntensity: 1
- _EmissiveIntensityUnit: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnergyConservingSpecularColor: 1
- _EnvironmentReflections: 1
- _GlossMapScale: 1
- _Glossiness: 0.261
- _GlossyReflections: 1
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMapParametrization: 0
- _HeightMax: 1
- _HeightMin: -1
- _HeightOffset: 0
- _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5
- _InvTilingScale: 1
- _Ior: 1.5
- _IridescenceMask: 1
- _IridescenceThickness: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0
- _Mode: 0
- _NormalMapSpace: 0
- _NormalScale: 1
- _OcclusionStrength: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReceivesSSR: 1
- _RefractionModel: 0
- _SSRefractionProjectionModel: 0
- _Smoothness: 0.261
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SmoothnessTextureChannel: 0
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SpecularHighlights: 1
- _SpecularOcclusionMode: 1
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _Surface: 0
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _Thickness: 1
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVBase: 0
- _UVDetail: 0
- _UVEmissive: 0
- _UVSec: 0
- _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0
- _WorkflowMode: 1
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestModeDistortion: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.7519999, g: 0.7519999, b: 0.7519999, a: 1}
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.496, g: 0.496, b: 0.496, a: 1}
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}

View File

@ -1,15 +0,0 @@
fileFormatVersion: 2
guid: 8b69337571b906e4fa155f23ea29714f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Demo/Grey.mat
uploadId: 630560

View File

@ -1,29 +0,0 @@
Screen Space Cavity & Curvature v1.0
Created by Jolly Theory.
Email: jollytheorygames@gmail.com
-----
USAGE:
Built-in render pipeline:
1) Add SSCC component to your camera. Adjust settings. Done.
URP:
1) Make sure URP v7.1.8+ is installed, import URP.unitypackage by double clicking it.
2) Your URP Renderer asset > Renderer Features > add SSCCRenderFeature.
3) Make sure your UniversalRenderPipelineAsset's > Depth Texture is on. Or locally toggle in on in your camera.
4) Make sure your camera's > Post Processing is on.
5) Effect will now be enabled by default. You can add SSCC to your Post Process Volume to adjust settings. To disable the effect set Effect Intensity to zero. Done.
HDRP:
1) Make sure HDRP v7.1.8+ is installed, import HDRP.unitypackage by double clicking it.
2) Project Settings > HDRP Default Settings > Custom Post Process Orders (at the bottom) > After Opaque And Sky > add SSCC custom post process.
3) Effect will now be enabled by default. You can add SSCC to your Post Process Volume to adjust settings. To disable the effect set Effect Intensity to zero. Done.
----
TIPS:
- Use View Normals debug mode to see what objects are contributing their normals data to the effect,
if you have a custom shader and it does not show up in this view, you'll need to either add a Depth pass to it and use Reconstructed normals, or add a DepthNormals pass to it.
(Please consult Google on how to do this for your render pipeline.)
- If you want to exclude a certain object from being affected by the effect, take a look at the _SSCCTexture output mode (read its tooltip), and the "_SSCCTexture Examples" folder.

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 80618c7fb55148147b616bb1a96ad689
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/README.txt
uploadId: 630560

View File

@ -1,15 +0,0 @@
{
"name": "SSCC.Runtime",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"UNITY_2019_1_OR_NEWER"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 85820f79590499445879fb52e62eb068
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Runtime/SSCC.Runtime.asmdef
uploadId: 630560

View File

@ -1,441 +0,0 @@
using UnityEngine;
using UnityEngine.Rendering;
#if ENABLE_VR
using XRSettings = UnityEngine.XR.XRSettings;
#endif
#if UNITY_EDITOR
using UnityEditor;
#endif
using System;
using System.Collections.Generic;
using UnityEngine.Experimental.Rendering;
namespace ScreenSpaceCavityCurvature
{
[ExecuteInEditMode, ImageEffectAllowedInSceneView, AddComponentMenu("SSCC Screen Space Cavity Curvature")]
[RequireComponent(typeof(Camera))]
public class SSCC : MonoBehaviour
{
public enum PerPixelNormals { DeferredGBuffer, Camera, ReconstructedFromDepth }
public enum DebugMode { Disabled, EffectOnly, ViewNormals }
public enum CavitySamples { Low6, Medium8, High12, VeryHigh20 }
public enum CavityResolution { Full, [InspectorName("Half Upscaled")] HalfUpscaled, Half }
public enum OutputEffectTo { Screen, [InspectorName("_SSCCTexture in shaders")] _SSCCTexture }
[HideInInspector] public Shader ssccShader;
//
[Tooltip("Lerps the whole effect from 0 to 1.")] [Range(0f, 1f)] public float effectIntensity = 1f;
[Tooltip("Divides effect intensity by (depth * distanceFade).\nZero means effect doesn't fade with distance.")] [Range(0f, 1f)] public float distanceFade = 0f;
[Space(6)]
[Tooltip("The radius of curvature calculations in pixels.")] [Range(0, 4)] public int curvaturePixelRadius = 2;
[Tooltip("How bright does curvature get.")] [Range(0f, 5f)] public float curvatureBrights = 2f;
[Tooltip("How dark does curvature get.")] [Range(0f, 5f)] public float curvatureDarks = 3f;
[Space(6)]
[Tooltip("The amount of samples used for cavity calculation.")] public CavitySamples cavitySamples = CavitySamples.High12;
[Tooltip("True: Use pow() blending to make colors more saturated in bright/dark areas of cavity.\nFalse: Use additive blending.\n\nWarning: This option being enabled may mess with bloom post processing.")] public bool saturateCavity = true;
[Tooltip("The radius of cavity calculations in world units.")] [Range(0f, 0.5f)] public float cavityRadius = 0.25f;
[Tooltip("How bright does cavity get.")] [Range(0f, 5f)] public float cavityBrights = 3f;
[Tooltip("How dark does cavity get.")] [Range(0f, 5f)] public float cavityDarks = 2f;
[Tooltip("With this option enabled, cavity can be downsampled to massively improve performance at a cost to visual quality. Recommended for mobile platforms.\n\nNon-upscaled half may introduce aliasing.")] public CavityResolution cavityResolution = CavityResolution.Full;
[Space(6)]
[Tooltip("Where to get normals from.")] public PerPixelNormals normalsSource = PerPixelNormals.Camera;
[Tooltip("May be useful to check what objects contribute normals, as objects that do not contribute their normals will not contribute to the effect.")] public DebugMode debugMode = DebugMode.Disabled;
[Space(6)]
[Tooltip("Screen: Applies the effect over the entire screen.\n\n_SSCCTexture: Instead of writing the effect to the screen, will write the effect into a global shader texture named _SSCCTexture, so you can sample it selectively in your shaders and exclude certain objects from receiving outlines etc. See \"Output To Texture Examples\" folder for example shaders.")] public OutputEffectTo output = OutputEffectTo.Screen;
//
void CheckParameters()
{
if (GraphicsSettings.renderPipelineAsset != null)
{
Debug.LogWarning("Please follow the SRP usage instructions.");
enabled = false;
}
ssccCamera.depthTextureMode |= DepthTextureMode.Depth;
if (normalsSource == PerPixelNormals.Camera) ssccCamera.depthTextureMode |= DepthTextureMode.DepthNormals;
if (ssccCamera.actualRenderingPath != RenderingPath.DeferredShading && normalsSource == PerPixelNormals.DeferredGBuffer) normalsSource = PerPixelNormals.Camera;
if (stereoActive && ssccCamera.actualRenderingPath != RenderingPath.DeferredShading && normalsSource != PerPixelNormals.ReconstructedFromDepth) normalsSource = PerPixelNormals.ReconstructedFromDepth;
if (output == OutputEffectTo._SSCCTexture && ssccCamera.actualRenderingPath == RenderingPath.DeferredShading) normalsSource = PerPixelNormals.ReconstructedFromDepth; //cant get correct normals texture in deferred
}
OutputEffectTo Output => debugMode != DebugMode.Disabled ? OutputEffectTo.Screen : output;
static class Pass
{
public const int Copy = 0;
public const int GenerateCavity = 1;
public const int HorizontalBlur = 2;
public const int VerticalBlur = 3;
public const int Final = 4;
}
static class ShaderProperties
{
public static int mainTex = Shader.PropertyToID("_MainTex");
public static int cavityTex = Shader.PropertyToID("_CavityTex");
public static int cavityTex1 = Shader.PropertyToID("_CavityTex1");
public static int tempTex = Shader.PropertyToID("_TempTex");
public static int uvTransform = Shader.PropertyToID("_UVTransform");
public static int inputTexelSize = Shader.PropertyToID("_Input_TexelSize");
public static int cavityTexTexelSize = Shader.PropertyToID("_CavityTex_TexelSize");
public static int worldToCameraMatrix = Shader.PropertyToID("_WorldToCameraMatrix");
//public static int uvToView = Shader.PropertyToID("_UVToView");
public static int effectIntensity = Shader.PropertyToID("_EffectIntensity");
public static int distanceFade = Shader.PropertyToID("_DistanceFade");
public static int curvaturePixelRadius = Shader.PropertyToID("_CurvaturePixelRadius");
public static int curvatureRidge = Shader.PropertyToID("_CurvatureBrights");
public static int curvatureValley = Shader.PropertyToID("_CurvatureDarks");
public static int cavityWorldRadius = Shader.PropertyToID("_CavityWorldRadius");
public static int cavityRidge = Shader.PropertyToID("_CavityBrights");
public static int cavityValley = Shader.PropertyToID("_CavityDarks");
public static int globalSSCCTexture = Shader.PropertyToID("_SSCCTexture");
}
Material mat;
Camera ssccCamera;
CommandBuffer cmdBuffer;
int width;
int height;
bool stereoActive;
XRSettings.StereoRenderingMode stereoRenderingMode;
int screenWidth;
int screenHeight;
CameraEvent cameraEvent => Output == OutputEffectTo.Screen ? CameraEvent.BeforeImageEffectsOpaque : CameraEvent.BeforeForwardOpaque;
CameraEvent[] possibleCameraEvents = new[] { CameraEvent.BeforeImageEffectsOpaque, CameraEvent.BeforeForwardOpaque };
Mesh fullscreenTriangle
{
get
{
if (m_FullscreenTriangle != null) return m_FullscreenTriangle;
m_FullscreenTriangle = new Mesh { name = "Fullscreen Triangle" };
m_FullscreenTriangle.SetVertices(new List<Vector3> { new Vector3(-1f, -1f, 0f), new Vector3(-1f, 3f, 0f), new Vector3(3f, -1f, 0f) });
m_FullscreenTriangle.SetIndices(new[] { 0, 1, 2 }, MeshTopology.Triangles, 0, false);
m_FullscreenTriangle.UploadMeshData(false);
return m_FullscreenTriangle;
}
}
bool isCommandBufferDirty
{
get
{
if (m_PreviousCameraEvent != cameraEvent || m_IsCommandBufferDirty || m_PreviousDebugMode != debugMode || m_PreviousWidth != width || m_PreviousHeight != height || m_PreviousRenderingPath != ssccCamera.actualRenderingPath || m_PreviousOutputEffectTo != Output || m_PreviousCavityResolution != cavityResolution)
{
m_PreviousCameraEvent = cameraEvent; m_PreviousDebugMode = debugMode; m_PreviousWidth = width; m_PreviousHeight = height; m_PreviousRenderingPath = ssccCamera.actualRenderingPath; m_PreviousOutputEffectTo = Output; m_PreviousCavityResolution = cavityResolution;
return true;
}
return false;
}
set
{
m_IsCommandBufferDirty = value;
}
}
RenderTextureDescriptor m_sourceDescriptor;
bool m_IsCommandBufferDirty;
Mesh m_FullscreenTriangle;
CameraEvent m_PreviousCameraEvent;
DebugMode? m_PreviousDebugMode;
int m_PreviousWidth;
int m_PreviousHeight;
RenderingPath m_PreviousRenderingPath;
OutputEffectTo m_PreviousOutputEffectTo;
CavityResolution m_PreviousCavityResolution;
static RenderTextureFormat defaultHDRRenderTextureFormat
{
get
{
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR
RenderTextureFormat format = RenderTextureFormat.RGB111110Float;
#if UNITY_EDITOR
var target = EditorUserBuildSettings.activeBuildTarget;
if (target != BuildTarget.Android && target != BuildTarget.iOS && target != BuildTarget.tvOS && target != BuildTarget.Switch)
return RenderTextureFormat.DefaultHDR;
#endif
if (SystemInfo.SupportsRenderTextureFormat(format))
return format;
#endif
return RenderTextureFormat.DefaultHDR;
}
}
RenderTextureFormat sourceFormat { get { return ssccCamera.allowHDR ? defaultHDRRenderTextureFormat : RenderTextureFormat.Default; } }
static RenderTextureFormat colorFormat { get { return SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.Default; } }
void OnEnable()
{
if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
Debug.LogWarning("SSCC shader is not supported on this platform.");
this.enabled = false;
return;
}
if (ssccShader == null) ssccShader = Shader.Find("Hidden/SSCC");
if (ssccShader == null)
{
Debug.LogError("SSCC shader was not found...");
return;
}
if (!ssccShader.isSupported)
{
Debug.LogWarning("SSCC shader is not supported on this platform.");
this.enabled = false;
return;
}
Initialize();
}
void OnDisable()
{
ClearCommandBuffer(cmdBuffer);
if (mat != null)
DestroyImmediate(mat);
if (fullscreenTriangle != null)
DestroyImmediate(fullscreenTriangle);
}
void OnPreRender()
{
if (ssccShader == null || ssccCamera == null) return;
FetchRenderParameters();
CheckParameters();
UpdateMaterialProperties();
UpdateShaderKeywords();
if (isCommandBufferDirty)
{
ClearCommandBuffer(cmdBuffer);
BuildCommandBuffer(cmdBuffer);
ssccCamera.AddCommandBuffer(cameraEvent, cmdBuffer);
isCommandBufferDirty = false;
}
}
void OnValidate()
{
if (ssccShader == null || ssccCamera == null) return;
CheckParameters();
}
void Initialize()
{
m_sourceDescriptor = new RenderTextureDescriptor(0, 0);
ssccCamera = GetComponent<Camera>();
ssccCamera.forceIntoRenderTexture = true;
mat = new Material(ssccShader);
mat.hideFlags = HideFlags.HideAndDontSave;
cmdBuffer = new CommandBuffer { name = "SSCC" };
isCommandBufferDirty = true;
}
void FetchRenderParameters()
{
#if !UNITY_SWITCH && ENABLE_VR
if (ssccCamera.stereoEnabled)
{
var xrDesc = XRSettings.eyeTextureDesc;
stereoRenderingMode = XRSettings.StereoRenderingMode.SinglePass;
if (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.MultiPass)
stereoRenderingMode = XRSettings.StereoRenderingMode.MultiPass;
#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_PS4
if (xrDesc.dimension == TextureDimension.Tex2DArray)
stereoRenderingMode = XRSettings.StereoRenderingMode.SinglePassInstanced;
#endif
if (stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePass)
{
//xrDesc.width /= 2;
xrDesc.vrUsage = VRTextureUsage.None;
}
width = xrDesc.width;
height = xrDesc.height;
m_sourceDescriptor = xrDesc;
screenWidth = XRSettings.eyeTextureWidth;
screenHeight = XRSettings.eyeTextureHeight;
if (stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePass)
screenWidth /= 2;
stereoActive = true;
}
else
#endif
{
width = ssccCamera.pixelWidth;
height = ssccCamera.pixelHeight;
m_sourceDescriptor.width = width;
m_sourceDescriptor.height = height;
screenWidth = width;
screenHeight = height;
stereoActive = false;
}
}
void ClearCommandBuffer(CommandBuffer cmd)
{
if (cmd != null)
{
//if (ssccCamera != null) ssccCamera.RemoveCommandBuffer(cameraEvent, cmd);
if (ssccCamera != null) foreach (var camEvent in possibleCameraEvents) ssccCamera.RemoveCommandBuffer(camEvent, cmd);
cmd.Clear();
}
}
void BuildCommandBuffer(CommandBuffer cmd)
{
cmd.SetGlobalVector(ShaderProperties.uvTransform, SystemInfo.graphicsUVStartsAtTop ? new Vector4(1f, -1f, 0f, 1f) : new Vector4(1f, 1f, 0f, 0f));
int div = cavityResolution == CavityResolution.Full ? 1 : cavityResolution == CavityResolution.HalfUpscaled ? 2 : 2;
cmd.GetTemporaryRT(ShaderProperties.cavityTex, width / div, height / div, 0, FilterMode.Bilinear, GraphicsFormat.R32G32B32A32_SFloat);
cmd.GetTemporaryRT(ShaderProperties.cavityTex1, width / div, height / div, 0, FilterMode.Bilinear, GraphicsFormat.R32G32B32A32_SFloat);
Render(ShaderProperties.cavityTex, cmd, mat, Pass.GenerateCavity);
if (Output == OutputEffectTo._SSCCTexture)
{
cmd.ReleaseTemporaryRT(ShaderProperties.globalSSCCTexture);
cmd.GetTemporaryRT(ShaderProperties.globalSSCCTexture, width, height, 0, FilterMode.Bilinear, GraphicsFormat.R16G16B16A16_SFloat);
cmd.SetGlobalTexture(ShaderProperties.globalSSCCTexture, new RenderTargetIdentifier(ShaderProperties.globalSSCCTexture));
Render(ShaderProperties.globalSSCCTexture, cmd, mat, Pass.Final);
}
else
{
cmd.SetGlobalTexture(ShaderProperties.globalSSCCTexture, BuiltinRenderTextureType.None);
GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, colorFormat: sourceFormat);
if (stereoActive && ssccCamera.actualRenderingPath != RenderingPath.DeferredShading)
cmd.Blit(BuiltinRenderTextureType.CameraTarget, ShaderProperties.tempTex);
else
RenderWith(BuiltinRenderTextureType.CameraTarget, ShaderProperties.tempTex, cmd, mat, Pass.Copy);
RenderWith(ShaderProperties.tempTex, BuiltinRenderTextureType.CameraTarget, cmd, mat, Pass.Final);
cmd.ReleaseTemporaryRT(ShaderProperties.tempTex);
}
cmd.ReleaseTemporaryRT(ShaderProperties.cavityTex);
cmd.ReleaseTemporaryRT(ShaderProperties.cavityTex1);
}
void UpdateMaterialProperties()
{
//float tanHalfFovY = Mathf.Tan(0.5f * ssccCamera.fieldOfView * Mathf.Deg2Rad);
//float invFocalLenX = 1.0f / (1.0f / tanHalfFovY * (screenHeight / (float)screenWidth));
//float invFocalLenY = 1.0f / (1.0f / tanHalfFovY);
//mat.SetVector(ShaderProperties.uvToView, new Vector4(2.0f * invFocalLenX, -2.0f * invFocalLenY, -1.0f * invFocalLenX, 1.0f * invFocalLenY));
mat.SetVector(ShaderProperties.inputTexelSize, new Vector4(1f / width, 1f / height, width, height));
int div = cavityResolution == SSCC.CavityResolution.Full ? 1 : cavityResolution == SSCC.CavityResolution.HalfUpscaled ? 2 : 2;
mat.SetVector(ShaderProperties.cavityTexTexelSize, new Vector4(1f / (width / div), 1f / (height / div), width / div, height / div));
mat.SetMatrix(ShaderProperties.worldToCameraMatrix, ssccCamera.worldToCameraMatrix);
mat.SetFloat(ShaderProperties.effectIntensity, effectIntensity);
mat.SetFloat(ShaderProperties.distanceFade, distanceFade);
mat.SetFloat(ShaderProperties.curvaturePixelRadius, new float[] { 0f, 0.5f, 1f, 1.5f, 2.5f }[curvaturePixelRadius]);
mat.SetFloat(ShaderProperties.curvatureRidge, curvatureBrights == 0f ? 999f : (5f - curvatureBrights));
mat.SetFloat(ShaderProperties.curvatureValley, curvatureDarks == 0f ? 999f : (5f - curvatureDarks));
mat.SetFloat(ShaderProperties.cavityWorldRadius, cavityRadius);
mat.SetFloat(ShaderProperties.cavityRidge, cavityBrights * 2f);
mat.SetFloat(ShaderProperties.cavityValley, cavityDarks * 2f);
}
void UpdateShaderKeywords()
{
mat.shaderKeywords = new string[]
{
ssccCamera.orthographic ? "ORTHOGRAPHIC_PROJECTION" : "__",
debugMode == DebugMode.EffectOnly ? "DEBUG_EFFECT" : debugMode == DebugMode.ViewNormals ? "DEBUG_NORMALS" : "__",
normalsSource == PerPixelNormals.Camera ? "NORMALS_CAMERA" : normalsSource == PerPixelNormals.ReconstructedFromDepth ? "NORMALS_RECONSTRUCT" : "__",
cavitySamples == CavitySamples.Low6 ? "CAVITY_SAMPLES_6" : cavitySamples == CavitySamples.Medium8 ? "CAVITY_SAMPLES_8" : cavitySamples == CavitySamples.High12 ? "CAVITY_SAMPLES_12" : cavitySamples == CavitySamples.VeryHigh20 ? "CAVITY_SAMPLES_20" : "",
saturateCavity ? "SATURATE_CAVITY" : "__",
Output == OutputEffectTo._SSCCTexture ? "OUTPUT_TO_TEXTURE" : "__",
cavityResolution == CavityResolution.HalfUpscaled ? "UPSCALE_CAVITY" : "__"
};
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RenderTextureDescriptor GetDefaultDescriptor(int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default)
{
var modifiedDesc = new RenderTextureDescriptor(m_sourceDescriptor.width, m_sourceDescriptor.height, m_sourceDescriptor.colorFormat, depthBufferBits);
modifiedDesc.dimension = m_sourceDescriptor.dimension;
modifiedDesc.volumeDepth = m_sourceDescriptor.volumeDepth;
modifiedDesc.vrUsage = m_sourceDescriptor.vrUsage;
modifiedDesc.msaaSamples = m_sourceDescriptor.msaaSamples;
modifiedDesc.memoryless = m_sourceDescriptor.memoryless;
modifiedDesc.useMipMap = m_sourceDescriptor.useMipMap;
modifiedDesc.autoGenerateMips = m_sourceDescriptor.autoGenerateMips;
modifiedDesc.enableRandomWrite = m_sourceDescriptor.enableRandomWrite;
modifiedDesc.shadowSamplingMode = m_sourceDescriptor.shadowSamplingMode;
if (ssccCamera.allowDynamicResolution)
modifiedDesc.useDynamicScale = true; //IF YOU ARE GETTING AN ERROR HERE, UNFORTUNATELY YOUR UNITY VERSION IS TOO LOW FOR THIS ASSET
if (colorFormat != RenderTextureFormat.Default) modifiedDesc.colorFormat = colorFormat;
if (readWrite == RenderTextureReadWrite.sRGB) modifiedDesc.sRGB = true;
else if (readWrite == RenderTextureReadWrite.Linear) modifiedDesc.sRGB = false;
else if (readWrite == RenderTextureReadWrite.Default) modifiedDesc.sRGB = QualitySettings.activeColorSpace == ColorSpace.Linear;
return modifiedDesc;
}
void GetScreenSpaceTemporaryRT(CommandBuffer cmd, int nameID, int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, FilterMode filter = FilterMode.Bilinear, int widthOverride = 0, int heightOverride = 0)
{
var desc = GetDefaultDescriptor(depthBufferBits, colorFormat, readWrite);
if (widthOverride > 0) desc.width = widthOverride;
if (heightOverride > 0) desc.height = heightOverride;
if (stereoActive && desc.dimension == TextureDimension.Tex2DArray) desc.dimension = TextureDimension.Tex2D;
cmd.GetTemporaryRT(nameID, desc, filter);
}
void RenderWith(RenderTargetIdentifier source, RenderTargetIdentifier destination, CommandBuffer cmd, Material material, int pass = 0)
{
cmd.SetGlobalTexture(ShaderProperties.mainTex, source);
cmd.SetRenderTarget(destination);
cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, material, 0, pass);
}
void Render(RenderTargetIdentifier destination, CommandBuffer cmd, Material material, int pass = 0)
{
cmd.SetRenderTarget(destination);
cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, material, 0, pass);
}
}
}

View File

@ -1,19 +0,0 @@
fileFormatVersion: 2
guid: 1d35af20b508d5546ba80581bc1b979a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- ssccShader: {fileID: 4800000, guid: 89ec5ce1bd95ed946a65b649164a9c1d, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Runtime/SSCC.cs
uploadId: 630560

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 7dd73fb2fec8fb642be983cf08cfd6b1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/SRP/HDRP.unitypackage
uploadId: 630560

View File

@ -1,16 +0,0 @@
From README.txt:
...
USAGE:
URP:
1) Make sure URP v7.1.8+ is installed, import URP.unitypackage by double clicking it.
2) Your URP Renderer asset > Renderer Features > add SSCCRenderFeature.
3) Make sure your UniversalRenderPipelineAsset's > Depth Texture is on. Or locally toggle in on in your camera.
4) Make sure your camera's > Post Processing is on.
5) Effect will now be enabled by default. You can add SSCC to your Post Process Volume to adjust settings. To disable the effect set Effect Intensity to zero. Done.
HDRP:
1) Make sure HDRP v7.1.8+ is installed, import HDRP.unitypackage by double clicking it.
2) Project Settings > HDRP Default Settings > Custom Post Process Orders (at the bottom) > After Opaque And Sky > add SSCC custom post process.
3) Effect will now be enabled by default. You can add SSCC to your Post Process Volume to adjust settings. To disable the effect set Effect Intensity to zero. Done.

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: a4f2c4eda6a6d854386932e5059c70f4
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/SRP/README HDRP & URP.txt
uploadId: 630560

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1cc168b4bbd03cb409a2574f94bffca0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 1c45d0aac2834f14db81b11cdbcec705
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/SRP/URP.unitypackage
uploadId: 630560

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ceb044e4471ba614b990f738cc991e8d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,68 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
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: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: DemoVolume_URP
m_EditorClassIdentifier:
components:
- {fileID: 6698968451673211470}
--- !u!114 &6698968451673211470
MonoBehaviour:
m_ObjectHideFlags: 3
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: d468b943de483f641a8eb80fcd52e584, type: 3}
m_Name: SSCC
m_EditorClassIdentifier:
active: 1
effectIntensity:
m_OverrideState: 1
m_Value: 1
distanceFade:
m_OverrideState: 1
m_Value: 0
curvaturePixelRadius:
m_OverrideState: 1
m_Value: 2
curvatureBrights:
m_OverrideState: 1
m_Value: 2
curvatureDarks:
m_OverrideState: 1
m_Value: 3
cavitySamples:
m_OverrideState: 1
m_Value: 2
saturateCavity:
m_OverrideState: 1
m_Value: 1
cavityRadius:
m_OverrideState: 1
m_Value: 0.25
cavityBrights:
m_OverrideState: 1
m_Value: 3
cavityDarks:
m_OverrideState: 1
m_Value: 2
normalsSource:
m_OverrideState: 1
m_Value: 1
debugMode:
m_OverrideState: 1
m_Value: 0
output:
m_OverrideState: 1
m_Value: 0

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d16d1fb8798b3ad40a771b9f3856c197
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,361 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-9139891969420624701
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!114 &-3737353351393463922
MonoBehaviour:
m_ObjectHideFlags: 11
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 2
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Grey_URP
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
- DistortionVectors
- MOTIONVECTORS
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CoatMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AddPrecomputedVelocity: 0
- _AlbedoAffectEmissive: 0
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaCutoffPostpass: 0.5
- _AlphaCutoffPrepass: 0.5
- _AlphaCutoffShadow: 0.5
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _Anisotropy: 0
- _Blend: 0
- _BlendMode: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _CavityMultiplier: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _CoatMask: 0
- _Cull: 2
- _CullMode: 2
- _CullModeForward: 2
- _CurvatureMultiplier: 1
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoMapScale: 1
- _DetailAlbedoScale: 1
- _DetailNormalMapScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DiffusionProfile: 0
- _DiffusionProfileHash: 0
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 1
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 1
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EmissiveColorMode: 1
- _EmissiveExposureWeight: 1
- _EmissiveIntensity: 1
- _EmissiveIntensityUnit: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnergyConservingSpecularColor: 1
- _EnvironmentReflections: 1
- _GlossMapScale: 1
- _Glossiness: 0.261
- _GlossyReflections: 1
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMapParametrization: 0
- _HeightMax: 1
- _HeightMin: -1
- _HeightOffset: 0
- _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5
- _InvTilingScale: 1
- _Ior: 1.5
- _IridescenceMask: 1
- _IridescenceThickness: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0
- _Mode: 0
- _NormalMapSpace: 0
- _NormalScale: 1
- _OcclusionStrength: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ReceivesSSR: 1
- _RefractionModel: 0
- _SSRefractionProjectionModel: 0
- _Smoothness: 0.261
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SmoothnessTextureChannel: 0
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SpecularHighlights: 1
- _SpecularOcclusionMode: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _Surface: 0
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _Thickness: 1
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVBase: 0
- _UVDetail: 0
- _UVEmissive: 0
- _UVSec: 0
- _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0
- _WorkflowMode: 1
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestModeDistortion: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.504, g: 0.504, b: 0.504, a: 1}
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.504, g: 0.504, b: 0.504, a: 1}
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b1c5eca1b4c8d52469ef0633cc25e44b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +0,0 @@
{
"name": "SSCC.Universal.Runtime",
"references": [
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:15fc0a57446b3144c949da3e2b9737a9"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"UNITY_2019_3_OR_NEWER"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "10.0.0-preview",
"define": "URP_10_0_0_OR_NEWER"
}
],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d677d4c7cb4775748ba9aec34639fc81
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,80 +0,0 @@
//#define URP_10_0_0_OR_NEWER
//#define UNITY_2021_2_OR_NEWER
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace ScreenSpaceCavityCurvature.Universal
{
[ExecuteInEditMode, VolumeComponentMenu("ScreenSpaceCavityCurvature")]
public class SSCC : VolumeComponent, IPostProcessComponent
{
public enum PerPixelNormals
{
ReconstructedFromDepth,
#if URP_10_0_0_OR_NEWER
Camera
#else
Camera_URP_VER_TOO_LOW
#endif
}
public enum DebugMode { Disabled, EffectOnly, ViewNormals }
public enum CavitySamples { Low6, Medium8, High12 }
public enum OutputEffectTo
{
Screen,
#if URP_10_0_0_OR_NEWER
[InspectorName("_SSCCTexture in shaders")] _SSCCTexture
#else
[InspectorName("_SSCCTexture (URP 10+)")] _SSCCTexture
#endif
}
[Serializable] public sealed class DebugModeParameter : VolumeParameter<DebugMode> { public DebugModeParameter(DebugMode value, bool overrideState = false) : base(value, overrideState) { } }
[Serializable] public sealed class GetNormalsFromParameter : VolumeParameter<PerPixelNormals> { public GetNormalsFromParameter(PerPixelNormals value, bool overrideState = false) : base(value, overrideState) { } }
[Serializable] public sealed class CavitySamplesParameter : VolumeParameter<CavitySamples> { public CavitySamplesParameter(CavitySamples value, bool overrideState = false) : base(value, overrideState) { } }
[Serializable] public sealed class OutputParameter : VolumeParameter<OutputEffectTo> { public OutputParameter(OutputEffectTo value, bool overrideState = false) : base(value, overrideState) { } }
//
[Header("(Make sure Post Processing and Depth Texture are enabled.)")]
[Tooltip("Lerps the whole effect from 0 to 1.")] public ClampedFloatParameter effectIntensity = new ClampedFloatParameter(1f, 0f, 1f);
[Tooltip("Divides effect intensity by (depth * distanceFade).\nZero means effect doesn't fade with distance.")] public ClampedFloatParameter distanceFade = new ClampedFloatParameter(0f, 0f, 1f);
[Space(6)]
[Tooltip("The radius of curvature calculations in pixels.")] public ClampedIntParameter curvaturePixelRadius = new ClampedIntParameter(2, 0, 4);
[Tooltip("How bright does curvature get.")] public ClampedFloatParameter curvatureBrights = new ClampedFloatParameter(2f, 0f, 5f);
[Tooltip("How dark does curvature get.")] public ClampedFloatParameter curvatureDarks = new ClampedFloatParameter(3f, 0f, 5f);
[Space(6)]
[Tooltip("The amount of samples used for cavity calculation.")] public CavitySamplesParameter cavitySamples = new CavitySamplesParameter(CavitySamples.High12);
[Tooltip("True: uses pow() blending to make colors more saturated in bright/dark areas of cavity.\n\nFalse: uses additive blending.")] public BoolParameter saturateCavity = new BoolParameter(true);
[Tooltip("The radius of cavity calculations in world units.")] public ClampedFloatParameter cavityRadius = new ClampedFloatParameter(0.25f, 0f, 0.5f);
[Tooltip("How bright does cavity get.")] public ClampedFloatParameter cavityBrights = new ClampedFloatParameter(3f, 0f, 5f);
[Tooltip("How dark does cavity get.")] public ClampedFloatParameter cavityDarks = new ClampedFloatParameter(2f, 0f, 5f);
[Space(6)]
[Tooltip("Where to get normals from.")]
#if URP_10_0_0_OR_NEWER
public GetNormalsFromParameter normalsSource = new GetNormalsFromParameter(PerPixelNormals.Camera);
#else
public GetNormalsFromParameter normalsSource = new GetNormalsFromParameter(PerPixelNormals.ReconstructedFromDepth);
#endif
[Tooltip("May be useful to check what objects contribute normals, as objects that do not contribute their normals will not contribute to the effect.")] public DebugModeParameter debugMode = new DebugModeParameter(DebugMode.Disabled);
[Space(6)]
[Tooltip("Screen: Applies the effect over the entire screen.\n\n_SSCCTexture: Instead of writing the effect to the screen, will write the effect into a global shader texture named _SSCCTexture, so you can sample it selectively in your shaders and exclude certain objects from receiving outlines etc. See \"Output To Texture Examples\" folder for example shaders.")] public OutputParameter output = new OutputParameter(OutputEffectTo.Screen);
//
//public bool IsActive() => true;
public bool IsActive() => effectIntensity.value > 0f;
public bool IsTileCompatible() => true;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d468b943de483f641a8eb80fcd52e584
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,329 +0,0 @@
//#define URP_10_0_0_OR_NEWER
//#define UNITY_2021_2_OR_NEWER
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace ScreenSpaceCavityCurvature.Universal
{
public class SSCCRendererFeature : ScriptableRendererFeature
{
private class SSCCRenderPass : ScriptableRenderPass
{
void CheckParameters()
{
#if !URP_10_0_0_OR_NEWER
if (sscc.normalsSource.value == SSCC.PerPixelNormals.Camera_URP_VER_TOO_LOW)
{
sscc.normalsSource.value = SSCC.PerPixelNormals.ReconstructedFromDepth;
Debug.LogWarning("URP version too low for Camera based normals, only available in URP 10+ (Unity 2020+).");
}
if (sscc.output.value == SSCC.OutputEffectTo._SSCCTexture)
{
sscc.output.value = SSCC.OutputEffectTo.Screen;
Debug.LogWarning("URP version too low for texture output mode, only available in URP 10+ (Unity 2020+).");
}
#endif
}
SSCC.OutputEffectTo Output => sscc.debugMode.value != SSCC.DebugMode.Disabled ? SSCC.OutputEffectTo.Screen : sscc.output.value;
public SSCC sscc;
static class Pass
{
public const int Copy = 0;
public const int Composite = 1;
}
static class ShaderProperties
{
public static int mainTex = Shader.PropertyToID("_MainTex");
public static int tempTex = Shader.PropertyToID("_TempTex");
public static int uvTransform = Shader.PropertyToID("_UVTransform");
public static int inputTexelSize = Shader.PropertyToID("_Input_TexelSize");
public static int uvToView = Shader.PropertyToID("_UVToView");
public static int worldToCameraMatrix = Shader.PropertyToID("_WorldToCameraMatrix");
public static int effectIntensity = Shader.PropertyToID("_EffectIntensity");
public static int distanceFade = Shader.PropertyToID("_DistanceFade");
public static int curvaturePixelRadius = Shader.PropertyToID("_CurvaturePixelRadius");
public static int curvatureRidge = Shader.PropertyToID("_CurvatureBrights");
public static int curvatureValley = Shader.PropertyToID("_CurvatureDarks");
public static int cavityWorldRadius = Shader.PropertyToID("_CavityWorldRadius");
public static int cavityRidge = Shader.PropertyToID("_CavityBrights");
public static int cavityValley = Shader.PropertyToID("_CavityDarks");
public static int globalSSCCTexture = Shader.PropertyToID("_SSCCTexture");
}
Material material { get; set; }
RenderTargetIdentifier source { get; set; }
CameraData cameraData { get; set; }
RenderTextureDescriptor sourceDesc { get; set; }
public void Setup(Shader shader, ScriptableRenderer renderer, RenderingData renderingData)
{
if (material == null) material = CoreUtils.CreateEngineMaterial(shader);
#if !URP_10_0_0_OR_NEWER
source = renderer.cameraColorTarget;
cameraData = renderingData.cameraData;
FetchVolumeComponent();
renderPassEvent = Output == SSCC.OutputEffectTo.Screen ? RenderPassEvent.BeforeRenderingTransparents : RenderPassEvent.BeforeRenderingOpaques;
#endif
}
#if URP_10_0_0_OR_NEWER
#if UNITY_2022_1_OR_NEWER
static RTHandle noneRTHandle = RTHandles.Alloc(BuiltinRenderTextureType.None);
#endif
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
{
#if UNITY_2022_1_OR_NEWER
source = renderingData.cameraData.renderer.cameraColorTargetHandle; //implicit conversion hopefully will exist for forseable future
#else
source = renderingData.cameraData.renderer.cameraColorTarget;
#endif
cameraData = renderingData.cameraData;
FetchVolumeComponent();
var passInput = ScriptableRenderPassInput.Depth;
if (sscc.normalsSource.value == SSCC.PerPixelNormals.Camera)
passInput |= ScriptableRenderPassInput.Normal;
ConfigureInput(passInput);
#if UNITY_2021_2_OR_NEWER
ConfigureColorStoreAction(RenderBufferStoreAction.DontCare);
#endif
renderPassEvent = Output == SSCC.OutputEffectTo.Screen ? RenderPassEvent.BeforeRenderingTransparents : RenderPassEvent.BeforeRenderingOpaques;
if (Output == SSCC.OutputEffectTo._SSCCTexture)
#if UNITY_2022_1_OR_NEWER
ConfigureTarget(noneRTHandle);
#else
ConfigureTarget(BuiltinRenderTextureType.None);
#endif
}
#endif
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
if (material == null) return;
FetchVolumeComponent();
if (!sscc.IsActive()) return;
cameraTextureDescriptor.msaaSamples = 1;
cameraTextureDescriptor.depthBufferBits = 0;
sourceDesc = cameraTextureDescriptor;
CheckParameters();
UpdateMaterialProperties();
UpdateShaderKeywords();
if (Output == SSCC.OutputEffectTo._SSCCTexture)
#if UNITY_2022_1_OR_NEWER
ConfigureTarget(noneRTHandle);
#else
ConfigureTarget(BuiltinRenderTextureType.None);
#endif
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
if (material == null)
{
Debug.LogError("SSCC material has not been correctly initialized...");
return;
}
if (!sscc.IsActive()) return;
var cmd = CommandBufferPool.Get("SSCC");
if (Output == SSCC.OutputEffectTo._SSCCTexture)
{
cmd.ReleaseTemporaryRT(ShaderProperties.globalSSCCTexture);
cmd.GetTemporaryRT(ShaderProperties.globalSSCCTexture, sourceDesc.width, sourceDesc.height, 0, FilterMode.Bilinear, GraphicsFormat.R16G16B16A16_SFloat/*.R32G32B32A32_SFloat*/);
cmd.SetGlobalTexture(ShaderProperties.globalSSCCTexture, new RenderTargetIdentifier(ShaderProperties.globalSSCCTexture, 0, CubemapFace.Unknown, -1));
}
else
{
cmd.GetTemporaryRT(ShaderProperties.tempTex, sourceDesc, FilterMode.Point);
BlitFullscreenMesh(cmd, source, ShaderProperties.tempTex, material, Pass.Copy);
}
if (Output == SSCC.OutputEffectTo.Screen)
BlitFullscreenMesh(cmd, ShaderProperties.tempTex, source, material, Pass.Composite);
else
BlitFullscreenMesh(cmd, ShaderProperties.globalSSCCTexture, material, Pass.Composite);
if (Output == SSCC.OutputEffectTo.Screen)
cmd.ReleaseTemporaryRT(ShaderProperties.tempTex);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
public void Cleanup()
{
CoreUtils.Destroy(material);
}
private void FetchVolumeComponent()
{
if (sscc == null)
sscc = VolumeManager.instance.stack.GetComponent<SSCC>();
}
void UpdateMaterialProperties()
{
var sourceWidth = cameraData.cameraTargetDescriptor.width;
var sourceHeight = cameraData.cameraTargetDescriptor.height;
float tanHalfFovY = Mathf.Tan(0.5f * cameraData.camera.fieldOfView * Mathf.Deg2Rad);
float invFocalLenX = 1.0f / (1.0f / tanHalfFovY * (sourceHeight / (float)sourceWidth));
float invFocalLenY = 1.0f / (1.0f / tanHalfFovY);
material.SetVector(ShaderProperties.inputTexelSize, new Vector4(1f / sourceWidth, 1f / sourceHeight, sourceWidth, sourceHeight));
material.SetVector(ShaderProperties.uvToView, new Vector4(2.0f * invFocalLenX, -2.0f * invFocalLenY, -1.0f * invFocalLenX, 1.0f * invFocalLenY));
material.SetMatrix(ShaderProperties.worldToCameraMatrix, cameraData.camera.worldToCameraMatrix);
material.SetFloat(ShaderProperties.effectIntensity, sscc.effectIntensity.value);
material.SetFloat(ShaderProperties.distanceFade, sscc.distanceFade.value);
material.SetFloat(ShaderProperties.curvaturePixelRadius, new float[] { 0f, 0.5f, 1f, 1.5f, 2.5f }[sscc.curvaturePixelRadius.value]);
material.SetFloat(ShaderProperties.curvatureRidge, sscc.curvatureBrights.value == 0f ? 999f : (5f - sscc.curvatureBrights.value));
material.SetFloat(ShaderProperties.curvatureValley, sscc.curvatureDarks.value == 0f ? 999f : (5f - sscc.curvatureDarks.value));
material.SetFloat(ShaderProperties.cavityWorldRadius, sscc.cavityRadius.value);
material.SetFloat(ShaderProperties.cavityRidge, sscc.cavityBrights.value * 2f);
material.SetFloat(ShaderProperties.cavityValley, sscc.cavityDarks.value * 2f);
}
void UpdateShaderKeywords()
{
material.shaderKeywords = new string[]
{
cameraData.camera.orthographic ? "ORTHOGRAPHIC_PROJECTION" : "__",
sscc.debugMode.value == SSCC.DebugMode.EffectOnly ? "DEBUG_EFFECT" : sscc.debugMode.value == SSCC.DebugMode.ViewNormals ? "DEBUG_NORMALS" : "__",
sscc.normalsSource.value == SSCC.PerPixelNormals.ReconstructedFromDepth ? "NORMALS_RECONSTRUCT" : "__",
sscc.cavitySamples.value == SSCC.CavitySamples.Low6 ? "CAVITY_SAMPLES_6" : sscc.cavitySamples.value == SSCC.CavitySamples.Medium8 ? "CAVITY_SAMPLES_8" : sscc.cavitySamples.value == SSCC.CavitySamples.High12 ? "CAVITY_SAMPLES_12" : "",
sscc.saturateCavity.value ? "SATURATE_CAVITY" : "__",
Output == SSCC.OutputEffectTo._SSCCTexture ? "OUTPUT_TO_TEXTURE" : "__"
};
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
static Mesh s_FullscreenMesh = null;
static Mesh fullscreenMesh
{
get
{
if (s_FullscreenMesh != null)
return s_FullscreenMesh;
float topV = 1.0f;
float bottomV = 0.0f;
s_FullscreenMesh = new Mesh { name = "Fullscreen Quad" };
s_FullscreenMesh.SetVertices(new List<Vector3>
{
new Vector3(-1.0f, -1.0f, 0.0f),
new Vector3(-1.0f, 1.0f, 0.0f),
new Vector3(1.0f, -1.0f, 0.0f),
new Vector3(1.0f, 1.0f, 0.0f)
});
s_FullscreenMesh.SetUVs(0, new List<Vector2>
{
new Vector2(0.0f, bottomV),
new Vector2(0.0f, topV),
new Vector2(1.0f, bottomV),
new Vector2(1.0f, topV)
});
s_FullscreenMesh.SetIndices(new[] { 0, 1, 2, 2, 1, 3 }, MeshTopology.Triangles, 0, false);
s_FullscreenMesh.UploadMeshData(true);
return s_FullscreenMesh;
}
}
public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int passIndex = 0)
{
cmd.SetGlobalTexture(ShaderProperties.mainTex, source);
cmd.SetRenderTarget(destination, 0, CubemapFace.Unknown, -1);
cmd.DrawMesh(/*RenderingUtils.*/fullscreenMesh, Matrix4x4.identity, material, 0, passIndex);
}
public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier destination, Material material, int passIndex = 0)
{
cmd.SetRenderTarget(destination, 0, CubemapFace.Unknown, -1);
cmd.DrawMesh(/*RenderingUtils.*/fullscreenMesh, Matrix4x4.identity, material, 0, passIndex);
}
}
[SerializeField]
[Space(15)]
[Header("You can now add SSCC to your Post Process Volume.")]
Shader shader;
private SSCCRenderPass renderPass;
public override void Create()
{
if (!isActive)
{
renderPass?.Cleanup();
renderPass = null;
return;
}
name = "SSCC";
renderPass = new SSCCRenderPass();
}
void OnDisable()
{
renderPass?.Cleanup();
}
#if URP_10_0_0_OR_NEWER
protected override void Dispose(bool disposing)
{
renderPass?.Cleanup();
renderPass = null;
}
#endif
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
shader = Shader.Find("Hidden/Universal Render Pipeline/SSCC");
if (shader == null)
{
Debug.LogWarning("SSCC shader was not found. Please ensure it compiles correctly");
return;
}
if (renderingData.cameraData.postProcessEnabled)
{
renderPass.Setup(shader, renderer, renderingData);
renderer.EnqueuePass(renderPass);
}
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 55e6184d2ea958044a6434dca151c688
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- shader: {fileID: 4800000, guid: 62449f654265cf94e81275e55a4b1823, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 58f43e59c74c01e44af838546ad2efae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,202 +0,0 @@
Shader "Hidden/Universal Render Pipeline/SSCC"
{
Properties
{
_MainTex("", any) = "" {}
}
HLSLINCLUDE
#pragma target 3.0
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma editor_sync_compilation
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#if VERSION_GREATER_EQUAL(10, 0)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
#endif
TEXTURE2D_X(_MainTex);
SAMPLER(sampler_LinearClamp);
SAMPLER(sampler_PointClamp);
CBUFFER_START(FrequentlyUpdatedUniforms)
float4 _Input_TexelSize;
float4 _UVToView;
float4x4 _WorldToCameraMatrix;
float _EffectIntensity;
float _DistanceFade;
float _CurvaturePixelRadius;
float _CurvatureBrights;
float _CurvatureDarks;
float _CavityWorldRadius;
float _CavityBrights;
float _CavityDarks;
CBUFFER_END
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
Varyings Vert(Attributes input)
{
Varyings output;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.positionCS = float4(input.positionOS.xyz, 1.0);
#if UNITY_UV_STARTS_AT_TOP
output.positionCS.y *= -1;
#endif
output.uv = input.uv;
return output;
}
ENDHLSL
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
LOD 100
ZWrite Off ZTest Always Blend Off Cull Off
Pass // 0
{
Name "Copy"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
half4 Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv);
}
ENDHLSL
}
Pass // 1
{
Name "Composite"
ColorMask RGB
HLSLPROGRAM
#pragma multi_compile_local __ DEBUG_EFFECT DEBUG_NORMALS
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
#pragma multi_compile_local __ NORMALS_RECONSTRUCT
#pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT
#pragma multi_compile_local CAVITY_SAMPLES_6 CAVITY_SAMPLES_8 CAVITY_SAMPLES_12
#pragma multi_compile_local __ SATURATE_CAVITY
#pragma multi_compile_local __ OUTPUT_TO_TEXTURE
#pragma vertex Vert
#pragma fragment Composite_Frag
//
inline half4 FetchSceneColor(float2 uv) {
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv);
}
inline float FetchRawDepth(float2 uv) {
return SampleSceneDepth(uv);
}
inline float LinearizeDepth(float depth) {
#if ORTHOGRAPHIC_PROJECTION
#if UNITY_REVERSED_Z
depth = 1 - depth;
#endif
float linearDepth = _ProjectionParams.y + depth * (_ProjectionParams.z - _ProjectionParams.y);
#else
float linearDepth = LinearEyeDepth(depth, _ZBufferParams);
#endif
return linearDepth;
}
inline float3 FetchViewPos(float2 uv) {
float depth = LinearizeDepth(FetchRawDepth(uv));
//return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth);
float4 UVToView = float4(2 / unity_CameraProjection._m00, -2 / unity_CameraProjection._m11, -1 / unity_CameraProjection._m00, 1 / unity_CameraProjection._m11);
#if ORTHOGRAPHIC_PROJECTION
return float3((uv * UVToView.xy + UVToView.zw), depth);
#else
return float3((uv * UVToView.xy + UVToView.zw) * depth, depth);
#endif
}
inline float3 MinDiff(float3 P, float3 Pr, float3 Pl) {
float3 V1 = Pr - P;
float3 V2 = P - Pl;
return (dot(V1, V1) < dot(V2, V2)) ? V1 : V2;
}
inline float3 FetchViewNormals(float3 P, float2 uv) {
#if NORMALS_RECONSTRUCT
float c = FetchRawDepth(uv);
half3 viewSpacePos_c = FetchViewPos(uv);
// get data at 1 pixel offsets in each major direction
half3 viewSpacePos_l = FetchViewPos(uv + float2(-1.0, 0.0) * _Input_TexelSize.xy);
half3 viewSpacePos_r = FetchViewPos(uv + float2(+1.0, 0.0) * _Input_TexelSize.xy);
half3 viewSpacePos_d = FetchViewPos(uv + float2(0.0, -1.0) * _Input_TexelSize.xy);
half3 viewSpacePos_u = FetchViewPos(uv + float2(0.0, +1.0) * _Input_TexelSize.xy);
half3 l = viewSpacePos_c - viewSpacePos_l;
half3 r = viewSpacePos_r - viewSpacePos_c;
half3 d = viewSpacePos_c - viewSpacePos_d;
half3 u = viewSpacePos_u - viewSpacePos_c;
half4 H = half4(
FetchRawDepth(uv + float2(-1.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(+1.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(-2.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(+2.0, 0.0) * _Input_TexelSize.xy)
);
half4 V = half4(
FetchRawDepth(uv + float2(0.0, -1.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, +1.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, -2.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, +2.0) * _Input_TexelSize.xy)
);
half2 he = abs((2 * H.xy - H.zw) - c);
half2 ve = abs((2 * V.xy - V.zw) - c);
half3 hDeriv = he.x < he.y ? l : r;
half3 vDeriv = ve.x < ve.y ? d : u;
float3 N = normalize(cross(hDeriv, vDeriv));
#else
#if VERSION_GREATER_EQUAL(10, 0)
float3 N = SampleSceneNormals(uv);
#if UNITY_VERSION >= 202110 || VERSION_GREATER_EQUAL(10, 9)
N = mul((float3x3)_WorldToCameraMatrix, N);
#else
N = float3(N.x, N.y, -N.z); //?
#endif
#else
float3 N = float3(0, 0, 0);
#endif
N = float3(N.x, -N.yz);
#endif
N = float3(N.x, -N.y, N.z);
return N;
}
//
#include "../../../Shaders/Shared.cginc"
ENDHLSL
}
}
Fallback Off
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 62449f654265cf94e81275e55a4b1823
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 76172b2df8171ae4e8cdc749378f9fac
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,253 +0,0 @@
Shader "Hidden/SSCC"
{
Properties
{
_MainTex("", any) = "" {}
_SSCCTexture("", any) = "" {}
}
CGINCLUDE
#define HLSL 0
#pragma target 3.0
#pragma editor_sync_compilation
#pragma multi_compile_local __ DEBUG_EFFECT DEBUG_NORMALS
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
#pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT
#pragma multi_compile_local CAVITY_SAMPLES_6 CAVITY_SAMPLES_8 CAVITY_SAMPLES_12 CAVITY_SAMPLES_20
#pragma multi_compile_local __ SATURATE_CAVITY
#pragma multi_compile_local __ OUTPUT_TO_TEXTURE
#pragma multi_compile_local __ UPSCALE_CAVITY
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CavityTex);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraGBufferTexture2);
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
SamplerState sampler_LinearClamp;
SamplerState sampler_PointClamp;
CBUFFER_START(FrequentlyUpdatedUniforms)
//float4 _UVToView;
float4 _Input_TexelSize;
float4 _CavityTex_TexelSize;
float4x4 _WorldToCameraMatrix;
float _EffectIntensity;
float _DistanceFade;
float _CurvaturePixelRadius;
float _CurvatureBrights;
float _CurvatureDarks;
float _CavityWorldRadius;
float _CavityBrights;
float _CavityDarks;
CBUFFER_END
CBUFFER_START(PerPassUpdatedUniforms)
float4 _UVTransform;
CBUFFER_END
struct Attributes
{
float3 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
float2 TransformTriangleVertexToUV(float2 vertex)
{
float2 uv = (vertex + 1.0) * 0.5;
return uv;
}
Varyings Vert_Default(Attributes input)
{
Varyings o;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_OUTPUT(Varyings, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = float4(input.vertex.xy, 0.0, 1.0);
o.uv = TransformTriangleVertexToUV(input.vertex.xy);
#if UNITY_UV_STARTS_AT_TOP
o.uv = o.uv * float2(1.0, -1.0) + float2(0.0, 1.0);
#endif
o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0);
return o;
}
Varyings Vert_UVTransform(Attributes input)
{
Varyings o;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_OUTPUT(Varyings, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = float4(input.vertex.xy, 0.0, 1.0);
o.uv = TransformTriangleVertexToUV(input.vertex.xy) * _UVTransform.xy + _UVTransform.zw;
o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0);
return o;
}
//
inline half4 FetchSceneColor(float2 uv) {
return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv);
}
inline float FetchRawDepth(float2 uv) {
return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
}
inline float LinearizeDepth(float depth) {
#if ORTHOGRAPHIC_PROJECTION
#if UNITY_REVERSED_Z
depth = 1 - depth;
#endif
float linearDepth = _ProjectionParams.y + depth * (_ProjectionParams.z - _ProjectionParams.y);
#else
float linearDepth = LinearEyeDepth(depth);
#endif
return linearDepth;
}
inline float3 FetchViewPos(float2 uv) {
float depth = LinearizeDepth(FetchRawDepth(uv));
//return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth);
float4 UVToView = float4(2 / unity_CameraProjection._m00, -2 / unity_CameraProjection._m11, -1 / unity_CameraProjection._m00, 1 / unity_CameraProjection._m11);
#if ORTHOGRAPHIC_PROJECTION
return float3((uv * UVToView.xy + UVToView.zw), depth);
#else
return float3((uv * UVToView.xy + UVToView.zw) * depth, depth);
#endif
}
inline float3 MinDiff(float3 P, float3 Pr, float3 Pl) {
float3 V1 = Pr - P;
float3 V2 = P - Pl;
return (dot(V1, V1) < dot(V2, V2)) ? V1 : V2;
}
inline float3 FetchViewNormals(float3 P, float2 uv) {
#if NORMALS_RECONSTRUCT
float c = FetchRawDepth(uv);
half3 viewSpacePos_c = FetchViewPos(uv);
// get data at 1 pixel offsets in each major direction
half3 viewSpacePos_l = FetchViewPos(uv + float2(-1.0, 0.0) * _Input_TexelSize.xy);
half3 viewSpacePos_r = FetchViewPos(uv + float2(+1.0, 0.0) * _Input_TexelSize.xy);
half3 viewSpacePos_d = FetchViewPos(uv + float2(0.0, -1.0) * _Input_TexelSize.xy);
half3 viewSpacePos_u = FetchViewPos(uv + float2(0.0, +1.0) * _Input_TexelSize.xy);
half3 l = viewSpacePos_c - viewSpacePos_l;
half3 r = viewSpacePos_r - viewSpacePos_c;
half3 d = viewSpacePos_c - viewSpacePos_d;
half3 u = viewSpacePos_u - viewSpacePos_c;
half4 H = half4(
FetchRawDepth(uv + float2(-1.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(+1.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(-2.0, 0.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(+2.0, 0.0) * _Input_TexelSize.xy)
);
half4 V = half4(
FetchRawDepth(uv + float2(0.0, -1.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, +1.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, -2.0) * _Input_TexelSize.xy),
FetchRawDepth(uv + float2(0.0, +2.0) * _Input_TexelSize.xy)
);
half2 he = abs((2 * H.xy - H.zw) - c);
half2 ve = abs((2 * V.xy - V.zw) - c);
half3 hDeriv = he.x < he.y ? l : r;
half3 vDeriv = ve.x < ve.y ? d : u;
float3 N = normalize(cross(hDeriv, vDeriv));
#else
#if NORMALS_CAMERA
float3 N = DecodeViewNormalStereo(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv));
#else
float3 N = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraGBufferTexture2, uv).rgb * 2.0 - 1.0;
N = mul((float3x3)_WorldToCameraMatrix, N);
#endif
N = float3(N.x, -N.yz);
#endif
N = float3(N.x, -N.y, N.z);
return N;
}
//
ENDCG
SubShader
{
LOD 100
ZWrite Off ZTest Always Cull Off
Pass // 0
{
Name "Copy"
CGPROGRAM
#pragma vertex Vert_Default
#pragma fragment Frag
half4 Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, input.uv);
}
ENDCG
}
Pass // 1
{
Name "GenerateCavity"
CGPROGRAM
#pragma vertex Vert_Default
#pragma fragment Cavity_Frag
#include "Shared.cginc"
ENDCG
}
Pass // 2
{
Name "HorizontalBlur"
CGPROGRAM
#pragma vertex Vert_Default
#pragma fragment HorizontalBlur_Frag
#include "Shared.cginc"
ENDCG
}
Pass // 3
{
Name "VerticalBlur"
CGPROGRAM
#pragma vertex Vert_Default
#pragma fragment VerticalBlur_Frag
#include "Shared.cginc"
ENDCG
}
Pass // 4
{
Name "Final"
ColorMask RGB
CGPROGRAM
#pragma vertex Vert_Default
#pragma fragment Composite_Frag
#include "Shared.cginc"
ENDCG
}
}
Fallback Off
}

View File

@ -1,16 +0,0 @@
fileFormatVersion: 2
guid: 89ec5ce1bd95ed946a65b649164a9c1d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Shaders/Builtin_SSCC.shader
uploadId: 630560

View File

@ -1,332 +0,0 @@
#if HLSL
#define SAMPLE(texture, sampler, uv) SAMPLE_TEXTURE2D_X(texture, sampler, uv)
#else
#define SAMPLE(texture, sampler, uv) UNITY_SAMPLE_SCREENSPACE_TEXTURE(texture, uv)
#endif
//CAVITY V
#ifdef CAVITY_SAMPLES_6
#define CAVITY_SAMPLES 6
#endif
#ifdef CAVITY_SAMPLES_8
#define CAVITY_SAMPLES 8
#endif
#ifdef CAVITY_SAMPLES_12
#define CAVITY_SAMPLES 12
#endif
#ifdef CAVITY_SAMPLES_20
#define CAVITY_SAMPLES 20
#endif
#ifdef SSCC_HDRP
#define ACTUAL_CAVITY_SAMPLES (CAVITY_SAMPLES+2)
#else
#define ACTUAL_CAVITY_SAMPLES (CAVITY_SAMPLES)
#endif
float _InterleavedGradientNoise(float2 pixCoord, int frameCount)
{
const float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
float2 frameMagicScale = float2(2.083f, 4.867f);
pixCoord += frameCount * frameMagicScale;
return frac(magic.z * frac(dot(pixCoord, magic.xy)));
}
float3 PickSamplePoint(float2 uv, float randAddon, int index)
{
float2 positionSS = uv * _CavityTex_TexelSize.zw;
float gn = _InterleavedGradientNoise(positionSS, index);
float u = frac(gn) * 2.0 - 1.0;
float theta = gn * 6.28318530717958647693;
float sn, cs;
sincos(theta, sn, cs);
return float3(float2(cs, sn) * sqrt(1.0 - u * u), u);
}
float3x3 GetCoordinateConversionParameters(out float2 p11_22, out float2 p13_31)
{
float3x3 camProj = (float3x3)unity_CameraProjection;
//float3x3 camProj = (float3x3)/*UNITY_MATRIX_P*/_Projection;
p11_22 = rcp(float2(camProj._11, camProj._22));
p13_31 = float2(camProj._13, camProj._23);
return camProj;
}
float3 ReconstructViewPos(float2 uv, float depth, float2 p11_22, float2 p13_31)
{
#if ORTHOGRAPHIC_PROJECTION
float3 viewPos = float3(((uv.xy * 2.0 - 1.0 - p13_31) * p11_22), depth);
#else
float3 viewPos = float3(depth * ((uv.xy * 2.0 - 1.0 - p13_31) * p11_22), depth);
#endif
return viewPos;
}
void SampleDepthAndViewpos(float2 uv, float2 p11_22, float2 p13_31, out float depth, out float3 vpos)
{
depth = LinearizeDepth(FetchRawDepth(uv));
vpos = ReconstructViewPos(uv, depth, p11_22, p13_31);
}
void Cavity(float2 uv, float3 normal, out float cavity, out float edges)
{
cavity = edges = 0.0;
float2 p11_22, p13_31;
float3x3 camProj = GetCoordinateConversionParameters(p11_22, p13_31);
float depth;
float3 vpos;
SampleDepthAndViewpos(uv, p11_22, p13_31, depth, vpos);
float randAddon = uv.x * 1e-10;
float rcpSampleCount = rcp(ACTUAL_CAVITY_SAMPLES);
//UNITY_LOOP
UNITY_UNROLL
for (int i = 0; i < int(ACTUAL_CAVITY_SAMPLES); i++)
{
#if defined(SHADER_API_D3D11)
i = floor(1.0001 * i);
#endif
#if 0
float3 v_s1 = PickSamplePoint(uv.yx, randAddon, i);
#else
float3 v_s1 = PickSamplePoint(uv, randAddon, i);
#endif
v_s1 *= sqrt((i + 1.0) * rcpSampleCount) * _CavityWorldRadius * 0.5;
float3 vpos_s1 = vpos + v_s1;
float3 spos_s1 = mul(camProj, vpos_s1);
#if ORTHOGRAPHIC_PROJECTION
float2 uv_s1_01 = clamp((spos_s1.xy + 1.0) * 0.5, 0.0, 1.0);
#else
float2 uv_s1_01 = clamp((spos_s1.xy * rcp(vpos_s1.z) + 1.0) * 0.5, 0.0, 1.0);
#endif
float depth_s1 = LinearizeDepth(FetchRawDepth(uv_s1_01));
float3 vpos_s2 = ReconstructViewPos(uv_s1_01, depth_s1, p11_22, p13_31);
float3 dir = vpos_s2 - vpos;
float len = length(dir);
float f_dot = dot(dir, normal);
//float kBeta = 0.002;
float kBeta = 0.002 * 4;
float f_cavities = f_dot - kBeta * depth;
float f_edge = -f_dot - kBeta * depth;
float f_bias = 0.05 * len + 0.0001;
if (f_cavities > -f_bias)
{
float attenuation = 1.0 / (len * (1.0 + len * len * 3.));
cavity += f_cavities * attenuation;
}
if (f_edge > f_bias)
{
float attenuation = 1.0 / (len * (1.0 + len * len * 0.01));
edges += f_edge * attenuation;
}
}
//cavity *= 1.0 / ACTUAL_CAVITY_SAMPLES;
//edges *= 1.0 / ACTUAL_CAVITY_SAMPLES;
cavity *= 1.0 * _CavityWorldRadius * 0.5;
edges *= 1.0 * _CavityWorldRadius * 0.5;
float kContrast = 0.6;
cavity = pow(abs(cavity * rcpSampleCount), kContrast);
edges = pow(abs(edges * rcpSampleCount), kContrast);
cavity = clamp(cavity * _CavityDarks, 0.0, 1.0);
edges = edges * _CavityBrights;
}
//CAVITY ^
//CURVATURE V
float CurvatureSoftClamp(float curvature, float control)
{
if (curvature < 0.5 / control)
return curvature * (1.0 - curvature * control);
return 0.25 / control;
}
float Curvature(float2 uv, float3 P)
{
float3 offset = float3(_Input_TexelSize.xy, 0.0) * (_CurvaturePixelRadius);
float normal_up = FetchViewNormals(P, uv + offset.zy).g;
float normal_down = FetchViewNormals(P, uv - offset.zy).g;
float normal_right = FetchViewNormals(P, uv + offset.xz).r;
float normal_left = FetchViewNormals(P, uv - offset.xz).r;
float normal_diff = (normal_up - normal_down) + (normal_right - normal_left);
//if (abs(normal_diff) <= 0.1) return 0; //slight low pass filter to remove noise from camera normals precision
//new and improved low pass filter:
//if (uv.x < 0.5)
{
if (normal_diff > 0.0) normal_diff = sign(normal_diff) * pow(normal_diff, 2.0);
_CavityBrights += 0.5;
}
if (normal_diff >= 0.0)
return 2.0 * CurvatureSoftClamp(normal_diff, _CurvatureBrights);
else
return -2.0 * CurvatureSoftClamp(-normal_diff, _CurvatureDarks);
}
//CURVATURE ^
float invLerp(float from, float to, float value) {
return (value - from) / (to - from);
}
float remap(float origFrom, float origTo, float targetFrom, float targetTo, float value) {
float rel = invLerp(origFrom, origTo, value);
return lerp(targetFrom, targetTo, rel);
}
float4 Cavity_Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
#ifdef UnityStereoTransformScreenSpaceTex
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
#else
float2 uv = input.uv;
#endif
float3 P = FetchViewPos(uv);
float3 N = FetchViewNormals(P, uv);
float cavity = 0.0, edges = 0.0;
Cavity(uv, N, cavity, edges);
return float4(cavity, edges, FetchRawDepth(uv), 1.0);
}
float2 GaussianBlur(float2 uv, float2 pixelOffset)
{
const float gWeights[2] =
{
0.44908,
0.05092
};
const float gOffsets[2] =
{
0.53805,
2.06278
};
float2 colOut = 0.0;
UNITY_UNROLL
for(int i = 0; i < 2; i++)
{
float2 texCoordOffset = pixelOffset * gOffsets[i];
float2 p1 = SAMPLE(_MainTex, sampler_LinearClamp, uv + texCoordOffset).xy;
float2 p2 = SAMPLE(_MainTex, sampler_LinearClamp, uv - texCoordOffset).xy;
colOut += gWeights[i] * (p1 + p2);
}
return colOut;
}
float4 HorizontalBlur_Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
return float4
(
GaussianBlur(input.uv, float2(_CavityTex_TexelSize.x, 0.0)),
SAMPLE(_MainTex, sampler_LinearClamp, input.uv).z,
1.0
);
}
float4 VerticalBlur_Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
return float4
(
GaussianBlur(input.uv, float2(0.0, _CavityTex_TexelSize.y)),
SAMPLE(_MainTex, sampler_LinearClamp, input.uv).z,
1.0
);
}
float4 Composite_Frag(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
#ifdef UnityStereoTransformScreenSpaceTex
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
#else
float2 uv = input.uv;
#endif
float3 P = FetchViewPos(uv);
float3 N = FetchViewNormals(P, uv);
float4 col = FetchSceneColor(uv);
float4 untouchedCol = FetchSceneColor(uv);
//float depth01 = FetchRawDepth(uv);
//if (depth01 == 1.0 || depth01 == 0.0) return col;
float curvature = 0.0;
curvature = Curvature(uv, P);
//float cavity = 0.0, edges = 0.0;
//Cavity(uv, N, cavity, edges);
float2 cavityTex;
#if UPSCALE_CAVITY
float2 LowResTexelSize = _CavityTex_TexelSize.xy;
float2 LowResBufferSize = _CavityTex_TexelSize.zw;
float2 Corner00UV = floor(uv * LowResBufferSize - .5f) / LowResBufferSize + .5f * LowResTexelSize;
float2 BilinearWeights = (uv - Corner00UV) * LowResBufferSize;
//xy is signal, z is depth it used
float3 TextureValues00 = SAMPLE(_CavityTex, sampler_LinearClamp, Corner00UV).xyz;
float3 TextureValues10 = SAMPLE(_CavityTex, sampler_LinearClamp, Corner00UV + float2(LowResTexelSize.x, 0)).xyz;
float3 TextureValues01 = SAMPLE(_CavityTex, sampler_LinearClamp, Corner00UV + float2(0, LowResTexelSize.y)).xyz;
float3 TextureValues11 = SAMPLE(_CavityTex, sampler_LinearClamp, Corner00UV + LowResTexelSize).xyz;
float4 CornerWeights = float4(
(1 - BilinearWeights.y) * (1 - BilinearWeights.x),
(1 - BilinearWeights.y) * BilinearWeights.x,
BilinearWeights.y * (1 - BilinearWeights.x),
BilinearWeights.y * BilinearWeights.x);
float Epsilon = .0001f/*-.0001f*//*0.0f*/;
float4 CornerDepths = abs(float4(TextureValues00.z, TextureValues10.z, TextureValues01.z, TextureValues11.z));
float SceneDepth = FetchRawDepth(uv);
float4 DepthWeights = 1.0f / (abs(CornerDepths - SceneDepth.xxxx) + Epsilon);
float4 FinalWeights = CornerWeights * DepthWeights;
cavityTex = (FinalWeights.x*TextureValues00.xy + FinalWeights.y*TextureValues10.xy + FinalWeights.z*TextureValues01.xy + FinalWeights.w*TextureValues11.xy) / dot(FinalWeights, 1);
#else
cavityTex = SAMPLE(_CavityTex, sampler_LinearClamp, uv).xy;
#endif
float cavity = cavityTex.r, edges = cavityTex.g;
if (uv.x < _Input_TexelSize.x * 2 || uv.y < _Input_TexelSize.y * 2 || 1 - uv.x < _Input_TexelSize.x * 2 || 1 - uv.y < _Input_TexelSize.y * 2) { curvature = cavity = edges = 0; };
col.rgb += (curvature * 0.4);
#if SATURATE_CAVITY
//float3 extra = col.rgb - saturate(col.rgb);
col.rgb = pow(saturate(col.rgb), 1 - (edges * 0.5));
col.rgb = pow(saturate(col.rgb), 1 + (cavity * 1));
//col.rgb += extra;
#else
col.rgb += (edges * 0.2);
col.rgb -= (cavity * 0.2);
#endif
//Uncomment this block of code for on/off back and forth effect preview
//if (uv.x < sin(_Time.y+(3.1415/2)) * 0.5 + 0.5)
//{
// if (uv.x > (sin(_Time.y+(3.1415/2)) * 0.5 + 0.5) - 0.002) return 0;
// return untouchedCol;
//}
#if DEBUG_EFFECT
return ((1.0 - cavity) * (1.0 + edges) * (1.0 + curvature)) * 0.25;
#elif DEBUG_NORMALS
return float4(N * 0.5 + 0.5, 1);
#endif
#if OUTPUT_TO_TEXTURE
float r = curvature * 0.4;
float g = (edges * 0.2) - (cavity * 0.2);
return float4(r * rcp(max(1, P.z * _DistanceFade)) * _EffectIntensity, g * rcp(max(1, P.z * _DistanceFade)) * _EffectIntensity, 1, 1);
//Values rescaled so they're more consistent to work with, if you just +curvature+edges it should match 'screen' output
#else
return lerp(untouchedCol, col, rcp(max(1, P.z * _DistanceFade)) * _EffectIntensity);
#endif
}

View File

@ -1,16 +0,0 @@
fileFormatVersion: 2
guid: 320b7d4bebad59e4ead8d08b151d6a7f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/Shaders/Shared.cginc
uploadId: 630560

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2caf2819c0dabce42b6b938c8f5a9ba4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,15 +0,0 @@
fileFormatVersion: 2
guid: 0e83bea63c06f674eb5018b4edaaa234
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/_SSCCTexture Examples/Builtin _SSCCTexture
Example.unitypackage
uploadId: 630560

View File

@ -1,8 +0,0 @@
Feel free to ignore this if you're using the "Screen" output mode of the asset, having it applied all over the screen.
-------
This folder contains example shaders for if you want to use the "_SSCCTexture in shaders" output mode of the asset.
This allows you to selectively apply the effect to certain objects / filter our the others.
Only available for Builtin(2019/2020/2021), URP(2020/2021). Unfortunately not available for URP(2019) and HDRP(at all).
Import appropriate .unitypackage for an example implementation of how to sample _SSCCTexture in shaders.

View File

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 9673b087a168cd34984bd85711945362
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/_SSCCTexture Examples/Readme.txt
uploadId: 630560

View File

@ -1,15 +0,0 @@
fileFormatVersion: 2
guid: c2a3494b77a23b54aa8b5ad80b580749
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/_SSCCTexture Examples/URP2020 _SSCCTexture
Example.unitypackage
uploadId: 630560

View File

@ -1,15 +0,0 @@
fileFormatVersion: 2
guid: 63fa4c6385d5807478747f832fef4a20
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 216995
packageName: Screen Space Cavity & Curvature (Built-In/URP/HDRP)
packageVersion: 1.1.6
assetPath: Assets/Screen Space Cavity Curvature/_SSCCTexture Examples/URP2021+
_SSCCTexture Example.unitypackage
uploadId: 630560

View File

@ -1,131 +0,0 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.Rendering.Universal.ShaderGUI
{
class LitShaderCavity2021 : BaseShaderGUI
{
static readonly string[] workflowModeNames = Enum.GetNames(typeof(LitGUI.WorkflowMode));
private LitGUI.LitProperties litProperties;
private MaterialProperty curvatureMultiplier = null;
private MaterialProperty cavityMultiplier = null;
// collect properties from the material properties
public override void FindProperties(MaterialProperty[] properties)
{
base.FindProperties(properties);
litProperties = new LitGUI.LitProperties(properties);
curvatureMultiplier = FindProperty("_CurvatureMultiplier", properties);
cavityMultiplier = FindProperty("_CavityMultiplier", properties);
}
// material changed check
//public override void ValidateMaterial(Material material)
//{
// SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, LitDetailGUI.SetMaterialKeywords);
//}
// material main surface options
public override void DrawSurfaceOptions(Material material)
{
// Use default labelWidth
EditorGUIUtility.labelWidth = 0f;
if (litProperties.workflowMode != null)
DoPopup(LitGUI.Styles.workflowModeText, litProperties.workflowMode, workflowModeNames);
base.DrawSurfaceOptions(material);
}
// material main surface inputs
public override void DrawSurfaceInputs(Material material)
{
base.DrawSurfaceInputs(material);
LitGUI.Inputs(litProperties, materialEditor, material);
DrawEmissionProperties(material, true);
DrawTileOffset(materialEditor, baseMapProp);
materialEditor.RangeProperty(curvatureMultiplier, curvatureMultiplier.displayName);
materialEditor.RangeProperty(cavityMultiplier, cavityMultiplier.displayName);
}
// material main advanced options
public override void DrawAdvancedOptions(Material material)
{
if (litProperties.reflections != null && litProperties.highlights != null)
{
materialEditor.ShaderProperty(litProperties.highlights, LitGUI.Styles.highlightsText);
materialEditor.ShaderProperty(litProperties.reflections, LitGUI.Styles.reflectionsText);
}
base.DrawAdvancedOptions(material);
}
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
{
if (material == null)
throw new ArgumentNullException("material");
// _Emission property is lost after assigning Standard shader to the material
// thus transfer it before assigning the new shader
if (material.HasProperty("_Emission"))
{
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
}
base.AssignNewShaderToMaterial(material, oldShader, newShader);
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
{
SetupMaterialBlendMode(material);
return;
}
SurfaceType surfaceType = SurfaceType.Opaque;
BlendMode blendMode = BlendMode.Alpha;
if (oldShader.name.Contains("/Transparent/Cutout/"))
{
surfaceType = SurfaceType.Opaque;
material.SetFloat("_AlphaClip", 1);
}
else if (oldShader.name.Contains("/Transparent/"))
{
// NOTE: legacy shaders did not provide physically based transparency
// therefore Fade mode
surfaceType = SurfaceType.Transparent;
blendMode = BlendMode.Alpha;
}
material.SetFloat("_Blend", (float)blendMode);
material.SetFloat("_Surface", (float)surfaceType);
if (surfaceType == SurfaceType.Opaque)
{
material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT");
}
else
{
material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
}
if (oldShader.name.Equals("Standard (Specular setup)"))
{
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Specular);
Texture texture = material.GetTexture("_SpecGlossMap");
if (texture != null)
material.SetTexture("_MetallicSpecGlossMap", texture);
}
else
{
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Metallic);
Texture texture = material.GetTexture("_MetallicGlossMap");
if (texture != null)
material.SetTexture("_MetallicSpecGlossMap", texture);
}
}
}
}
#endif

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 66eeaf301cf20bb4cb620f76313aec52
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,345 +0,0 @@
Shader "Universal Render Pipeline/Lit + Cavity"
{
Properties
{
// Specular vs Metallic workflow
_WorkflowMode("WorkflowMode", Float) = 1.0
[MainTexture] _BaseMap("Albedo", 2D) = "white" {}
[MainColor] _BaseColor("Color", Color) = (1,1,1,1)
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
_SmoothnessTextureChannel("Smoothness texture channel", Float) = 0
_Metallic("Metallic", Range(0.0, 1.0)) = 0.0
_MetallicGlossMap("Metallic", 2D) = "white" {}
_SpecColor("Specular", Color) = (0.2, 0.2, 0.2)
_SpecGlossMap("Specular", 2D) = "white" {}
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
[ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
_BumpScale("Scale", Float) = 1.0
_BumpMap("Normal Map", 2D) = "bump" {}
_Parallax("Scale", Range(0.005, 0.08)) = 0.005
_ParallaxMap("Height Map", 2D) = "black" {}
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
_OcclusionMap("Occlusion", 2D) = "white" {}
[HDR] _EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DetailMask("Detail Mask", 2D) = "white" {}
_DetailAlbedoMapScale("Scale", Range(0.0, 2.0)) = 1.0
_DetailAlbedoMap("Detail Albedo x2", 2D) = "linearGrey" {}
_DetailNormalMapScale("Scale", Range(0.0, 2.0)) = 1.0
[Normal] _DetailNormalMap("Normal Map", 2D) = "bump" {}
// SRP batching compatibility for Clear Coat (Not used in Lit)
[HideInInspector] _ClearCoatMask("_ClearCoatMask", Float) = 0.0
[HideInInspector] _ClearCoatSmoothness("_ClearCoatSmoothness", Float) = 0.0
// Blending state
_Surface("__surface", Float) = 0.0
_Blend("__blend", Float) = 0.0
_Cull("__cull", Float) = 2.0
[ToggleUI] _AlphaClip("__clip", Float) = 0.0
[HideInInspector] _SrcBlend("__src", Float) = 1.0
[HideInInspector] _DstBlend("__dst", Float) = 0.0
[HideInInspector] _ZWrite("__zw", Float) = 1.0
[ToggleUI] _ReceiveShadows("Receive Shadows", Float) = 1.0
// Editmode props
_QueueOffset("Queue offset", Float) = 0.0
// ObsoleteProperties
[HideInInspector] _MainTex("BaseMap", 2D) = "white" {}
[HideInInspector] _Color("Base Color", Color) = (1, 1, 1, 1)
[HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0
[HideInInspector] _Glossiness("Smoothness", Float) = 0.0
[HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
//V
_CurvatureMultiplier("Curvature Multiplier", Range(0,1.5)) = 1.0
_CavityMultiplier("Cavity Multiplier", Range(0,1.5)) = 1.0
//^
}
SubShader
{
Tags{"RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "UniversalMaterialType" = "Lit" "IgnoreProjector" = "True" "ShaderModel" = "4.5"}
LOD 300
Pass
{
Name "ForwardLit"
Tags{"LightMode" = "UniversalForward"}
Blend[_SrcBlend][_DstBlend]
ZWrite[_ZWrite]
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma shader_feature_local _NORMALMAP
#pragma shader_feature_local _PARALLAXMAP
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED
#pragma shader_feature_local_fragment _SURFACE_TYPE_TRANSPARENT
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON
#pragma shader_feature_local_fragment _EMISSION
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature_local_fragment _OCCLUSIONMAP
#pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
#pragma shader_feature_local_fragment _SPECULAR_SETUP
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
#pragma multi_compile_fragment _ _SHADOWS_SOFT
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
#pragma multi_compile_fragment _ _LIGHT_LAYERS
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile _ _CLUSTERED_RENDERING
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma vertex LitPassVertex
#pragma fragment LitPassFragmentCavity //<
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl"
//TEXTURE2D(_SSCCTexture); //Declared in LitInputCavity.hlsl to support batching
//SAMPLER(sampler_SSCCTexture); //Declared in LitInputCavity.hlsl to support batching
//float _CurvatureMultiplier; //Declared in LitInputCavity.hlsl to support batching
//float _CavityMultiplier; //Declared in LitInputCavity.hlsl to support batching
half4 LitPassFragmentCavity(Varyings input) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(input);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
#if defined(_PARALLAXMAP)
#if defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
half3 viewDirTS = input.viewDirTS;
#else
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
half3 viewDirTS = GetViewDirectionTangentSpace(input.tangentWS, input.normalWS, viewDirWS);
#endif
ApplyPerPixelDisplacement(viewDirTS, input.uv);
#endif
SurfaceData surfaceData;
InitializeStandardLitSurfaceData(input.uv, surfaceData);
InputData inputData;
InitializeInputData(input, surfaceData.normalTS, inputData);
SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv, _BaseMap);
#ifdef _DBUFFER
ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
#endif
half4 color = UniversalFragmentPBR(inputData, surfaceData);
//V
float2 screenUV = GetNormalizedScreenSpaceUV(input.positionCS);
float4 sscc = SAMPLE_TEXTURE2D_X(_SSCCTexture, sampler_SSCCTexture, screenUV);
if (sscc.b == 1.0) //This is how you can detect if 'screen' output mode is on and avoid reading the texture, this is just for housekeeping, as _SSCCTexture will be 0.5 grey in 'screen' mode
{
float curvature = sscc.r;
float cavity = sscc.g;
//You could totally for example split curvature or cavity by <0 and >0, isolating the dark/bright parts and, for example, coloring them separately.
color.rgb += (curvature * _CurvatureMultiplier) + (cavity * _CavityMultiplier); //exactly matches screen mode with 'saturate cavity' off
}
//^
color.rgb = MixFog(color.rgb, inputData.fogCoord);
color.a = OutputAlpha(color.a, _Surface);
return color;
}
ENDHLSL
}
//-----------------------------------------------------------------------------------------------------------
//The rest is unchanged exact copy of Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader:
Pass
{
Name "ShadowCaster"
Tags{"LightMode" = "ShadowCaster"}
ZWrite On
ZTest LEqual
ColorMask 0
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
ENDHLSL
}
Pass
{
Name "GBuffer"
Tags{"LightMode" = "UniversalGBuffer"}
ZWrite[_ZWrite]
ZTest LEqual
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma shader_feature_local _NORMALMAP
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _EMISSION
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature_local_fragment _OCCLUSIONMAP
#pragma shader_feature_local _PARALLAXMAP
#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED
#pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
#pragma shader_feature_local_fragment _SPECULAR_SETUP
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
#pragma multi_compile_fragment _ _SHADOWS_SOFT
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
#pragma multi_compile_fragment _ _LIGHT_LAYERS
#pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma vertex LitGBufferPassVertex
#pragma fragment LitGBufferPassFragment
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitGBufferPass.hlsl"
ENDHLSL
}
Pass
{
Name "DepthOnly"
Tags{"LightMode" = "DepthOnly"}
ZWrite On
ColorMask 0
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
ENDHLSL
}
Pass
{
Name "DepthNormals"
Tags{"LightMode" = "DepthNormals"}
ZWrite On
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma vertex DepthNormalsVertex
#pragma fragment DepthNormalsFragment
#pragma shader_feature_local _NORMALMAP
#pragma shader_feature_local _PARALLAXMAP
#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitDepthNormalsPass.hlsl"
ENDHLSL
}
Pass
{
Name "Meta"
Tags{"LightMode" = "Meta"}
Cull Off
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma vertex UniversalVertexMeta
#pragma fragment UniversalFragmentMetaLit
#pragma shader_feature EDITOR_VISUALIZATION
#pragma shader_feature_local_fragment _SPECULAR_SETUP
#pragma shader_feature_local_fragment _EMISSION
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED
#pragma shader_feature_local_fragment _SPECGLOSSMAP
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitMetaPass.hlsl"
ENDHLSL
}
Pass
{
Name "Universal2D"
Tags{ "LightMode" = "Universal2D" }
Blend[_SrcBlend][_DstBlend]
ZWrite[_ZWrite]
Cull[_Cull]
HLSLPROGRAM
#pragma exclude_renderers gles gles3 glcore
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature_local_fragment _ALPHATEST_ON
#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON
#include "Urp2021 LitInputCavity.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Universal2D.hlsl"
ENDHLSL
}
}
FallBack "Hidden/Universal Render Pipeline/FallbackError"
CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShaderCavity2021"
}

View File

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 2bb0db0105bcf1d44bbf93d452a6a50f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,248 +0,0 @@
#ifndef UNIVERSAL_LIT_INPUT_INCLUDED
#define UNIVERSAL_LIT_INPUT_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ParallaxMapping.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#if defined(_DETAIL_MULX2) || defined(_DETAIL_SCALED)
#define _DETAIL
#endif
// NOTE: Do not ifdef the properties here as SRP batcher can not handle different layouts.
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
float4 _DetailAlbedoMap_ST;
half4 _BaseColor;
half4 _SpecColor;
half4 _EmissionColor;
half _Cutoff;
half _Smoothness;
half _Metallic;
half _BumpScale;
half _Parallax;
half _OcclusionStrength;
half _ClearCoatMask;
half _ClearCoatSmoothness;
half _DetailAlbedoMapScale;
half _DetailNormalMapScale;
half _Surface;
TEXTURE2D(_SSCCTexture); //<
SAMPLER(sampler_SSCCTexture); //<
float _CurvatureMultiplier; //<
float _CavityMultiplier; //<
CBUFFER_END
// NOTE: Do not ifdef the properties for dots instancing, but ifdef the actual usage.
// Otherwise you might break CPU-side as property constant-buffer offsets change per variant.
// NOTE: Dots instancing is orthogonal to the constant buffer above.
#ifdef UNITY_DOTS_INSTANCING_ENABLED
UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)
UNITY_DOTS_INSTANCED_PROP(float4, _BaseColor)
UNITY_DOTS_INSTANCED_PROP(float4, _SpecColor)
UNITY_DOTS_INSTANCED_PROP(float4, _EmissionColor)
UNITY_DOTS_INSTANCED_PROP(float , _Cutoff)
UNITY_DOTS_INSTANCED_PROP(float , _Smoothness)
UNITY_DOTS_INSTANCED_PROP(float , _Metallic)
UNITY_DOTS_INSTANCED_PROP(float , _BumpScale)
UNITY_DOTS_INSTANCED_PROP(float , _Parallax)
UNITY_DOTS_INSTANCED_PROP(float , _OcclusionStrength)
UNITY_DOTS_INSTANCED_PROP(float , _ClearCoatMask)
UNITY_DOTS_INSTANCED_PROP(float , _ClearCoatSmoothness)
UNITY_DOTS_INSTANCED_PROP(float , _DetailAlbedoMapScale)
UNITY_DOTS_INSTANCED_PROP(float , _DetailNormalMapScale)
UNITY_DOTS_INSTANCED_PROP(float , _Surface)
UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
#define _BaseColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_BaseColor)
#define _SpecColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_SpecColor)
#define _EmissionColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_EmissionColor)
#define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Cutoff)
#define _Smoothness UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Smoothness)
#define _Metallic UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Metallic)
#define _BumpScale UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_BumpScale)
#define _Parallax UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Parallax)
#define _OcclusionStrength UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_OcclusionStrength)
#define _ClearCoatMask UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_ClearCoatMask)
#define _ClearCoatSmoothness UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_ClearCoatSmoothness)
#define _DetailAlbedoMapScale UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_DetailAlbedoMapScale)
#define _DetailNormalMapScale UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_DetailNormalMapScale)
#define _Surface UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Surface)
#endif
TEXTURE2D(_ParallaxMap); SAMPLER(sampler_ParallaxMap);
TEXTURE2D(_OcclusionMap); SAMPLER(sampler_OcclusionMap);
TEXTURE2D(_DetailMask); SAMPLER(sampler_DetailMask);
TEXTURE2D(_DetailAlbedoMap); SAMPLER(sampler_DetailAlbedoMap);
TEXTURE2D(_DetailNormalMap); SAMPLER(sampler_DetailNormalMap);
TEXTURE2D(_MetallicGlossMap); SAMPLER(sampler_MetallicGlossMap);
TEXTURE2D(_SpecGlossMap); SAMPLER(sampler_SpecGlossMap);
TEXTURE2D(_ClearCoatMap); SAMPLER(sampler_ClearCoatMap);
#ifdef _SPECULAR_SETUP
#define SAMPLE_METALLICSPECULAR(uv) SAMPLE_TEXTURE2D(_SpecGlossMap, sampler_SpecGlossMap, uv)
#else
#define SAMPLE_METALLICSPECULAR(uv) SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_MetallicGlossMap, uv)
#endif
half4 SampleMetallicSpecGloss(float2 uv, half albedoAlpha)
{
half4 specGloss;
#ifdef _METALLICSPECGLOSSMAP
specGloss = half4(SAMPLE_METALLICSPECULAR(uv));
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
specGloss.a = albedoAlpha * _Smoothness;
#else
specGloss.a *= _Smoothness;
#endif
#else // _METALLICSPECGLOSSMAP
#if _SPECULAR_SETUP
specGloss.rgb = _SpecColor.rgb;
#else
specGloss.rgb = _Metallic.rrr;
#endif
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
specGloss.a = albedoAlpha * _Smoothness;
#else
specGloss.a = _Smoothness;
#endif
#endif
return specGloss;
}
half SampleOcclusion(float2 uv)
{
#ifdef _OCCLUSIONMAP
// TODO: Controls things like these by exposing SHADER_QUALITY levels (low, medium, high)
#if defined(SHADER_API_GLES)
return SAMPLE_TEXTURE2D(_OcclusionMap, sampler_OcclusionMap, uv).g;
#else
half occ = SAMPLE_TEXTURE2D(_OcclusionMap, sampler_OcclusionMap, uv).g;
return LerpWhiteTo(occ, _OcclusionStrength);
#endif
#else
return half(1.0);
#endif
}
// Returns clear coat parameters
// .x/.r == mask
// .y/.g == smoothness
half2 SampleClearCoat(float2 uv)
{
#if defined(_CLEARCOAT) || defined(_CLEARCOATMAP)
half2 clearCoatMaskSmoothness = half2(_ClearCoatMask, _ClearCoatSmoothness);
#if defined(_CLEARCOATMAP)
clearCoatMaskSmoothness *= SAMPLE_TEXTURE2D(_ClearCoatMap, sampler_ClearCoatMap, uv).rg;
#endif
return clearCoatMaskSmoothness;
#else
return half2(0.0, 1.0);
#endif // _CLEARCOAT
}
void ApplyPerPixelDisplacement(half3 viewDirTS, inout float2 uv)
{
#if defined(_PARALLAXMAP)
uv += ParallaxMapping(TEXTURE2D_ARGS(_ParallaxMap, sampler_ParallaxMap), viewDirTS, _Parallax, uv);
#endif
}
// Used for scaling detail albedo. Main features:
// - Depending if detailAlbedo brightens or darkens, scale magnifies effect.
// - No effect is applied if detailAlbedo is 0.5.
half3 ScaleDetailAlbedo(half3 detailAlbedo, half scale)
{
// detailAlbedo = detailAlbedo * 2.0h - 1.0h;
// detailAlbedo *= _DetailAlbedoMapScale;
// detailAlbedo = detailAlbedo * 0.5h + 0.5h;
// return detailAlbedo * 2.0f;
// A bit more optimized
return half(2.0) * detailAlbedo * scale - scale + half(1.0);
}
half3 ApplyDetailAlbedo(float2 detailUv, half3 albedo, half detailMask)
{
#if defined(_DETAIL)
half3 detailAlbedo = SAMPLE_TEXTURE2D(_DetailAlbedoMap, sampler_DetailAlbedoMap, detailUv).rgb;
// In order to have same performance as builtin, we do scaling only if scale is not 1.0 (Scaled version has 6 additional instructions)
#if defined(_DETAIL_SCALED)
detailAlbedo = ScaleDetailAlbedo(detailAlbedo, _DetailAlbedoMapScale);
#else
detailAlbedo = half(2.0) * detailAlbedo;
#endif
return albedo * LerpWhiteTo(detailAlbedo, detailMask);
#else
return albedo;
#endif
}
half3 ApplyDetailNormal(float2 detailUv, half3 normalTS, half detailMask)
{
#if defined(_DETAIL)
#if BUMP_SCALE_NOT_SUPPORTED
half3 detailNormalTS = UnpackNormal(SAMPLE_TEXTURE2D(_DetailNormalMap, sampler_DetailNormalMap, detailUv));
#else
half3 detailNormalTS = UnpackNormalScale(SAMPLE_TEXTURE2D(_DetailNormalMap, sampler_DetailNormalMap, detailUv), _DetailNormalMapScale);
#endif
// With UNITY_NO_DXT5nm unpacked vector is not normalized for BlendNormalRNM
// For visual consistancy we going to do in all cases
detailNormalTS = normalize(detailNormalTS);
return lerp(normalTS, BlendNormalRNM(normalTS, detailNormalTS), detailMask); // todo: detailMask should lerp the angle of the quaternion rotation, not the normals
#else
return normalTS;
#endif
}
inline void InitializeStandardLitSurfaceData(float2 uv, out SurfaceData outSurfaceData)
{
half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
outSurfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff);
half4 specGloss = SampleMetallicSpecGloss(uv, albedoAlpha.a);
outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
#if _SPECULAR_SETUP
outSurfaceData.metallic = half(1.0);
outSurfaceData.specular = specGloss.rgb;
#else
outSurfaceData.metallic = specGloss.r;
outSurfaceData.specular = half3(0.0, 0.0, 0.0);
#endif
outSurfaceData.smoothness = specGloss.a;
outSurfaceData.normalTS = SampleNormal(uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
outSurfaceData.occlusion = SampleOcclusion(uv);
outSurfaceData.emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
#if defined(_CLEARCOAT) || defined(_CLEARCOATMAP)
half2 clearCoat = SampleClearCoat(uv);
outSurfaceData.clearCoatMask = clearCoat.r;
outSurfaceData.clearCoatSmoothness = clearCoat.g;
#else
outSurfaceData.clearCoatMask = half(0.0);
outSurfaceData.clearCoatSmoothness = half(0.0);
#endif
#if defined(_DETAIL)
half detailMask = SAMPLE_TEXTURE2D(_DetailMask, sampler_DetailMask, uv).a;
float2 detailUv = uv * _DetailAlbedoMap_ST.xy + _DetailAlbedoMap_ST.zw;
outSurfaceData.albedo = ApplyDetailAlbedo(detailUv, outSurfaceData.albedo, detailMask);
outSurfaceData.normalTS = ApplyDetailNormal(detailUv, outSurfaceData.normalTS, detailMask);
#endif
}
#endif // UNIVERSAL_INPUT_SURFACE_PBR_INCLUDED

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 9acd220f8e45cb440811034109d52c6c
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6775967833334884883
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: 48bd76fbc46e46fe9bc606bd3c30bd9b, type: 3}
m_Name: 'Stylized Water 2: Dynamic Effects'
m_EditorClassIdentifier:
m_Active: 1
settings:
renderRange: 200
fadePercentage: 10
texelsPerUnit: 8
maxResolution: 4096
enableDisplacement: 1
enableNormals: 1
halfResolutionNormals: 0
normalMipmaps: 1
ignoreSceneView: 0
enableVFXGraphHooks: 1
displacementNormalShader: {fileID: 4800000, guid: e88bd17fc45d45adaa4fe5e4dc1e381e,
type: 3}
--- !u!114 &-4976693964440579253
MonoBehaviour:
m_ObjectHideFlags: 0
@ -13,7 +39,7 @@ MonoBehaviour:
m_Name: SSCC
m_EditorClassIdentifier:
m_Active: 1
shader: {fileID: 4800000, guid: 62449f654265cf94e81275e55a4b1823, type: 3}
shader: {fileID: 0}
--- !u!114 &-4104698691654496493
MonoBehaviour:
m_ObjectHideFlags: 0
@ -37,6 +63,27 @@ MonoBehaviour:
normalBlend: 0
m_CopyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
m_DBufferClear: {fileID: 4800000, guid: f056d8bd2a1c7e44e9729144b4c70395, type: 3}
--- !u!114 &-1928039177417452880
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: 952211dd0b8f432ca3e01150850775e5, type: 3}
m_Name: 'Stylized Water 2: Underwater Rendering'
m_EditorClassIdentifier:
m_Active: 1
resources: {fileID: 11400000, guid: 4eff212383c9f5945ae947b357c76582, type: 2}
settings:
allowBlur: 1
allowDistortion: 1
distortionMode: 1
directionalCaustics: 0
accurateDirectionalCaustics: 0
waterlineRefraction: 1
--- !u!114 &-1878332245247344467
MonoBehaviour:
m_ObjectHideFlags: 0
@ -105,9 +152,10 @@ MonoBehaviour:
type: 3}
m_RendererFeatures:
- {fileID: -1878332245247344467}
- {fileID: -4976693964440579253}
- {fileID: -4104698691654496493}
m_RendererFeatureMap: adc0de57c6d2eee54b53b0fd343befba134fec9d492e09c7
- {fileID: -6775967833334884883}
- {fileID: -1928039177417452880}
m_RendererFeatureMap: adc0de57c6d2eee5134fec9d492e09c7edd599fc27edf6a1
m_UseNativeRenderPass: 0
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c7f647a83c6674f4a9c40ebd43aec85d
guid: f0d22403d241247419a2e3afe9f81340
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,7 @@
1.0.1
Added:
- Demo scene, UI sliders to control the render range and resolution
Fixed:
- DemoController script throwing an error on some platforms (likely due to localization).

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9f2f739ec3384659b02b3b50734684e2
timeCreated: 1698133570
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/DynamicEffects/CHANGELOG.md
uploadId: 624484

View File

@ -0,0 +1,6 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
IDList=
URL=http://staggart.xyz/unity/stylized-water-2/sws-2-docs/
HotKey=0

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: f1fe06414e2703746aba660a616e5daf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/DynamicEffects/Documentation.url
uploadId: 624484

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8a79591d687204e75aeffd3294ba33ac
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,128 @@
using System;
using UnityEditor;
using UnityEngine;
#if URP
using UnityEngine.Rendering.Universal;
#endif
namespace StylizedWater2.DynamicEffects
{
[CustomEditor(typeof(DynamicEffect))]
[CanEditMultipleObjects]
public class DynamicEffectInspector : Editor
{
private SerializedProperty renderer;
private SerializedProperty sortingLayer;
private SerializedProperty displacementScale;
private SerializedProperty foamAmount;
private SerializedProperty normalStrength;
#if URP
private bool renderFeaturePresent;
private bool renderFeatureEnabled;
private WaterDynamicEffectsRenderFeature renderFeature;
private Editor renderFeatureEditor;
#endif
private void OnEnable()
{
renderer = serializedObject.FindProperty("renderer");
sortingLayer = serializedObject.FindProperty("sortingLayer");
displacementScale = serializedObject.FindProperty("displacementScale");
foamAmount = serializedObject.FindProperty("foamAmount");
normalStrength = serializedObject.FindProperty("normalStrength");
#if URP
renderFeaturePresent = PipelineUtilities.RenderFeatureAdded<WaterDynamicEffectsRenderFeature>();
renderFeatureEnabled = PipelineUtilities.IsRenderFeatureEnabled<WaterDynamicEffectsRenderFeature>();
renderFeature = PipelineUtilities.GetRenderFeature<WaterDynamicEffectsRenderFeature>() as WaterDynamicEffectsRenderFeature;
#endif
}
private void DrawNotifications()
{
#if URP
UI.DrawNotification( !AssetInfo.MeetsMinimumVersion(WaterDynamicEffectsRenderFeature.MinBaseVersion), "Version mismatch, requires Stylized Water 2 v" + WaterDynamicEffectsRenderFeature.MinBaseVersion +".\n\nUpdate to avoid any issues or resolve (shader) errors", "Update", () => AssetInfo.OpenInPackageManager(), MessageType.Error);
UI.DrawNotification(UniversalRenderPipeline.asset == null, "The Universal Render Pipeline is not active", MessageType.Error);
using (new EditorGUI.DisabledGroupScope(Application.isPlaying))
{
UI.DrawNotification(!renderFeaturePresent, "The Dynamic Effects render feature hasn't be added to the default renderer", "Add", () =>
{
PipelineUtilities.AddRenderFeature<WaterDynamicEffectsRenderFeature>();
renderFeaturePresent = true;
renderFeature = PipelineUtilities.GetRenderFeature<WaterDynamicEffectsRenderFeature>() as WaterDynamicEffectsRenderFeature;
}, MessageType.Error);
}
if(Application.isPlaying && !renderFeaturePresent) EditorGUILayout.HelpBox("Exit play mode to perform this action", MessageType.Warning);
UI.DrawNotification(renderFeaturePresent && !renderFeatureEnabled, "The Dynamic Effects render feature is disabled", "Enable", () =>
{
PipelineUtilities.ToggleRenderFeature<WaterDynamicEffectsRenderFeature>(true);
renderFeatureEnabled = true;
}, MessageType.Warning);
#else
UI.DrawNotification("The Universal Render Pipeline package is not installed!", MessageType.Error);
#endif
}
public override void OnInspectorGUI()
{
EditorGUILayout.LabelField($"{AssetInfo.ASSET_NAME }: Dynamic Effects v{WaterDynamicEffectsRenderFeature.Version}", EditorStyles.centeredGreyMiniLabel);
EditorGUILayout.Space();
DrawNotifications();
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(renderer);
if (renderer.objectReferenceValue)
{
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PrefixLabel(new GUIContent(sortingLayer.displayName, sortingLayer.tooltip));
if (GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.Width(20)))
{
sortingLayer.intValue--;
}
EditorGUILayout.PropertyField(sortingLayer, GUIContent.none, GUILayout.MaxWidth(32));
if (GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.Width(20)))
{
sortingLayer.intValue++;
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
EditorGUILayout.PropertyField(displacementScale);
EditorGUILayout.PropertyField(foamAmount);
EditorGUILayout.PropertyField(normalStrength);
}
else
{
UI.DrawNotification("A renderer must be assigned", MessageType.Error);
}
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
DynamicEffect script = (DynamicEffect)target;
script.UpdateProperties();
}
UI.DrawFooter();
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2a5120fcd0004d968e3743c9037e7b9e
timeCreated: 1687595852
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/Editor/DynamicEffects/DynamicEffectInspector.cs
uploadId: 624484

View File

@ -0,0 +1,44 @@
using StylizedWater2.DynamicEffects;
using UnityEditor;
using UnityEngine;
namespace StylizedWater2
{
#if URP
partial class MaterialUI : ShaderGUI
{
private bool dynamicEffectsInitialized;
private bool deRenderFeaturePresent;
private bool deRenderFeatureEnabled;
partial void DrawDynamicEffectsUI()
{
if (!dynamicEffectsInitialized)
{
deRenderFeaturePresent = PipelineUtilities.GetRenderFeature<WaterDynamicEffectsRenderFeature>();
if(deRenderFeaturePresent) deRenderFeatureEnabled = PipelineUtilities.IsRenderFeatureEnabled<WaterDynamicEffectsRenderFeature>();
dynamicEffectsInitialized = true;
}
using (new EditorGUI.DisabledGroupScope(Application.isPlaying))
{
UI.DrawNotification(!deRenderFeaturePresent, "The Dynamic Effects extension is installed, but the render feature hasn't been setup on the default renderer", "Add", () =>
{
PipelineUtilities.AddRenderFeature<WaterDynamicEffectsRenderFeature>(name:"Stylized Water 2: Dynamic Effects");
deRenderFeaturePresent = true;
deRenderFeatureEnabled = true;
}, MessageType.Error);
}
if(Application.isPlaying && !deRenderFeaturePresent) EditorGUILayout.HelpBox("Exit play mode to perform this action", MessageType.Warning);
UI.DrawNotification(deRenderFeaturePresent && !deRenderFeatureEnabled, "The Dynamic Effects render feature is disabled", "Enable", () =>
{
PipelineUtilities.ToggleRenderFeature<WaterDynamicEffectsRenderFeature>(true);
deRenderFeatureEnabled = true;
}, MessageType.Warning);
}
}
#endif
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 275e4867d5bf49a2897ecc3c45d916ff
timeCreated: 1693473616
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/Editor/DynamicEffects/MaterialUI.DynamicEffects.cs
uploadId: 624484

View File

@ -0,0 +1,254 @@
#if URP
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace StylizedWater2.DynamicEffects
{
[CustomEditor(typeof(WaterDynamicEffectsRenderFeature))]
public class RenderFeatureEditor : Editor
{
private SerializedProperty settings;
private SerializedProperty renderRange;
private SerializedProperty fadePercentage;
private SerializedProperty texelsPerUnit;
private SerializedProperty maxResolution;
private SerializedProperty enableDisplacement;
private SerializedProperty enableNormals;
private SerializedProperty halfResolutionNormals;
private SerializedProperty normalMipmaps;
private SerializedProperty ignoreSceneView;
private SerializedProperty displacementNormalShader;
[MenuItem("Window/Stylized Water 2/Set up Dynamic Effects", false, 3000)]
private static void SetupRenderers()
{
if (PipelineUtilities.RenderFeatureMissing<WaterDynamicEffectsRenderFeature>(out ScriptableRendererData[] renderers))
{
string[] rendererNames = new string[renderers.Length];
for (int i = 0; i < rendererNames.Length; i++)
{
rendererNames[i] = "• " + renderers[i].name;
}
if (EditorUtility.DisplayDialog("Dynamic Effects", $"The Dynamic Effects render feature hasn't been added to the following renderers:\n\n" +
String.Join(Environment.NewLine, rendererNames) +
$"\n\nThis is required for rendering to take effect.", "Setup", "Ignore"))
{
PipelineUtilities.SetupRenderFeature<WaterDynamicEffectsRenderFeature>(name:"Stylized Water 2: Dynamic Effects");
}
}
else
{
EditorUtility.DisplayDialog(AssetInfo.ASSET_NAME, "The Dynamic Effects render feature has already been added to your default renderers", "Ok");
}
}
[MenuItem("Window/Analysis/Dynamic Effects debugger", false, 0)]
private static void OpenDebugger()
{
DynamicEffectsBufferDebugger.Open();
}
void OnEnable()
{
settings = serializedObject.FindProperty("settings");
renderRange = settings.FindPropertyRelative("renderRange");
fadePercentage = settings.FindPropertyRelative("fadePercentage");
texelsPerUnit = settings.FindPropertyRelative("texelsPerUnit");
maxResolution = settings.FindPropertyRelative("maxResolution");
enableDisplacement = settings.FindPropertyRelative("enableDisplacement");
enableNormals = settings.FindPropertyRelative("enableNormals");
halfResolutionNormals = settings.FindPropertyRelative("halfResolutionNormals");
normalMipmaps = settings.FindPropertyRelative("normalMipmaps");
ignoreSceneView = settings.FindPropertyRelative("ignoreSceneView");
displacementNormalShader = serializedObject.FindProperty("displacementNormalShader");
if (target.name == "NewWaterDynamicEffectsRenderFeature") target.name = "Stylized Water 2: Dynamic Effects";
}
public override void OnInspectorGUI()
{
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.LabelField($"Version {WaterDynamicEffectsRenderFeature.Version}", EditorStyles.miniLabel);
if (GUILayout.Button(new GUIContent(" Documentation", EditorGUIUtility.FindTexture("_Help"))))
{
Application.OpenURL("https://staggart.xyz/unity/stylized-water-2/sw2-dynamic-effects-docs/");
}
if (GUILayout.Button(new GUIContent(" Debugger", EditorGUIUtility.IconContent("Profiler.Rendering").image, "Inspect the render buffer output")))
{
OpenDebugger();
}
}
EditorGUILayout.Space();
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(renderRange);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(fadePercentage, new GUIContent("Fade range (%)", fadePercentage.tooltip));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.PropertyField(texelsPerUnit);
EditorGUILayout.PropertyField(maxResolution);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Space(EditorGUIUtility.labelWidth);
EditorGUILayout.HelpBox($"Current resolution: {WaterDynamicEffectsRenderFeature.CalculateResolution(renderRange.floatValue, texelsPerUnit.intValue, maxResolution.intValue)}px", MessageType.None);
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(enableDisplacement);
EditorGUILayout.PropertyField(enableNormals);
using (new EditorGUI.DisabledGroupScope(enableNormals.boolValue == false))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(normalMipmaps);
EditorGUILayout.PropertyField(halfResolutionNormals);
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(ignoreSceneView);
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
//base.OnInspectorGUI();
if (displacementNormalShader.objectReferenceValue == null)
{
EditorGUILayout.HelpBox("Internal shader not referenced!", MessageType.Error);
if (GUILayout.Button("Find & assign"))
{
displacementNormalShader.objectReferenceValue = Shader.Find("Hidden/StylizedWater2/DisplacementToNormals");
serializedObject.ApplyModifiedProperties();
}
}
UI.DrawFooter();
}
}
public class DynamicEffectsBufferDebugger : EditorWindow
{
private const int m_width = 550;
private const int m_height = 300;
#if SWS_DEV
[MenuItem("SWS/Debug/Dynamic Effects Buffers")]
#endif
public static void Open()
{
DynamicEffectsBufferDebugger window = GetWindow<DynamicEffectsBufferDebugger>(false);
window.titleContent = new GUIContent("Dynamic Effects Debugger", Resources.Load<Texture>("dynamic-effect-icon-256px"));
window.autoRepaintOnSceneChange = true;
window.minSize = new Vector2(m_width, m_height);
//window.maxSize = new Vector2(m_width, m_height);
window.Show();
}
private float width = 300f;
private Vector2 scrollPos;
private ColorWriteMask colorMask = ColorWriteMask.All;
private int colorChannel = 1;
private void OnGUI()
{
Repaint();
width = (Mathf.Min(this.position.height, this.position.width) * 0.8f) - 10f;
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
RenderTexture interactionData = Shader.GetGlobalTexture("_WaterDynamicEffectsBuffer") as RenderTexture;
RenderTexture interactionNormals = Shader.GetGlobalTexture("_WaterDynamicEffectsNormals") as RenderTexture;
using (new EditorGUILayout.HorizontalScope())
{
using (new EditorGUILayout.VerticalScope())
{
DrawTexture("Data", interactionData);
}
using (new EditorGUILayout.VerticalScope())
{
DrawTexture("Normals", interactionNormals);
}
}
EditorGUILayout.EndScrollView();
}
private void DrawTexture(string label, Texture texture)
{
if (!texture) return;
EditorGUILayout.LabelField($"{label} ({texture.width}px @ {(UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(texture) / 1024f / 1024f).ToString("F2")}mb)", EditorStyles.boldLabel);
Rect rect = EditorGUILayout.GetControlRect();
Rect position = EditorGUI.PrefixLabel(rect, GUIUtility.GetControlID(FocusType.Passive), GUIContent.none);
position.width = width;
//colorChannel = EditorGUI.Popup(position, "Channel mask", colorChannel, new string[] { "RGB", "R", "G", "B", "A" });
colorChannel = (int)GUI.Toolbar(position, colorChannel, new GUIContent[] { new GUIContent("RGBA"), new GUIContent("RGB"), new GUIContent("R"), new GUIContent("G"), new GUIContent("B"), new GUIContent("A") });
switch (colorChannel)
{
case 1: colorMask = ColorWriteMask.All;
break;
case 2: colorMask = ColorWriteMask.Red;
break;
case 3: colorMask = ColorWriteMask.Green;
break;
case 4: colorMask = ColorWriteMask.Blue;
break;
case 5: colorMask = ColorWriteMask.Alpha;
break;
}
rect.y += 17f;
rect.height = width;
rect.width = width;
if (colorChannel == 0) //RGBA
{
EditorGUI.DrawTextureTransparent(rect, texture, ScaleMode.ScaleToFit, 1f);
}
else if (colorMask == ColorWriteMask.Alpha)
{
EditorGUI.DrawTextureAlpha(rect, texture, ScaleMode.ScaleToFit, 1f, 0);
}
else
{
EditorGUI.DrawPreviewTexture(rect, texture, null, ScaleMode.ScaleToFit, 1f, 0, colorMask);
}
GUILayout.Space(rect.height);
}
}
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 14f65f2f73cd492cb3613df6895e8b1c
timeCreated: 1686941926
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/Editor/DynamicEffects/RenderFeatureEditor.cs
uploadId: 624484

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 445ab374ccc234fa49ac2dae2ce7adc4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: d9853b2780ac1bc49a300a188b57db58
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/Editor/Resources/DynamicEffects/dynamic-effect-icon-256px.png
uploadId: 624484

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 96f943c6e1df44b70837834e0f38ff14
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
using System;
using UnityEditor;
using UnityEngine;
namespace StylizedWater2.UnderwaterRendering
{
[CustomEditor(typeof(UnderwaterRenderFeature))]
public class RenderFeatureEditor : Editor
{
private SerializedProperty resources;
private SerializedProperty settings;
private SerializedProperty allowBlur;
private SerializedProperty allowDistortion;
private SerializedProperty distortionMode;
private SerializedProperty directionalCaustics;
private SerializedProperty accurateDirectionalCaustics;
private SerializedProperty waterlineRefraction;
private void OnEnable()
{
resources = serializedObject.FindProperty("resources");
settings = serializedObject.FindProperty("settings");
allowBlur = settings.FindPropertyRelative("allowBlur");
allowDistortion = settings.FindPropertyRelative("allowDistortion");
distortionMode = settings.FindPropertyRelative("distortionMode");
directionalCaustics = settings.FindPropertyRelative("directionalCaustics");
accurateDirectionalCaustics = settings.FindPropertyRelative("accurateDirectionalCaustics");
waterlineRefraction = settings.FindPropertyRelative("waterlineRefraction");
}
public override void OnInspectorGUI()
{
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.LabelField($"Version {UnderwaterRenderer.Version}", EditorStyles.miniLabel);
}
EditorGUILayout.Space();
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Quality/Performance", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(allowBlur);
EditorGUILayout.PropertyField(allowDistortion);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(distortionMode);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(directionalCaustics);
if (directionalCaustics.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(accurateDirectionalCaustics);
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(waterlineRefraction);
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
if (resources.objectReferenceValue == null)
{
EditorGUILayout.HelpBox("Internal shader resources object not referenced!", MessageType.Error);
if (GUILayout.Button("Find & assign"))
{
resources.objectReferenceValue = UnderwaterResources.Find();
serializedObject.ApplyModifiedProperties();
}
}
UI.DrawFooter();
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e66021c01d384f49be2b52b0d3690799
timeCreated: 1699267684
AssetOrigin:
serializedVersion: 1
productId: 185030
packageName: Underwater Rendering for Stylized Water 2 (Extension)
packageVersion: 1.2.1
assetPath: Assets/StylizedWater2/Editor/Underwater/RenderFeatureEditor.cs
uploadId: 628925

View File

@ -0,0 +1,297 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
#if URP
using UnityEngine.Rendering.Universal;
#endif
namespace StylizedWater2.UnderwaterRendering
{
[CustomEditor(typeof(UnderwaterRenderer))]
public class UnderwaterRendererInspector : Editor
{
private UnderwaterRenderer renderer;
private SerializedProperty waterLevelSource;
private SerializedProperty waterLevel;
private SerializedProperty waterLevelTransform;
private SerializedProperty waterLevelPadding;
private SerializedProperty waterMaterial;
private SerializedProperty dynamicMaterial;
private SerializedProperty useVolumeBlending;
private SerializedProperty startDistance;
private SerializedProperty fogDensity;
private SerializedProperty heightFogDepth;
private SerializedProperty heightFogDensity;
private SerializedProperty heightFogBrightness;
private SerializedProperty fogBrightness;
private SerializedProperty subsurfaceStrength;
private SerializedProperty causticsStrength;
private SerializedProperty distortionStrength;
private SerializedProperty distortionFrequency;
private SerializedProperty distortionSpeed;
private SerializedProperty offset;
private SerializedProperty waterLineThickness;
private SerializedProperty enableBlur;
private SerializedProperty enableDistortion;
#if URP
private bool renderFeaturePresent;
private bool renderFeatureEnabled;
private UnderwaterRenderFeature renderFeature;
private Editor renderFeatureEditor;
#endif
private void OnEnable()
{
renderer = (UnderwaterRenderer)target;
waterLevelSource = serializedObject.FindProperty("waterLevelSource");
waterLevel = serializedObject.FindProperty("waterLevel");
waterLevelTransform = serializedObject.FindProperty("waterLevelTransform");
waterLevelPadding = serializedObject.FindProperty("waterLevelPadding");
waterMaterial = serializedObject.FindProperty("waterMaterial");
dynamicMaterial = serializedObject.FindProperty("dynamicMaterial");
useVolumeBlending = serializedObject.FindProperty("useVolumeBlending");
startDistance = serializedObject.FindProperty("startDistance");
fogDensity = serializedObject.FindProperty("fogDensity");
heightFogDepth = serializedObject.FindProperty("heightFogDepth");
heightFogDensity = serializedObject.FindProperty("heightFogDensity");
heightFogBrightness = serializedObject.FindProperty("heightFogBrightness");
fogBrightness = serializedObject.FindProperty("fogBrightness");
subsurfaceStrength = serializedObject.FindProperty("subsurfaceStrength");
causticsStrength = serializedObject.FindProperty("causticsStrength");
distortionStrength = serializedObject.FindProperty("distortionStrength");
distortionFrequency = serializedObject.FindProperty("distortionFrequency");
distortionSpeed = serializedObject.FindProperty("distortionSpeed");
offset = serializedObject.FindProperty("offset");
waterLineThickness = serializedObject.FindProperty("waterLineThickness");
enableBlur = serializedObject.FindProperty("enableBlur");
enableDistortion = serializedObject.FindProperty("enableDistortion");
#if URP
renderFeaturePresent = PipelineUtilities.RenderFeatureAdded<UnderwaterRenderFeature>();
renderFeatureEnabled = PipelineUtilities.IsRenderFeatureEnabled<UnderwaterRenderFeature>();
renderFeature = PipelineUtilities.GetRenderFeature<UnderwaterRenderFeature>() as UnderwaterRenderFeature;
#endif
}
public override void OnInspectorGUI()
{
EditorGUILayout.LabelField("Version " + UnderwaterRenderer.Version, EditorStyles.centeredGreyMiniLabel);
#if URP
DrawNotifications();
EditorGUI.BeginChangeCheck();
serializedObject.Update();
EditorGUILayout.LabelField("Material", EditorStyles.boldLabel);
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.PropertyField(waterMaterial);
EditorGUI.BeginDisabledGroup(waterMaterial.objectReferenceValue == null);
if (GUILayout.Button("Edit", EditorStyles.miniButton, GUILayout.Width(50f)))
{
Selection.activeObject = waterMaterial.objectReferenceValue;
}
EditorGUI.EndDisabledGroup();
}
UI.DrawNotification(waterMaterial.objectReferenceValue == null, "The water material used by the water plane must be assigned", MessageType.Error);
UI.DrawNotification(renderer.waterMaterial && renderer.waterMaterial.GetInt("_Cull") != (int)CullMode.Off, "The water material is not double-sided", "Make it so", () =>
{
StylizedWaterEditor.DisableCullingForMaterial(renderer.waterMaterial);
}, MessageType.Error);
if (waterMaterial.objectReferenceValue != null)
{
EditorGUILayout.PropertyField(dynamicMaterial);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Water level", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(waterLevelSource, new GUIContent("Source", waterLevelSource.tooltip));
if (waterLevelSource.intValue == (int)UnderwaterRenderer.WaterLevelSource.FixedValue)
{
EditorGUILayout.PropertyField(waterLevel);
}
else
{
EditorGUILayout.PropertyField(waterLevelTransform);
}
EditorGUILayout.PropertyField(waterLevelPadding);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(useVolumeBlending);
if (EditorGUI.EndChangeCheck())
{
renderer.GetVolumeSettings();
}
if (!useVolumeBlending.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Fog (distance from camera)", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(startDistance);
EditorGUILayout.PropertyField(fogDensity);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Fog (distance from water)", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(heightFogDepth);
EditorGUILayout.PropertyField(heightFogDensity);
EditorGUILayout.PropertyField(heightFogBrightness);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Multipliers", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(fogBrightness);
EditorGUILayout.PropertyField(subsurfaceStrength);
EditorGUILayout.PropertyField(causticsStrength);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Distortion", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(distortionStrength);
EditorGUILayout.PropertyField(distortionFrequency);
EditorGUILayout.PropertyField(distortionSpeed);
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Lens", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(offset);
EditorGUILayout.PropertyField(waterLineThickness);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(enableBlur);
EditorGUILayout.PropertyField(enableDistortion);
if (renderFeature)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Render feature settings", EditorStyles.boldLabel);
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
{
if (!renderFeatureEditor) renderFeatureEditor = Editor.CreateEditor(renderFeature);
SerializedObject serializedRendererFeaturesEditor = renderFeatureEditor.serializedObject;
serializedRendererFeaturesEditor.Update();
EditorGUI.BeginChangeCheck();
renderFeatureEditor.OnInspectorGUI();
if (EditorGUI.EndChangeCheck())
{
serializedRendererFeaturesEditor.ApplyModifiedProperties();
EditorUtility.SetDirty(renderFeature);
}
}
}
}
if (EditorGUI.EndChangeCheck())
{
renderer.UpdateProperties();
serializedObject.ApplyModifiedProperties();
}
UI.DrawFooter();
#else
EditorGUILayout.HelpBox("The Stylized Water 2 asset or the Universal Render Pipeline is not installed.", MessageType.Error);
#endif
}
private void DrawNotifications()
{
#if URP
UI.DrawNotification( !AssetInfo.MeetsMinimumVersion(UnderwaterRenderer.MinBaseVersion), "Version mismatch, requires Stylized Water 2 v" + UnderwaterRenderer.MinBaseVersion +".\n\nUpdate to avoid any issues or resolve (shader) errors", "Update", () => AssetInfo.OpenInPackageManager(), MessageType.Error);
UI.DrawNotification(UniversalRenderPipeline.asset == null, "The Universal Render Pipeline is not active", MessageType.Error);
#if !UNITY_2021_1_OR_NEWER //No MSAA on depth texture yet
UI.DrawNotification(UniversalRenderPipeline.asset && UniversalRenderPipeline.asset.msaaSampleCount > 1, "MSAA is enabled, this causes artifacts in the fog", "Disable",
() =>
{
UniversalRenderPipeline.asset.msaaSampleCount = 1;
EditorUtility.SetDirty(UniversalRenderPipeline.asset);
},
MessageType.Warning);
#endif
using (new EditorGUI.DisabledGroupScope(Application.isPlaying))
{
UI.DrawNotification(!renderFeaturePresent, "The underwater render feature hasn't be added to the default renderer", "Add", () =>
{
PipelineUtilities.AddRenderFeature<UnderwaterRenderFeature>();
renderFeaturePresent = true;
renderFeature = PipelineUtilities.GetRenderFeature<UnderwaterRenderFeature>() as UnderwaterRenderFeature;
}, MessageType.Error);
}
if(Application.isPlaying && !renderFeaturePresent) EditorGUILayout.HelpBox("Exit play mode to perform this action", MessageType.Warning);
UI.DrawNotification(renderFeaturePresent && !renderFeatureEnabled, "The underwater render feature is disabled", "Enable", () =>
{
PipelineUtilities.ToggleRenderFeature<UnderwaterRenderFeature>(true);
renderFeatureEnabled = true;
}, MessageType.Warning);
#endif
}
[MenuItem("GameObject/3D Object/Water/Underwater rendering", false, 2000)]
[MenuItem("Window/Stylized Water 2/Set up underwater rendering", false, 3000)]
private static void CreateUnderwaterRenderer()
{
#if UNITY_2023_1_OR_NEWER
UnderwaterRenderer r = FindFirstObjectByType<UnderwaterRenderer>();
#else
UnderwaterRenderer r = FindObjectOfType<UnderwaterRenderer>();
#endif
if (r)
{
EditorUtility.DisplayDialog("Stylized Water 2", "An Underwater Renderer instance already exists. Only one can be created", "OK");
return;
}
GameObject obj = new GameObject("Underwater Renderer", typeof(UnderwaterRenderer));
Undo.RegisterCreatedObjectUndo(obj, "Created Underwater Renderer");
r = obj.GetComponent<UnderwaterRenderer>();
if (Selection.activeGameObject) obj.transform.parent = Selection.activeGameObject.transform;
Selection.activeObject = obj;
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 126e2e13d1098cb4eb9a379090491a3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 185030
packageName: Underwater Rendering for Stylized Water 2 (Extension)
packageVersion: 1.2.1
assetPath: Assets/StylizedWater2/Editor/Underwater/UnderwaterRendererInspector.cs
uploadId: 628925

View File

@ -0,0 +1,96 @@
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace StylizedWater2.UnderwaterRendering
{
[CustomEditor(typeof(UnderwaterTrigger))]
class UnderwaterTriggerEditor : Editor
{
private SerializedProperty triggerTag;
private SerializedProperty toggleRendering;
private SerializedProperty waterMaterial;
private SerializedProperty changeWaterLevel;
private SerializedProperty useTransformForWaterlevel;
private SerializedProperty waterLevel;
private void OnEnable()
{
triggerTag = serializedObject.FindProperty("triggerTag");
toggleRendering = serializedObject.FindProperty("toggleRendering");
waterMaterial = serializedObject.FindProperty("waterMaterial");
changeWaterLevel = serializedObject.FindProperty("changeWaterLevel");
useTransformForWaterlevel = serializedObject.FindProperty("useTransformForWaterlevel");
waterLevel = serializedObject.FindProperty("waterLevel");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
Rect rect = EditorGUILayout.GetControlRect();
triggerTag.stringValue = EditorGUI.TagField(rect, new GUIContent(triggerTag.displayName, triggerTag.tooltip), triggerTag.stringValue);
GameObject trigger = GameObject.FindGameObjectWithTag(triggerTag.stringValue);
if (!trigger)
{
EditorGUILayout.HelpBox($"No GameObject found with the tag \"{triggerTag.stringValue}\"", MessageType.Error);
}
else
{
EditorGUILayout.HelpBox($"GameObject found with tag: {trigger.name}", MessageType.Info);
Collider collider = trigger.GetComponent<Collider>();
if (collider == null)
{
EditorGUILayout.HelpBox("Trigger object does not have a collider component added to it", MessageType.Error);
}
else
{
if (!collider.isTrigger) EditorGUILayout.HelpBox("Trigger object collider has the \"Is Trigger\" checkbox disabled", MessageType.Error);
}
Rigidbody rb = trigger.GetComponent<Rigidbody>();
if (!rb)
{
EditorGUILayout.HelpBox("Trigger object does not have a Rigidbody component added to it", MessageType.Error);
}
else
{
if (!rb.isKinematic) EditorGUILayout.HelpBox("Trigger object Rigidbody has the \"Is Kinematic\" checkbox disabled, expect it to fall.", MessageType.Error);
}
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(toggleRendering);
if(toggleRendering.boolValue) EditorGUILayout.HelpBox($"Current state. Rendering enabled: {UnderwaterRenderer.EnableRendering}", MessageType.None);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(waterMaterial);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(changeWaterLevel);
if (changeWaterLevel.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(useTransformForWaterlevel);
if (useTransformForWaterlevel.boolValue == false) EditorGUILayout.PropertyField(waterLevel);
EditorGUI.indentLevel--;
}
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 86d6486a181b40f3a04b0b6e9571ae56
timeCreated: 1699268819
AssetOrigin:
serializedVersion: 1
productId: 185030
packageName: Underwater Rendering for Stylized Water 2 (Extension)
packageVersion: 1.2.1
assetPath: Assets/StylizedWater2/Editor/Underwater/UnderwaterTriggerEditor.cs
uploadId: 628925

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e147d73888234476aacbc6ed8695c554
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2360609270184863290
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DynamicEffect_Default
m_Shader: {fileID: 4800000, guid: 4f20f4fd10294583adbf69be180bb68e, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 12a8a0e9cb1136a4e8896157fee235c5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _FoamStrength: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Height: 1
- _HeightScale: 1
- _Metallic: 0
- _NormalStrength: 1
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _AnimationSpeed: {r: 0, g: 0, b: 0, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: d503ca33d1a0ac14bbc88ea83586fb12
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 257865
packageName: Dynamic Effects for Stylized Water 2 (Extension)
packageVersion: 1.0.1
assetPath: Assets/StylizedWater2/Materials/DynamicEffects/DynamicEffect_Default.mat
uploadId: 624484

View File

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DynamicEffect_DirectionalRipples
m_Shader: {fileID: 4800000, guid: 4f20f4fd10294583adbf69be180bb68e, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 3ad35bf2cc2e84a4488290e3f21a4d04, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 455f1bf1825a2bc4bbb7f0442b53ba2b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 2800000, guid: 39c1e5fea43f415439e6cc3f2352d449, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlendOp: 0
- _FoamStrength: 0
- _Height: 0.26
- _HeightScale: 1
- _NormalStrength: 1
m_Colors:
- _AnimationSpeed: {r: 0, g: -0.05, b: 0, a: 0}
- _MaskAnimationSpeed: {r: 0, g: 0, b: 0, a: 0}
- _Params: {r: 0.1, g: 1, b: 5, a: 1}
- _Speed: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []

Some files were not shown because too many files have changed in this diff Show More