feat: lit transparent complex lit urp shader with wobble
This commit is contained in:
parent
5b4248c5bc
commit
26df04dbf0
162
Assets/Materials/GlossyPBRRipples.mat
Normal file
162
Assets/Materials/GlossyPBRRipples.mat
Normal file
@ -0,0 +1,162 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-2267058320971115879
|
||||
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: GlossyPBRRipples
|
||||
m_Shader: {fileID: 4800000, guid: 8a7f26cb4a0b4d446b2ca031d3ff37df, 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: 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}
|
||||
- _MetallicSpecGlossMap:
|
||||
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
|
||||
- _AlphaTestToggle: 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
|
||||
- _Emission: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _EnvironmentalReflections: 0
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0.681
|
||||
- _MetallicSpecGlossMapToggle: 0
|
||||
- _MetallicSpecToggle: 0
|
||||
- _NormalMapToggle: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _OcclusionToggle: 0
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.91
|
||||
- _SmoothnessSource: 0
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 0
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
- _base_alpha: 0.5
|
||||
- _impact_amplitude: 6
|
||||
- _impact_anim: 0
|
||||
- _impact_blend: 0
|
||||
- _impact_density: 5
|
||||
- _impact_frequency: 5
|
||||
- _impact_radius: 1.1
|
||||
- _shield_color_brightness: 10
|
||||
- _shield_intensity: 2
|
||||
- _shield_pulse_amplitude: 1
|
||||
- _shield_pulse_blend: 1
|
||||
- _shield_pulse_density: 1
|
||||
- _shield_pulse_frequency: 1
|
||||
- _shield_pulse_radius: 1
|
||||
- _shield_size: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 0.75, b: 0.75, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.5471698, g: 0.5471698, b: 0.5471698, a: 1}
|
||||
- _impact_origin: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _rotation: {r: 0.1, g: 0, b: 0, a: 1}
|
||||
- _shield_color: {r: 0, g: 0, b: 1, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
8
Assets/Materials/GlossyPBRRipples.mat.meta
Normal file
8
Assets/Materials/GlossyPBRRipples.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78cb0d90576fe15439f3fd294d5eaaba
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3015
Assets/Materials/GlowingWireFrame.shadergraph
Normal file
3015
Assets/Materials/GlowingWireFrame.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d42a1e828399e3419e843ccaf360423
|
||||
guid: 7bbccc5c40aae3e478e0205f25cd16ef
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@ -1,642 +0,0 @@
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||
"m_ObjectId": "f852c3228dbb4591896a0d27e8832393",
|
||||
"m_Properties": [],
|
||||
"m_Keywords": [],
|
||||
"m_Dropdowns": [],
|
||||
"m_CategoryData": [],
|
||||
"m_Nodes": [
|
||||
{
|
||||
"m_Id": "6929c9dd7a084a88bdec920b898bdac6"
|
||||
},
|
||||
{
|
||||
"m_Id": "d752680a34384be29f6fcb555e3615ec"
|
||||
},
|
||||
{
|
||||
"m_Id": "f71842fc9a7749d29e0bc57d3f9012fe"
|
||||
},
|
||||
{
|
||||
"m_Id": "09982701fedd40d78500ca0aaa8d4c9b"
|
||||
},
|
||||
{
|
||||
"m_Id": "83c8ee5e4a114b07b3c3fed8032e3197"
|
||||
},
|
||||
{
|
||||
"m_Id": "86dff511efc34e059ea69079a0c66e4b"
|
||||
},
|
||||
{
|
||||
"m_Id": "56608722645f44b197db281df47fbc0a"
|
||||
},
|
||||
{
|
||||
"m_Id": "71319502054540aaa54a3ddf8587d9ac"
|
||||
},
|
||||
{
|
||||
"m_Id": "03d8e809db6e42db8906183335778f00"
|
||||
}
|
||||
],
|
||||
"m_GroupDatas": [],
|
||||
"m_StickyNoteDatas": [],
|
||||
"m_Edges": [],
|
||||
"m_VertexContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "6929c9dd7a084a88bdec920b898bdac6"
|
||||
},
|
||||
{
|
||||
"m_Id": "d752680a34384be29f6fcb555e3615ec"
|
||||
},
|
||||
{
|
||||
"m_Id": "f71842fc9a7749d29e0bc57d3f9012fe"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_FragmentContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 200.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "09982701fedd40d78500ca0aaa8d4c9b"
|
||||
},
|
||||
{
|
||||
"m_Id": "83c8ee5e4a114b07b3c3fed8032e3197"
|
||||
},
|
||||
{
|
||||
"m_Id": "86dff511efc34e059ea69079a0c66e4b"
|
||||
},
|
||||
{
|
||||
"m_Id": "56608722645f44b197db281df47fbc0a"
|
||||
},
|
||||
{
|
||||
"m_Id": "71319502054540aaa54a3ddf8587d9ac"
|
||||
},
|
||||
{
|
||||
"m_Id": "03d8e809db6e42db8906183335778f00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_PreviewData": {
|
||||
"serializedMesh": {
|
||||
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||
"m_Guid": ""
|
||||
},
|
||||
"preventRotation": false
|
||||
},
|
||||
"m_Path": "Shader Graphs",
|
||||
"m_GraphPrecision": 1,
|
||||
"m_PreviewMode": 2,
|
||||
"m_OutputNode": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_ActiveTargets": [
|
||||
{
|
||||
"m_Id": "759ffdfdaf1c4c68ac61f149023be8e6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "03d8e809db6e42db8906183335778f00",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.Occlusion",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "e1137cc030fa4c979370bcabc63292b7"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.Occlusion"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "09982701fedd40d78500ca0aaa8d4c9b",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.BaseColor",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "f647c0b8fafe4302a28c0254273544e4"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
|
||||
"m_ObjectId": "0c3b7926f9f34cd5971c25f885258da5",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Normal (Tangent Space)",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "NormalTS",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 3
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "1bb234ddbdec4b4d828eaa4bc86423d8",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Smoothness",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Smoothness",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": 0.5,
|
||||
"m_DefaultValue": 0.5,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
|
||||
"m_ObjectId": "2aeae748e2ae460dadb100d99ea5cf2e",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Position",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Position",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "56608722645f44b197db281df47fbc0a",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.Smoothness",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "1bb234ddbdec4b4d828eaa4bc86423d8"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.Smoothness"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
|
||||
"m_ObjectId": "58957bbacaa44c37a3d0469a71446f4b",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Tangent",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Tangent",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
|
||||
"m_ObjectId": "5996287d54c84cb5adccade6786cfe03",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Normal",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Normal",
|
||||
"m_StageCapability": 1,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "6929c9dd7a084a88bdec920b898bdac6",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Position",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "2aeae748e2ae460dadb100d99ea5cf2e"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Position"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "71319502054540aaa54a3ddf8587d9ac",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.Emission",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "909f3b4029fd4d4fbc9a1eab27b5189b"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.Emission"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
|
||||
"m_ObjectId": "759ffdfdaf1c4c68ac61f149023be8e6",
|
||||
"m_Datas": [],
|
||||
"m_ActiveSubTarget": {
|
||||
"m_Id": "ee6d19387b3c441c8772166e0add2e63"
|
||||
},
|
||||
"m_AllowMaterialOverride": false,
|
||||
"m_SurfaceType": 0,
|
||||
"m_ZTestMode": 4,
|
||||
"m_ZWriteControl": 0,
|
||||
"m_AlphaMode": 0,
|
||||
"m_RenderFace": 2,
|
||||
"m_AlphaClip": false,
|
||||
"m_CastShadows": true,
|
||||
"m_ReceiveShadows": true,
|
||||
"m_SupportsLODCrossFade": false,
|
||||
"m_CustomEditorGUI": "",
|
||||
"m_SupportVFX": false
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "83c8ee5e4a114b07b3c3fed8032e3197",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.NormalTS",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "0c3b7926f9f34cd5971c25f885258da5"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.NormalTS"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "86dff511efc34e059ea69079a0c66e4b",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.Metallic",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "b5035b2a70814f45ae62f614f82046fb"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.Metallic"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
|
||||
"m_ObjectId": "909f3b4029fd4d4fbc9a1eab27b5189b",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Emission",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Emission",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_ColorMode": 1,
|
||||
"m_DefaultColor": {
|
||||
"r": 0.0,
|
||||
"g": 0.0,
|
||||
"b": 0.0,
|
||||
"a": 1.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "b5035b2a70814f45ae62f614f82046fb",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Metallic",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Metallic",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "d752680a34384be29f6fcb555e3615ec",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Normal",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "5996287d54c84cb5adccade6786cfe03"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Normal"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "e1137cc030fa4c979370bcabc63292b7",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Ambient Occlusion",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Occlusion",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": 1.0,
|
||||
"m_DefaultValue": 1.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 2,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget",
|
||||
"m_ObjectId": "ee6d19387b3c441c8772166e0add2e63",
|
||||
"m_WorkflowMode": 1,
|
||||
"m_NormalDropOffSpace": 0,
|
||||
"m_ClearCoat": false,
|
||||
"m_BlendModePreserveSpecular": true
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
|
||||
"m_ObjectId": "f647c0b8fafe4302a28c0254273544e4",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Base Color",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "BaseColor",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": {
|
||||
"x": 0.5,
|
||||
"y": 0.5,
|
||||
"z": 0.5
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_ColorMode": 0,
|
||||
"m_DefaultColor": {
|
||||
"r": 0.5,
|
||||
"g": 0.5,
|
||||
"b": 0.5,
|
||||
"a": 1.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "f71842fc9a7749d29e0bc57d3f9012fe",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Tangent",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "58957bbacaa44c37a3d0469a71446f4b"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Tangent"
|
||||
}
|
||||
|
||||
115
Assets/Prefabs/NimbleZoneSphere Variant.prefab
Normal file
115
Assets/Prefabs/NimbleZoneSphere Variant.prefab
Normal file
@ -0,0 +1,115 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &1348511493726215435
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 30
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_CastShadows
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_MotionVectors
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_DynamicOccludee
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LightProbeUsage
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_RenderingLayerMask
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 718528fdc05822c4aacc4f77a39ecdb1, type: 2}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 04d4f548420aa714c92f89f38a108165, type: 2}
|
||||
- target: {fileID: 919132149155446097, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: NimbleZoneSphere Variant
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: HexSphere
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
7
Assets/Prefabs/NimbleZoneSphere Variant.prefab.meta
Normal file
7
Assets/Prefabs/NimbleZoneSphere Variant.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f203a425ae690043b270d1723b430ad
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Samples/JellyShader.meta
Normal file
8
Assets/Samples/JellyShader.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ce8cda91a8fab047a9d645e35700f23
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Example.meta
Normal file
9
Assets/Samples/JellyShader/Example.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa1e7e577de9c49408f94823ed212cc1
|
||||
folderAsset: yes
|
||||
timeCreated: 1507246503
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Example/Models.meta
Normal file
9
Assets/Samples/JellyShader/Example/Models.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6739b0b69f4f57941bbda9b80f3dd176
|
||||
folderAsset: yes
|
||||
timeCreated: 1493663059
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51208
Assets/Samples/JellyShader/Example/Models/High-Poly-Sphere.obj
Normal file
51208
Assets/Samples/JellyShader/Example/Models/High-Poly-Sphere.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,84 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc5f274d483f9d24b95d2f4a7eb88be9
|
||||
timeCreated: 1493663071
|
||||
licenseType: Store
|
||||
ModelImporter:
|
||||
serializedVersion: 19
|
||||
fileIDToRecycleName:
|
||||
100000: default
|
||||
100002: //RootNode
|
||||
400000: default
|
||||
400002: //RootNode
|
||||
2300000: default
|
||||
3300000: default
|
||||
4300000: default
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
serializedVersion: 2
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 0
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Example/Models/Materials.meta
Normal file
9
Assets/Samples/JellyShader/Example/Models/Materials.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf11418522fb3a846bee9a6073030adc
|
||||
folderAsset: yes
|
||||
timeCreated: 1493663071
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,178 @@
|
||||
%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: defaultMat
|
||||
m_Shader: {fileID: 4800000, guid: 8a7f26cb4a0b4d446b2ca031d3ff37df, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _ALPHAPREMULTIPLY_ON
|
||||
- _ENVIRONMENTREFLECTIONS_OFF
|
||||
- _RECEIVE_SHADOWS_OFF
|
||||
- _SPECULARHIGHLIGHTS_OFF
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords:
|
||||
- _CLEARCOAT
|
||||
- _SURFACE_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- DepthOnly
|
||||
- SHADOWCASTER
|
||||
m_LockedProperties:
|
||||
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: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ClearCoatMap:
|
||||
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}
|
||||
- _MetallicSpecGlossMap:
|
||||
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
|
||||
- _AlphaTestToggle: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Amplitude: 5
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BlendOp: 0
|
||||
- _BumpScale: 46.8
|
||||
- _ClearCoat: 0
|
||||
- _ClearCoatMask: 0.51
|
||||
- _ClearCoatSmoothness: 0.08
|
||||
- _ControlTime: 1.99
|
||||
- _Cull: 0
|
||||
- _Cutoff: 0.234
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _Emission: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _EnvironmentalReflections: 1
|
||||
- _Frequency: 300
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossinessSource: 0
|
||||
- _GlossyReflections: 1
|
||||
- _ImpactSpeed: 0.5
|
||||
- _MaxWaveDistortion: 2
|
||||
- _Metallic: 0.649
|
||||
- _MetallicSpecGlossMapToggle: 0
|
||||
- _MetallicSpecToggle: 0
|
||||
- _Mode: 0
|
||||
- _NormalMapToggle: 0
|
||||
- _OcclusionStrength: 0
|
||||
- _OcclusionToggle: 0
|
||||
- _Parallax: 0.02
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 0
|
||||
- _Shininess: 0
|
||||
- _Smoothness: 1
|
||||
- _SmoothnessSource: 0
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecSource: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 1
|
||||
- _UVSec: 0
|
||||
- _WaveFalloff: 1.61
|
||||
- _WaveSpeed: -2.21
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 0
|
||||
- _base_alpha: 0.5
|
||||
- _impact_amplitude: 6
|
||||
- _impact_anim: 0
|
||||
- _impact_blend: 0
|
||||
- _impact_density: 5
|
||||
- _impact_frequency: 5
|
||||
- _impact_radius: 1.1
|
||||
- _shield_color_brightness: 10
|
||||
- _shield_intensity: 2
|
||||
- _shield_pulse_amplitude: 1
|
||||
- _shield_pulse_blend: 1
|
||||
- _shield_pulse_density: 1
|
||||
- _shield_pulse_frequency: 1
|
||||
- _shield_pulse_radius: 1
|
||||
- _shield_size: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 0.7481065, b: 0.33490568, a: 0.36862746}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0.23529412}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _ImpactOrigin: {r: 25, g: 25, b: 0, a: 0}
|
||||
- _ModelOrigin: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _SpecColor: {r: 1, g: 1, b: 1, a: 0.6156863}
|
||||
- _impact_origin: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _rotation: {r: 0.1, g: 0, b: 0, a: 1}
|
||||
- _shield_color: {r: 0, g: 0, b: 1, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b425997046656b499075b77834259af
|
||||
timeCreated: 1493663071
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Example/Scenes.meta
Normal file
9
Assets/Samples/JellyShader/Example/Scenes.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1579d82fba038904e9d3d9cded8ce4e6
|
||||
folderAsset: yes
|
||||
timeCreated: 1493667125
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
501
Assets/Samples/JellyShader/Example/Scenes/ExampleScene.unity
Normal file
501
Assets/Samples/JellyShader/Example/Scenes/ExampleScene.unity
Normal file
@ -0,0 +1,501 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 0
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 4890085278179872738, guid: 1ac1d7b5446bd1345b08537c67b90617, type: 2}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &487304636 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 100000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
m_PrefabInstance: {fileID: 2060434464}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!135 &487304637
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 487304636}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Radius: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &487304640
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 487304636}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6c9b16efbc4e4cd408c6d7610e3066ee, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &942940043
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 942940048}
|
||||
- component: {fileID: 942940047}
|
||||
- component: {fileID: 942940045}
|
||||
- component: {fileID: 942940044}
|
||||
- component: {fileID: 942940049}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &942940044
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 942940043}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &942940045
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 942940043}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &942940047
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 942940043}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.01
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &942940048
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 942940043}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -3}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &942940049
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 942940043}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_RenderShadows: 1
|
||||
m_RequiresDepthTextureOption: 2
|
||||
m_RequiresOpaqueTextureOption: 2
|
||||
m_CameraType: 0
|
||||
m_Cameras: []
|
||||
m_RendererIndex: -1
|
||||
m_VolumeLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
m_VolumeTrigger: {fileID: 0}
|
||||
m_VolumeFrameworkUpdateModeOption: 2
|
||||
m_RenderPostProcessing: 0
|
||||
m_Antialiasing: 0
|
||||
m_AntialiasingQuality: 2
|
||||
m_StopNaN: 0
|
||||
m_Dithering: 0
|
||||
m_ClearDepth: 1
|
||||
m_AllowXRRendering: 1
|
||||
m_AllowHDROutput: 1
|
||||
m_UseScreenCoordOverride: 0
|
||||
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_RequiresDepthTexture: 0
|
||||
m_RequiresColorTexture: 0
|
||||
m_Version: 2
|
||||
m_TaaSettings:
|
||||
quality: 3
|
||||
frameInfluence: 0.1
|
||||
jitterScale: 1
|
||||
mipBias: 0
|
||||
varianceClampScale: 0.9
|
||||
contrastAdaptiveSharpening: 0
|
||||
--- !u!1 &1161057388
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1161057390}
|
||||
- component: {fileID: 1161057389}
|
||||
- component: {fileID: 1161057391}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &1161057389
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161057388}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1161057390
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161057388}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!114 &1161057391
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161057388}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 3
|
||||
m_UsePipelineSettings: 1
|
||||
m_AdditionalLightsShadowResolutionTier: 2
|
||||
m_LightLayerMask: 1
|
||||
m_RenderingLayers: 1
|
||||
m_CustomShadowLayers: 0
|
||||
m_ShadowLayerMask: 1
|
||||
m_ShadowRenderingLayers: 1
|
||||
m_LightCookieSize: {x: 1, y: 1}
|
||||
m_LightCookieOffset: {x: 0, y: 0}
|
||||
m_SoftShadowQuality: 0
|
||||
--- !u!1001 &2060434464
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2300000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 5e20463e1312b8f43b99301c132f0122, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 100000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 487304637}
|
||||
- targetCorrespondingSourceObject: {fileID: 100000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 487304640}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 942940048}
|
||||
- {fileID: 1161057390}
|
||||
- {fileID: 2060434464}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f928b5cc7e6a9ca41b1920896c2353ac
|
||||
timeCreated: 1493667137
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,66 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!850595691 &4890085278179872738
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: ExampleSceneSettings
|
||||
serializedVersion: 6
|
||||
m_GIWorkflowMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 1
|
||||
m_BakeBackend: 0
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 40
|
||||
m_Padding: 2
|
||||
m_LightmapCompression: 3
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 2
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 2
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 256
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVREnvironmentSampleCount: 512
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentImportanceSampling: 0
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_PVRTiledBaking: 0
|
||||
m_NumRaysToShootPerTexel: -1
|
||||
m_RespectSceneVisibilityWhenBakingGI: 0
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ac1d7b5446bd1345b08537c67b90617
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Scripts.meta
Normal file
9
Assets/Samples/JellyShader/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c967961565254514085dacc83b0c8e0c
|
||||
folderAsset: yes
|
||||
timeCreated: 1506985770
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/Samples/JellyShader/Scripts/JellyClickReceiver.cs
Normal file
37
Assets/Samples/JellyShader/Scripts/JellyClickReceiver.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class JellyClickReceiver : MonoBehaviour {
|
||||
|
||||
RaycastHit hit;
|
||||
Ray clickRay;
|
||||
|
||||
Renderer modelRenderer;
|
||||
float controlTime;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
modelRenderer = GetComponent<MeshRenderer>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
controlTime += Time.deltaTime;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
clickRay = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
if (Physics.Raycast(clickRay, out hit))
|
||||
{
|
||||
controlTime = 0;
|
||||
|
||||
modelRenderer.material.SetVector("_ModelOrigin", transform.position);
|
||||
modelRenderer.material.SetVector("_ImpactOrigin", hit.point);
|
||||
}
|
||||
}
|
||||
|
||||
modelRenderer.material.SetFloat("_ControlTime", controlTime);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c9b16efbc4e4cd408c6d7610e3066ee
|
||||
timeCreated: 1506985824
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Samples/JellyShader/Shaders.meta
Normal file
9
Assets/Samples/JellyShader/Shaders.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12b45238a37895745a829098d8acb415
|
||||
folderAsset: yes
|
||||
timeCreated: 1493664871
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
45
Assets/Samples/JellyShader/Shaders/JellyMaterial.mat
Normal file
45
Assets/Samples/JellyShader/Shaders/JellyMaterial.mat
Normal file
@ -0,0 +1,45 @@
|
||||
%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: JellyMaterial
|
||||
m_Shader: {fileID: 4800000, guid: f8e2acc75b227a44c8fb810f20e25443, 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:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _Amplitude: 0.1
|
||||
- _ControlTime: 0
|
||||
- _Frequency: 10
|
||||
- _Glossiness: 0.5
|
||||
- _ImpactSpeed: 0.2
|
||||
- _MaxWaveDistortion: 1
|
||||
- _Metallic: 0
|
||||
- _WaveFalloff: 4
|
||||
- _WaveSpeed: -5
|
||||
m_Colors:
|
||||
- _Color: {r: 0.31985295, g: 0.74264693, b: 0.85294116, a: 1}
|
||||
- _ImpactOrigin: {r: -5, g: 0, b: 0, a: 0}
|
||||
- _ModelOrigin: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e20463e1312b8f43b99301c132f0122
|
||||
timeCreated: 1493664981
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
114
Assets/Samples/JellyShader/Shaders/JellyShader.shader
Normal file
114
Assets/Samples/JellyShader/Shaders/JellyShader.shader
Normal file
@ -0,0 +1,114 @@
|
||||
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
|
||||
|
||||
Shader "Custom/JellyShader" {
|
||||
Properties {
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
||||
_Glossiness ("Smoothness", Range(0,1)) = 0.5
|
||||
_Metallic ("Metallic", Range(0,1)) = 0.0
|
||||
|
||||
_ControlTime ("Time", float) = 0
|
||||
_ModelOrigin ("Model Origin", Vector) = (0,0,0,0)
|
||||
_ImpactOrigin ("Impact Origin", Vector) = (-5,0,0,0)
|
||||
|
||||
_Frequency ("Frequency", Range(0, 1000)) = 10
|
||||
_Amplitude ("Amplitude", Range(0, 5)) = 0.1
|
||||
_WaveFalloff ("Wave Falloff", Range(1, 8)) = 4
|
||||
_MaxWaveDistortion ("Max Wave Distortion", Range(0.1, 2.0)) = 1
|
||||
_ImpactSpeed ("Impact Speed", Range(0, 10)) = 0.5
|
||||
_WaveSpeed ("Wave Speed", Range(-10, 10)) = -5
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderType"="Opaque"
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"UniversalMaterialType" = "SimpleLit"
|
||||
"LightMode"="UniversalForward"
|
||||
}
|
||||
LOD 200
|
||||
|
||||
// Render State Commands
|
||||
// Use same blending / depth states as Standard shader
|
||||
Blend[_SrcBlend][_DstBlend], [_SrcBlendAlpha][_DstBlendAlpha]
|
||||
ZWrite[_ZWrite]
|
||||
Cull[_Cull]
|
||||
AlphaToMask[_AlphaToMask]
|
||||
|
||||
HLSLPROGRAM
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
// -------------------------------------
|
||||
// Includes
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitForwardPass.hlsl"
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct Input {
|
||||
float2 uv_MainTex;
|
||||
};
|
||||
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
half4 _Color;
|
||||
|
||||
float _ControlTime;
|
||||
float4 _ModelOrigin;
|
||||
float4 _ImpactOrigin;
|
||||
|
||||
half _Frequency; //Base frequency for our waves.
|
||||
half _Amplitude; //Base amplitude for our waves.
|
||||
half _WaveFalloff; //How quickly our distortion should fall off given distance.
|
||||
half _MaxWaveDistortion; //Smaller number here will lead to larger distortion as the vertex approaches origin.
|
||||
half _ImpactSpeed; //How quickly our wave origin moves across the sphere.
|
||||
half _WaveSpeed; //Oscillation speed of an individual wave.
|
||||
|
||||
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
|
||||
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
|
||||
// #pragma instancing_options assumeuniformscaling
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
// put more per-instance properties here
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
void vert (inout appdata_base v) {
|
||||
float4 world_space_vertex = mul(unity_ObjectToWorld, v.vertex);
|
||||
|
||||
float4 direction = normalize(_ModelOrigin - _ImpactOrigin);
|
||||
float4 origin = _ImpactOrigin + _ControlTime * _ImpactSpeed * direction;
|
||||
|
||||
//Get the distance in world space from our vertex to the wave origin.
|
||||
float dist = distance(world_space_vertex, origin);
|
||||
|
||||
//Adjust our distance to be non-linear.
|
||||
dist = pow(dist, _WaveFalloff);
|
||||
|
||||
//Set the max amount a wave can be distorted based on distance.
|
||||
dist = max(dist, _MaxWaveDistortion);
|
||||
|
||||
//Convert direction and _ImpactOrigin to model space for later trig magic.
|
||||
float4 l_ImpactOrigin = mul(unity_WorldToObject, _ImpactOrigin);
|
||||
float4 l_direction = mul(unity_WorldToObject, direction);
|
||||
|
||||
//Magic
|
||||
float impactAxis = l_ImpactOrigin + dot((v.vertex - l_ImpactOrigin), l_direction);
|
||||
|
||||
v.vertex.xyz += v.normal * sin(impactAxis * _Frequency + _ControlTime * _WaveSpeed) * _Amplitude * (1 / dist);
|
||||
}
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o) {
|
||||
// Albedo comes from a texture tinted by color
|
||||
float4 c = _Color;
|
||||
//half4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
|
||||
o.Albedo = c.rgb;
|
||||
// Metallic and smoothness come from slider variables
|
||||
o.Metallic = _Metallic;
|
||||
o.Smoothness = _Glossiness;
|
||||
o.Alpha = c.a;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8e2acc75b227a44c8fb810f20e25443
|
||||
timeCreated: 1493664882
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -123,7 +123,7 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &8179553
|
||||
--- !u!1 &3628760
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -131,23 +131,23 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8179556}
|
||||
- component: {fileID: 8179555}
|
||||
- component: {fileID: 8179554}
|
||||
- component: {fileID: 3628763}
|
||||
- component: {fileID: 3628762}
|
||||
- component: {fileID: 3628761}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_Name: Point Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &8179554
|
||||
--- !u!114 &3628761
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8179553}
|
||||
m_GameObject: {fileID: 3628760}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
|
||||
@ -164,20 +164,20 @@ MonoBehaviour:
|
||||
m_LightCookieSize: {x: 1, y: 1}
|
||||
m_LightCookieOffset: {x: 0, y: 0}
|
||||
m_SoftShadowQuality: 0
|
||||
--- !u!108 &8179555
|
||||
--- !u!108 &3628762
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8179553}
|
||||
m_GameObject: {fileID: 3628760}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_Range: 17.48
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
@ -215,7 +215,7 @@ Light:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
@ -226,21 +226,21 @@ Light:
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &8179556
|
||||
--- !u!4 &3628763
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8179553}
|
||||
m_GameObject: {fileID: 3628760}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.42966053, y: -0.56159675, z: -0.09329218, w: 0.7009262}
|
||||
m_LocalPosition: {x: 150, y: 50, z: 0}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 2.8725471, y: 6.1180573, z: -72}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 29.837, y: -90, z: -45}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &201450952
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -309,6 +309,79 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &343400027
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 100002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: High-Poly-Sphere
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 30
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400002, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fc5f274d483f9d24b95d2f4a7eb88be9, type: 3}
|
||||
--- !u!1 &479218515 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6404588952757812254, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
@ -553,7 +626,7 @@ Camera:
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_FocalLength: 17.185572
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
@ -567,7 +640,7 @@ Camera:
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.01
|
||||
far clip plane: 100
|
||||
far clip plane: 200
|
||||
field of view: 69.85013
|
||||
orthographic: 0
|
||||
orthographic size: 100
|
||||
@ -595,7 +668,7 @@ Transform:
|
||||
m_GameObject: {fileID: 963194225}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -25}
|
||||
m_LocalPosition: {x: 0, y: 3, z: -25}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -793,7 +866,7 @@ PrefabInstance:
|
||||
- target: {fileID: -990798463411063789, guid: 303177f7648454b4fb8179c1378dd1ec, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: -6922793697723135513, guid: 61dc60d6e44cd9f46bc21aa06f06f92b, type: 3}
|
||||
objectReference: {fileID: 15303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- target: {fileID: 3447742079981357586, guid: 303177f7648454b4fb8179c1378dd1ec, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 100
|
||||
@ -849,7 +922,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8385590999942887681, guid: 303177f7648454b4fb8179c1378dd1ec, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: -6922793697723135513, guid: 61dc60d6e44cd9f46bc21aa06f06f92b, type: 3}
|
||||
objectReference: {fileID: 15303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@ -943,237 +1016,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1748381166
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 30
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_CastShadows
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_MotionVectors
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_DynamicOccludee
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_LightProbeUsage
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_RenderingLayerMask
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 718528fdc05822c4aacc4f77a39ecdb1, type: 2}
|
||||
- target: {fileID: -7635826562936255635, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Materials.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 04d4f548420aa714c92f89f38a108165, type: 2}
|
||||
- target: {fileID: 919132149155446097, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: NimbleZoneSphere
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: HexSphere
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8164078558771037576, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 24300c11f962a8e4f9f8125bd2843705, type: 3}
|
||||
--- !u!1 &2000082934
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2000082937}
|
||||
- component: {fileID: 2000082936}
|
||||
- component: {fileID: 2000082935}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light (3)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &2000082935
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2000082934}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 3
|
||||
m_UsePipelineSettings: 1
|
||||
m_AdditionalLightsShadowResolutionTier: 2
|
||||
m_LightLayerMask: 1
|
||||
m_RenderingLayers: 1
|
||||
m_CustomShadowLayers: 0
|
||||
m_ShadowLayerMask: 1
|
||||
m_ShadowRenderingLayers: 1
|
||||
m_LightCookieSize: {x: 1, y: 1}
|
||||
m_LightCookieOffset: {x: 0, y: 0}
|
||||
m_SoftShadowQuality: 0
|
||||
--- !u!108 &2000082936
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2000082934}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 0
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &2000082937
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2000082934}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0.0089207925, y: 0.6847223, z: 0.3338226, w: 0.64779496}
|
||||
m_LocalPosition: {x: -68, y: -49, z: -11}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: -27.951, y: 85.965, z: 28.41}
|
||||
--- !u!1 &2052728256
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1306,6 +1148,18 @@ PrefabInstance:
|
||||
propertyPath: cameraOperator
|
||||
value:
|
||||
objectReference: {fileID: 963194229}
|
||||
- target: {fileID: 5042970769659716555, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5042970769659716555, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5042970769659716555, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5042970769659716555, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -10
|
||||
@ -1373,7 +1227,7 @@ PrefabInstance:
|
||||
- target: {fileID: 6404588952760066782, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: -876546973899608171, guid: 1d42a1e828399e3419e843ccaf360423, type: 3}
|
||||
objectReference: {fileID: -876546973899608171, guid: 7bbccc5c40aae3e478e0205f25cd16ef, type: 3}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@ -1438,6 +1292,10 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5411380178868568951, guid: 65cd4fa5e050652409dd9b062365c7e8, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 15303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@ -1450,12 +1308,11 @@ SceneRoots:
|
||||
- {fileID: 796181415}
|
||||
- {fileID: 2052728260}
|
||||
- {fileID: 963194228}
|
||||
- {fileID: 8179556}
|
||||
- {fileID: 2000082937}
|
||||
- {fileID: 1185564593}
|
||||
- {fileID: 1748381166}
|
||||
- {fileID: 343400027}
|
||||
- {fileID: 1491164188991312957}
|
||||
- {fileID: 6412728625559011621}
|
||||
- {fileID: 1361581063}
|
||||
- {fileID: 1659830377}
|
||||
- {fileID: 201450955}
|
||||
- {fileID: 3628763}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Shader "CustomShader/FesnelRipple"
|
||||
Shader "CustomShaders/FesnelRipple"
|
||||
|
||||
{
|
||||
Properties
|
||||
93
Assets/Shaders/PBRInput.hlsl
Normal file
93
Assets/Shaders/PBRInput.hlsl
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Includes
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if SHADER_LIBRARY_VERSION_MAJOR < 9
|
||||
// These functions were added in URP v9.x versions, if we want to support URP versions before, we need to handle it
|
||||
// If you're in v10, should be safe to remove this if you don't care about supporting prior versions.
|
||||
// (Note, also using GetWorldSpaceViewDir in Vertex Shader)
|
||||
|
||||
// Computes the world space view direction (pointing towards the viewer).
|
||||
float3 GetWorldSpaceViewDir(float3 positionWS) {
|
||||
if (unity_OrthoParams.w == 0) {
|
||||
// Perspective
|
||||
return _WorldSpaceCameraPos - positionWS;
|
||||
} else {
|
||||
// Orthographic
|
||||
float4x4 viewMat = GetWorldToViewMatrix();
|
||||
return viewMat[2].xyz;
|
||||
}
|
||||
}
|
||||
|
||||
half3 GetWorldSpaceNormalizeViewDir(float3 positionWS) {
|
||||
float3 viewDir = GetWorldSpaceViewDir(positionWS);
|
||||
if (unity_OrthoParams.w == 0) {
|
||||
// Perspective
|
||||
return half3(normalize(viewDir));
|
||||
} else {
|
||||
// Orthographic
|
||||
return half3(viewDir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// InputData
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData) {
|
||||
inputData = (InputData)0; // avoids "not completely initalized" errors
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half3 viewDirWS = half3(input.normalWS.w, input.tangentWS.w, input.bitangentWS.w); // viewDir has been stored in w components of these in vertex shader
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(inputData.positionWS);
|
||||
inputData.normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
|
||||
viewDirWS = SafeNormalize(viewDirWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
// Fog
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = input.fogFactorAndVertexLight.x;
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = input.fogFactor;
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
/* in v11/v12?, could use :
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactor);
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
*/
|
||||
|
||||
inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS);
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUV);
|
||||
}
|
||||
7
Assets/Shaders/PBRInput.hlsl.meta
Normal file
7
Assets/Shaders/PBRInput.hlsl.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33ca3f2ea8b7d2c4b959eb13fc93343c
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
644
Assets/Shaders/PBRLitRipples.shader
Normal file
644
Assets/Shaders/PBRLitRipples.shader
Normal file
@ -0,0 +1,644 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
/*
|
||||
Roughly equivalent to the URP/Lit.shader (but Forward path only)
|
||||
https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader
|
||||
*/
|
||||
|
||||
Shader "CustomShaders/GlossyPBRRipples" {
|
||||
Properties {
|
||||
// Sorry the inspector is a little messy, but I'd rather not rely on a Custom ShaderGUI
|
||||
// or the one used by the Lit/Shader, as then adding new properties won't show
|
||||
// Tried to organise it somewhat, with spacing to help separate related parts.
|
||||
|
||||
[MainTexture] _BaseMap("Base Map (RGB) Smoothness / Alpha (A)", 2D) = "white" {}
|
||||
[MainColor] _BaseColor("Base Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTestToggle ("Alpha Clipping", Float) = 0
|
||||
_Cutoff ("Alpha Cutoff", Float) = 0.5
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_SPECULAR_SETUP)] _MetallicSpecToggle ("Workflow, Specular (if on), Metallic (if off)", Float) = 0
|
||||
[Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] _SmoothnessSource ("Smoothness Source, Albedo Alpha (if on) vs Metallic (if off)", Float) = 0
|
||||
_Metallic("Metallic", Range(0.0, 1.0)) = 0
|
||||
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_SpecColor("Specular Color", Color) = (0.5, 0.5, 0.5, 0.5)
|
||||
[Toggle(_METALLICSPECGLOSSMAP)] _MetallicSpecGlossMapToggle ("Use Metallic/Specular Gloss Map", Float) = 0
|
||||
_MetallicSpecGlossMap("Specular or Metallic Map", 2D) = "black" {}
|
||||
// Usually this is split into _SpecGlossMap and _MetallicGlossMap, but I find
|
||||
// that a bit annoying as I'm not using a custom ShaderGUI to show/hide them.
|
||||
[Space(20)]
|
||||
[ToggleUI] _ClearCoat("Clear Coat", Float) = 0.0
|
||||
_ClearCoatMask("Clear Coat Mask", Float) = 0.0
|
||||
_ClearCoatSmoothness("Clear Coat Smoothness", Float) = 0.0
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_NORMALMAP)] _NormalMapToggle ("Use Normal Map", Float) = 0
|
||||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale("Bump Scale", Float) = 1
|
||||
|
||||
// Not including Height (parallax) map in this example/template
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_OCCLUSIONMAP)] _OcclusionToggle ("Use Occlusion Map", Float) = 0
|
||||
[NoScaleOffset] _OcclusionMap("Occlusion Map", 2D) = "bump" {}
|
||||
_OcclusionStrength("Occlusion Strength", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_EMISSION)] _Emission ("Emission", Float) = 0
|
||||
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
|
||||
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "black" {}
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_SPECULARHIGHLIGHTS_OFF)] _SpecularHighlights("Turn Specular Highlights Off", Float) = 0
|
||||
[Toggle(_ENVIRONMENTREFLECTIONS_OFF)] _EnvironmentalReflections("Turn Environmental Reflections Off", Float) = 0
|
||||
// These are inverted fom what the URP/Lit shader does which is a bit annoying.
|
||||
// They would usually be handled by the Lit ShaderGUI but I'm using Toggle instead,
|
||||
// which assumes the keyword is more of an "on" state.
|
||||
|
||||
[Space(20)]
|
||||
_ControlTime ("Time", float) = 0
|
||||
_ModelOrigin ("Model Origin", Vector) = (0,0,0,0)
|
||||
_ImpactOrigin ("Impact Origin", Vector) = (-5,0,0,0)
|
||||
|
||||
_Frequency ("Frequency", Range(0, 1000)) = 10
|
||||
_Amplitude ("Amplitude", Range(0, 5)) = 0.1
|
||||
_WaveFalloff ("Wave Falloff", Range(1, 8)) = 4
|
||||
_MaxWaveDistortion ("Max Wave Distortion", Range(0.1, 2.0)) = 1
|
||||
_ImpactSpeed ("Impact Speed", Range(0, 10)) = 0.5
|
||||
_WaveSpeed ("Wave Speed", Range(-10, 10)) = -5
|
||||
|
||||
// Not including Detail maps in this template
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Transparent"
|
||||
"Queue"="Transparent"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
float4 _EmissionColor;
|
||||
float4 _SpecColor;
|
||||
half _Metallic;
|
||||
half _Smoothness;
|
||||
half _OcclusionStrength;
|
||||
half _Cutoff;
|
||||
half _BumpScale;
|
||||
half _SurfaceTransparent;
|
||||
half _ClearCoatMask;
|
||||
half _ClearCoatSmoothness;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForward"
|
||||
"RenderType" = "Transparent"
|
||||
"Queue"="Transparent"
|
||||
}
|
||||
|
||||
Blend One OneMinusSrcAlpha
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex LitPassVertex
|
||||
#pragma fragment LitPassFragment
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Keywords
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#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 _PARALLAXMAP // v10+ only
|
||||
//#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED // v10+ only
|
||||
// Note, for this template not supporting parallax/height mapping or detail maps
|
||||
|
||||
// v10+ only, URP/ComplexLit shader
|
||||
#pragma shader_feature_local _ CLEARCOAT
|
||||
|
||||
#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_fragment _SURFACE_TYPE_TRANSPARENT
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
|
||||
// URP Keywords
|
||||
#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 _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION // v10+ only (for SSAO support)
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING // v10+ only, renamed from "_MIXED_LIGHTING_SUBTRACTIVE"
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK // v10+ only
|
||||
|
||||
// Unity Keywords
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile_fog
|
||||
|
||||
// GPU Instancing (not supported)
|
||||
//#pragma multi_compile_instancing
|
||||
|
||||
float _ControlTime;
|
||||
float4 _ModelOrigin;
|
||||
float4 _ImpactOrigin;
|
||||
|
||||
half _Frequency; //Base frequency for our waves.
|
||||
half _Amplitude; //Base amplitude for our waves.
|
||||
half _WaveFalloff; //How quickly our distortion should fall off given distance.
|
||||
half _MaxWaveDistortion; //Smaller number here will lead to larger distortion as the vertex approaches origin.
|
||||
half _ImpactSpeed; //How quickly our wave origin moves across the sphere.
|
||||
half _WaveSpeed; //Oscillation speed of an individual wave.
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Structs
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
#ifdef _NORMALMAP
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
float4 normalOS : NORMAL;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 lightmapUV : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
#else
|
||||
half3 normalWS : TEXCOORD3;
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
//UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
#include "PBRSurface.hlsl"
|
||||
#include "PBRInput.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Vertex Shader
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Varyings LitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
|
||||
//UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
|
||||
float4 world_space_vertex = mul(unity_ObjectToWorld, IN.positionOS);
|
||||
|
||||
float4 direction = normalize(_ModelOrigin - _ImpactOrigin);
|
||||
float4 origin = _ImpactOrigin + _ControlTime * _ImpactSpeed * direction;
|
||||
|
||||
//Get the distance in world space from our vertex to the wave origin.
|
||||
float dist = distance(world_space_vertex, origin);
|
||||
|
||||
//Adjust our distance to be non-linear.
|
||||
dist = pow(dist, _WaveFalloff);
|
||||
|
||||
//Set the max amount a wave can be distorted based on distance.
|
||||
dist = max(dist, _MaxWaveDistortion);
|
||||
|
||||
//Convert direction and _ImpactOrigin to model space for later trig magic.
|
||||
float4 l_ImpactOrigin = mul(unity_WorldToObject, _ImpactOrigin);
|
||||
float4 l_direction = mul(unity_WorldToObject, direction);
|
||||
|
||||
//Magic
|
||||
float impactAxis = l_ImpactOrigin + dot((IN.positionOS - l_ImpactOrigin), l_direction);
|
||||
|
||||
IN.positionOS.xyz += IN.normalOS * sin(impactAxis * _Frequency + _ControlTime * _WaveSpeed) * _Amplitude * (1 / dist);
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
#ifdef _NORMALMAP
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz, IN.tangentOS);
|
||||
#else
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz);
|
||||
#endif
|
||||
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
OUT.positionWS = positionInputs.positionWS;
|
||||
|
||||
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceViewDir(positionInputs.positionWS);
|
||||
half3 vertexLight = VertexLighting(positionInputs.positionWS, normalInputs.normalWS);
|
||||
half fogFactor = ComputeFogFactor(positionInputs.positionCS.z);
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
OUT.normalWS = half4(normalInputs.normalWS, viewDirWS.x);
|
||||
OUT.tangentWS = half4(normalInputs.tangentWS, viewDirWS.y);
|
||||
OUT.bitangentWS = half4(normalInputs.bitangentWS, viewDirWS.z);
|
||||
#else
|
||||
OUT.normalWS = NormalizeNormalPerVertex(normalInputs.normalWS);
|
||||
//OUT.viewDirWS = viewDirWS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(IN.lightmapUV, unity_LightmapST, OUT.lightmapUV);
|
||||
OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH);
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
OUT.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
OUT.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
OUT.shadowCoord = GetShadowCoord(positionInputs);
|
||||
#endif
|
||||
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Fragment Shader
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
half4 LitPassFragment(Varyings IN) : SV_Target {
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
|
||||
// Setup SurfaceData
|
||||
SurfaceData surfaceData;
|
||||
InitializeSurfaceData(IN, surfaceData);
|
||||
surfaceData.clearCoatMask = _ClearCoatMask;
|
||||
surfaceData.clearCoatSmoothness = _ClearCoatSmoothness;
|
||||
|
||||
// Setup InputData
|
||||
InputData inputData;
|
||||
InitializeInputData(IN, surfaceData.normalTS, inputData);
|
||||
|
||||
// Simple Lighting (Lambert & BlinnPhong)
|
||||
half4 color = UniversalFragmentPBR(inputData, surfaceData);
|
||||
// See Lighting.hlsl to see how this is implemented.
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl
|
||||
|
||||
// Fog
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
color.a = color.a;
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
// UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
||||
// Would be nice if we could just use the passes from existing shaders,
|
||||
// However this breaks SRP Batcher compatibility. Instead, we should define them :
|
||||
|
||||
// ShadowCaster, for casting shadows
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
// Universal Pipeline Keywords
|
||||
// (v11+) This is used during shadow map generation to differentiate between directional and punctual (point/spot) light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#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.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedShadowPassVertex (instead of ShadowPassVertex above)
|
||||
|
||||
Varyings DisplacedShadowPassVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthOnly, used for Camera Depth Texture (if cannot copy depth buffer instead, and the DepthNormals below isn't used)
|
||||
Pass {
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode"="DepthOnly" }
|
||||
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthOnlyVertex (instead of DepthOnlyVertex above)
|
||||
|
||||
Varyings DisplacedDepthOnlyVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthNormals, used for SSAO & other custom renderer features that request it
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthNormalsVertex (instead of DepthNormalsVertex above)
|
||||
|
||||
Varyings DisplacedDepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
// Note, while v10 versions ignore this, if you want normal mapping to affect the _CameraNormalsTexture, we could edit the DepthNormals pass
|
||||
// (or if in v12+, use the LitDepthNormalsPass.hlsl instead, which additionally includes parallax and detail normals support)
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.universal/Shaders/LitDepthNormalsPass.hlsl
|
||||
/*
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
#define REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR
|
||||
#endif
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD1;
|
||||
float3 normalWS : TEXCOORD2;
|
||||
|
||||
#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: sign
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings DepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
//input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
|
||||
#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
float sign = input.tangentOS.w * float(GetOddNegativeScale());
|
||||
half4 tangentWS = half4(normalInput.tangentWS.xyz, sign);
|
||||
output.tangentWS = tangentWS;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 DepthNormalsFragment(Varyings input) : SV_TARGET {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
Alpha(SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a, _BaseColor, _Cutoff);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
float3 normalTS = SampleNormal(input.uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
|
||||
|
||||
float3 normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz));
|
||||
#else
|
||||
float3 normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
return float4(PackNormalOctRectEncode(TransformWorldToViewDir(normalWS, true)), 0.0, 0.0);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
*/
|
||||
|
||||
// Meta, used for baking global illumination / lightmaps
|
||||
Pass {
|
||||
Name "Meta"
|
||||
Tags{"LightMode" = "Meta"}
|
||||
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UniversalVertexMeta
|
||||
#pragma fragment UniversalFragmentMetaLit
|
||||
|
||||
#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
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
#ifdef _TANGENT_TO_WORLD
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
#include "PBRSurface.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
|
||||
|
||||
Varyings UniversalVertexMeta(Attributes input) {
|
||||
Varyings output;
|
||||
output.positionCS = MetaVertexPosition(input.positionOS, input.uv1, input.uv2, unity_LightmapST, unity_DynamicLightmapST);
|
||||
output.uv = TRANSFORM_TEX(input.uv0, _BaseMap);
|
||||
output.color = input.color;
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 UniversalFragmentMetaLit(Varyings input) : SV_Target {
|
||||
SurfaceData surfaceData;
|
||||
InitializeSurfaceData(input, surfaceData);
|
||||
|
||||
BRDFData brdfData;
|
||||
InitializeBRDFData(surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.alpha, brdfData);
|
||||
|
||||
MetaInput metaInput;
|
||||
metaInput.Albedo = brdfData.diffuse + brdfData.specular * brdfData.roughness * 0.5;
|
||||
metaInput.Emission = surfaceData.emission;
|
||||
|
||||
return MetaFragment(metaInput);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// There is also other passes, e.g.
|
||||
// Universal2D, if you need the shader to support the 2D Renderer
|
||||
// UniversalGBuffer, for Deferred rendering support (v12 only)
|
||||
// but not supporting them here. See the URP Shaders source :
|
||||
// https://github.com/Unity-Technologies/Graphics/tree/master/com.unity.render-pipelines.universal/Shaders
|
||||
}
|
||||
}
|
||||
10
Assets/Shaders/PBRLitRipples.shader.meta
Normal file
10
Assets/Shaders/PBRLitRipples.shader.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a7f26cb4a0b4d446b2ca031d3ff37df
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/Shaders/PBRSurface.hlsl
Normal file
82
Assets/Shaders/PBRSurface.hlsl
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Includes
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Textures, Samplers & Global Properties
|
||||
// ---------------------------------------------------------------------------
|
||||
// (note, BaseMap, BumpMap and EmissionMap is being defined by the SurfaceInput.hlsl include)
|
||||
TEXTURE2D(_MetallicSpecGlossMap); SAMPLER(sampler_MetallicSpecGlossMap);
|
||||
TEXTURE2D(_OcclusionMap); SAMPLER(sampler_OcclusionMap);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
half4 SampleMetallicSpecGloss(float2 uv, half albedoAlpha) {
|
||||
half4 specGloss;
|
||||
#ifdef _METALLICSPECGLOSSMAP
|
||||
specGloss = SAMPLE_TEXTURE2D(_MetallicSpecGlossMap, sampler_MetallicSpecGlossMap, 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
|
||||
#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 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SurfaceData
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void InitializeSurfaceData(Varyings IN, out SurfaceData surfaceData){
|
||||
surfaceData = (SurfaceData)0; // avoids "not completely initalized" errors
|
||||
|
||||
half4 albedoAlpha = SampleAlbedoAlpha(IN.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
|
||||
surfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff);
|
||||
surfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb * IN.color.rgb;
|
||||
surfaceData.albedo = AlphaModulate(surfaceData.albedo, surfaceData.alpha);
|
||||
|
||||
surfaceData.normalTS = SampleNormal(IN.uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
|
||||
surfaceData.emission = SampleEmission(IN.uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
|
||||
surfaceData.occlusion = SampleOcclusion(IN.uv);
|
||||
|
||||
half4 specGloss = SampleMetallicSpecGloss(IN.uv, albedoAlpha.a);
|
||||
#if _SPECULAR_SETUP
|
||||
surfaceData.metallic = 1.0h;
|
||||
surfaceData.specular = specGloss.rgb;
|
||||
#else
|
||||
surfaceData.metallic = specGloss.r;
|
||||
surfaceData.specular = half3(0.0h, 0.0h, 0.0h);
|
||||
#endif
|
||||
surfaceData.smoothness = specGloss.a;
|
||||
}
|
||||
10
Assets/Shaders/PBRSurface.hlsl.meta
Normal file
10
Assets/Shaders/PBRSurface.hlsl.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 374203f16169dc7459943003117593ec
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Shaders/URP_ShaderCodeTemplates.meta
Normal file
8
Assets/Shaders/URP_ShaderCodeTemplates.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a4dd0cc27ff19047afabeee3eb7f78f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
121
Assets/Shaders/URP_ShaderCodeTemplates/LICENSE
Normal file
121
Assets/Shaders/URP_ShaderCodeTemplates/LICENSE
Normal file
@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
7
Assets/Shaders/URP_ShaderCodeTemplates/LICENSE.meta
Normal file
7
Assets/Shaders/URP_ShaderCodeTemplates/LICENSE.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3682d2f9dedb7674aadee68b5d47cbbe
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Assets/Shaders/URP_ShaderCodeTemplates/PBRInput.hlsl
Normal file
93
Assets/Shaders/URP_ShaderCodeTemplates/PBRInput.hlsl
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Includes
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if SHADER_LIBRARY_VERSION_MAJOR < 9
|
||||
// These functions were added in URP v9.x versions, if we want to support URP versions before, we need to handle it
|
||||
// If you're in v10, should be safe to remove this if you don't care about supporting prior versions.
|
||||
// (Note, also using GetWorldSpaceViewDir in Vertex Shader)
|
||||
|
||||
// Computes the world space view direction (pointing towards the viewer).
|
||||
float3 GetWorldSpaceViewDir(float3 positionWS) {
|
||||
if (unity_OrthoParams.w == 0) {
|
||||
// Perspective
|
||||
return _WorldSpaceCameraPos - positionWS;
|
||||
} else {
|
||||
// Orthographic
|
||||
float4x4 viewMat = GetWorldToViewMatrix();
|
||||
return viewMat[2].xyz;
|
||||
}
|
||||
}
|
||||
|
||||
half3 GetWorldSpaceNormalizeViewDir(float3 positionWS) {
|
||||
float3 viewDir = GetWorldSpaceViewDir(positionWS);
|
||||
if (unity_OrthoParams.w == 0) {
|
||||
// Perspective
|
||||
return half3(normalize(viewDir));
|
||||
} else {
|
||||
// Orthographic
|
||||
return half3(viewDir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// InputData
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData) {
|
||||
inputData = (InputData)0; // avoids "not completely initalized" errors
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half3 viewDirWS = half3(input.normalWS.w, input.tangentWS.w, input.bitangentWS.w); // viewDir has been stored in w components of these in vertex shader
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(inputData.positionWS);
|
||||
inputData.normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
|
||||
viewDirWS = SafeNormalize(viewDirWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
// Fog
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = input.fogFactorAndVertexLight.x;
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = input.fogFactor;
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
/* in v11/v12?, could use :
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactor);
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
*/
|
||||
|
||||
inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS);
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUV);
|
||||
}
|
||||
10
Assets/Shaders/URP_ShaderCodeTemplates/PBRInput.hlsl.meta
Normal file
10
Assets/Shaders/URP_ShaderCodeTemplates/PBRInput.hlsl.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c21821e52a1ca7448b8ebe83a5196544
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
81
Assets/Shaders/URP_ShaderCodeTemplates/PBRSurface.hlsl
Normal file
81
Assets/Shaders/URP_ShaderCodeTemplates/PBRSurface.hlsl
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Includes
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Textures, Samplers & Global Properties
|
||||
// ---------------------------------------------------------------------------
|
||||
// (note, BaseMap, BumpMap and EmissionMap is being defined by the SurfaceInput.hlsl include)
|
||||
TEXTURE2D(_MetallicSpecGlossMap); SAMPLER(sampler_MetallicSpecGlossMap);
|
||||
TEXTURE2D(_OcclusionMap); SAMPLER(sampler_OcclusionMap);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
half4 SampleMetallicSpecGloss(float2 uv, half albedoAlpha) {
|
||||
half4 specGloss;
|
||||
#ifdef _METALLICSPECGLOSSMAP
|
||||
specGloss = SAMPLE_TEXTURE2D(_MetallicSpecGlossMap, sampler_MetallicSpecGlossMap, 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
|
||||
#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 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SurfaceData
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void InitializeSurfaceData(Varyings IN, out SurfaceData surfaceData){
|
||||
surfaceData = (SurfaceData)0; // avoids "not completely initalized" errors
|
||||
|
||||
half4 albedoAlpha = SampleAlbedoAlpha(IN.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
|
||||
surfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff);
|
||||
surfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb * IN.color.rgb;
|
||||
|
||||
surfaceData.normalTS = SampleNormal(IN.uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
|
||||
surfaceData.emission = SampleEmission(IN.uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
|
||||
surfaceData.occlusion = SampleOcclusion(IN.uv);
|
||||
|
||||
half4 specGloss = SampleMetallicSpecGloss(IN.uv, albedoAlpha.a);
|
||||
#if _SPECULAR_SETUP
|
||||
surfaceData.metallic = 1.0h;
|
||||
surfaceData.specular = specGloss.rgb;
|
||||
#else
|
||||
surfaceData.metallic = specGloss.r;
|
||||
surfaceData.specular = half3(0.0h, 0.0h, 0.0h);
|
||||
#endif
|
||||
surfaceData.smoothness = specGloss.a;
|
||||
}
|
||||
10
Assets/Shaders/URP_ShaderCodeTemplates/PBRSurface.hlsl.meta
Normal file
10
Assets/Shaders/URP_ShaderCodeTemplates/PBRSurface.hlsl.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af71b1a3a2d26b645acd03a0dd56a301
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,297 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
/*
|
||||
This example reacts to Main Directional Light & Ambient/Baked light.
|
||||
Ignores additional lights.
|
||||
Diffuse/Lambert shading model.
|
||||
No specular/smoothness/metallic/etc.
|
||||
*/
|
||||
|
||||
Shader "Cyanilux/URPTemplates/DiffuseLitShaderExample" {
|
||||
Properties {
|
||||
_BaseMap ("Example Texture", 2D) = "white" {}
|
||||
_BaseColor ("Example Colour", Color) = (0, 0.66, 0.73, 1)
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTestToggle ("Alpha Clipping", Float) = 0
|
||||
_Cutoff ("Alpha Cutoff", Float) = 0.5
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
float _Cutoff;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex LitPassVertex
|
||||
#pragma fragment LitPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#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 shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
|
||||
// URP Keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
// Note, v11 changes this to :
|
||||
// #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
|
||||
#pragma multi_compile _ _SHADOWS_SOFT
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING // v10+ only, renamed from "_MIXED_LIGHTING_SUBTRACTIVE"
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK // v10+ only
|
||||
|
||||
// Unity Keywords
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile_fog
|
||||
|
||||
// GPU Instancing (not supported)
|
||||
//#pragma multi_compile_instancing
|
||||
|
||||
// Includes
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// Structs
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float4 normalOS : NORMAL;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 lightmapUV : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
|
||||
float3 normalWS : TEXCOORD2;
|
||||
float3 positionWS : TEXCOORD3;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
// Textures, Samplers & Global Properties
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
|
||||
// Vertex Shader
|
||||
Varyings LitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
OUT.positionWS = positionInputs.positionWS;
|
||||
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz);
|
||||
OUT.normalWS = normalInputs.normalWS;
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(IN.lightmapUV, unity_LightmapST, OUT.lightmapUV);
|
||||
OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH);
|
||||
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// Fragment Shader
|
||||
half4 LitPassFragment(Varyings IN) : SV_Target {
|
||||
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
|
||||
#ifdef _ALPHATEST_ON
|
||||
// Alpha Clipping
|
||||
clip(baseMap.a - _Cutoff);
|
||||
#endif
|
||||
|
||||
// Get Baked GI
|
||||
half3 bakedGI = SAMPLE_GI(IN.lightmapUV, IN.vertexSH, IN.normalWS);
|
||||
|
||||
// Main Light & Shadows
|
||||
float4 shadowCoord = TransformWorldToShadowCoord(IN.positionWS.xyz);
|
||||
Light mainLight = GetMainLight(shadowCoord);
|
||||
half3 attenuatedLightColor = mainLight.color * (mainLight.distanceAttenuation * mainLight.shadowAttenuation);
|
||||
|
||||
// Mix Realtime & Baked (if LIGHTMAP_SHADOW_MIXING / _MIXED_LIGHTING_SUBTRACTIVE is enabled)
|
||||
MixRealtimeAndBakedGI(mainLight, IN.normalWS, bakedGI);
|
||||
|
||||
// Diffuse
|
||||
half3 shading = bakedGI + LightingLambert(attenuatedLightColor, mainLight.direction, IN.normalWS);
|
||||
half4 color = baseMap * _BaseColor * IN.color;
|
||||
return half4(color.rgb * shading, color.a);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
// UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
||||
// Would be nice if we could just use the passes from existing shaders,
|
||||
// However this breaks SRP Batcher compatibility. Instead, we should define them :
|
||||
|
||||
// ShadowCaster, for casting shadows
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
// Universal Pipeline Keywords
|
||||
// (v11+) This is used during shadow map generation to differentiate between directional and punctual (point/spot) light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#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.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedShadowPassVertex (instead of ShadowPassVertex above)
|
||||
|
||||
Varyings DisplacedShadowPassVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthOnly, used for Camera Depth Texture (if cannot copy depth buffer instead, and the DepthNormals below isn't used)
|
||||
Pass {
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode"="DepthOnly" }
|
||||
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthOnlyVertex (instead of DepthOnlyVertex above)
|
||||
|
||||
Varyings DisplacedDepthOnlyVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthNormals, used for SSAO & other custom renderer features that request it
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthNormalsVertex (instead of DepthNormalsVertex above)
|
||||
|
||||
Varyings DisplacedDepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b88236c1ecbe9243b3318d347059c39
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
581
Assets/Shaders/URP_ShaderCodeTemplates/URP_PBRLitTemplate.shader
Normal file
581
Assets/Shaders/URP_ShaderCodeTemplates/URP_PBRLitTemplate.shader
Normal file
@ -0,0 +1,581 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
/*
|
||||
Roughly equivalent to the URP/Lit.shader (but Forward path only)
|
||||
https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader
|
||||
*/
|
||||
|
||||
Shader "Cyanilux/URPTemplates/PBRLitShaderExample" {
|
||||
Properties {
|
||||
// Sorry the inspector is a little messy, but I'd rather not rely on a Custom ShaderGUI
|
||||
// or the one used by the Lit/Shader, as then adding new properties won't show
|
||||
// Tried to organise it somewhat, with spacing to help separate related parts.
|
||||
|
||||
[MainTexture] _BaseMap("Base Map (RGB) Smoothness / Alpha (A)", 2D) = "white" {}
|
||||
[MainColor] _BaseColor("Base Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTestToggle ("Alpha Clipping", Float) = 0
|
||||
_Cutoff ("Alpha Cutoff", Float) = 0.5
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_SPECULAR_SETUP)] _MetallicSpecToggle ("Workflow, Specular (if on), Metallic (if off)", Float) = 0
|
||||
[Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] _SmoothnessSource ("Smoothness Source, Albedo Alpha (if on) vs Metallic (if off)", Float) = 0
|
||||
_Metallic("Metallic", Range(0.0, 1.0)) = 0
|
||||
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_SpecColor("Specular Color", Color) = (0.5, 0.5, 0.5, 0.5)
|
||||
[Toggle(_METALLICSPECGLOSSMAP)] _MetallicSpecGlossMapToggle ("Use Metallic/Specular Gloss Map", Float) = 0
|
||||
_MetallicSpecGlossMap("Specular or Metallic Map", 2D) = "black" {}
|
||||
// Usually this is split into _SpecGlossMap and _MetallicGlossMap, but I find
|
||||
// that a bit annoying as I'm not using a custom ShaderGUI to show/hide them.
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_NORMALMAP)] _NormalMapToggle ("Use Normal Map", Float) = 0
|
||||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale("Bump Scale", Float) = 1
|
||||
|
||||
// Not including Height (parallax) map in this example/template
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_OCCLUSIONMAP)] _OcclusionToggle ("Use Occlusion Map", Float) = 0
|
||||
[NoScaleOffset] _OcclusionMap("Occlusion Map", 2D) = "bump" {}
|
||||
_OcclusionStrength("Occlusion Strength", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_EMISSION)] _Emission ("Emission", Float) = 0
|
||||
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
|
||||
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "black" {}
|
||||
|
||||
[Space(20)]
|
||||
[Toggle(_SPECULARHIGHLIGHTS_OFF)] _SpecularHighlights("Turn Specular Highlights Off", Float) = 0
|
||||
[Toggle(_ENVIRONMENTREFLECTIONS_OFF)] _EnvironmentalReflections("Turn Environmental Reflections Off", Float) = 0
|
||||
// These are inverted fom what the URP/Lit shader does which is a bit annoying.
|
||||
// They would usually be handled by the Lit ShaderGUI but I'm using Toggle instead,
|
||||
// which assumes the keyword is more of an "on" state.
|
||||
|
||||
// Not including Detail maps in this template
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
float4 _EmissionColor;
|
||||
float4 _SpecColor;
|
||||
float _Metallic;
|
||||
float _Smoothness;
|
||||
float _OcclusionStrength;
|
||||
float _Cutoff;
|
||||
float _BumpScale;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex LitPassVertex
|
||||
#pragma fragment LitPassFragment
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Keywords
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#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 _PARALLAXMAP // v10+ only
|
||||
//#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED // v10+ only
|
||||
// Note, for this template not supporting parallax/height mapping or detail maps
|
||||
|
||||
//#pragma shader_feature_local _ _CLEARCOAT _CLEARCOATMAP // v10+ only, URP/ComplexLit shader
|
||||
|
||||
#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
|
||||
|
||||
// URP Keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
// Note, v11 changes these to :
|
||||
// #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 _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION // v10+ only (for SSAO support)
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING // v10+ only, renamed from "_MIXED_LIGHTING_SUBTRACTIVE"
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK // v10+ only
|
||||
|
||||
// Unity Keywords
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile_fog
|
||||
|
||||
// GPU Instancing (not supported)
|
||||
//#pragma multi_compile_instancing
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Structs
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
#ifdef _NORMALMAP
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
float4 normalOS : NORMAL;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 lightmapUV : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
#else
|
||||
half3 normalWS : TEXCOORD3;
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
//UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
#include "PBRSurface.hlsl"
|
||||
#include "PBRInput.hlsl"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Vertex Shader
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Varyings LitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
|
||||
//UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
#ifdef _NORMALMAP
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz, IN.tangentOS);
|
||||
#else
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz);
|
||||
#endif
|
||||
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
OUT.positionWS = positionInputs.positionWS;
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceViewDir(positionInputs.positionWS);
|
||||
half3 vertexLight = VertexLighting(positionInputs.positionWS, normalInputs.normalWS);
|
||||
half fogFactor = ComputeFogFactor(positionInputs.positionCS.z);
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
OUT.normalWS = half4(normalInputs.normalWS, viewDirWS.x);
|
||||
OUT.tangentWS = half4(normalInputs.tangentWS, viewDirWS.y);
|
||||
OUT.bitangentWS = half4(normalInputs.bitangentWS, viewDirWS.z);
|
||||
#else
|
||||
OUT.normalWS = NormalizeNormalPerVertex(normalInputs.normalWS);
|
||||
//OUT.viewDirWS = viewDirWS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(IN.lightmapUV, unity_LightmapST, OUT.lightmapUV);
|
||||
OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH);
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
OUT.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
OUT.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
OUT.shadowCoord = GetShadowCoord(positionInputs);
|
||||
#endif
|
||||
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Fragment Shader
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
half4 LitPassFragment(Varyings IN) : SV_Target {
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
|
||||
// Setup SurfaceData
|
||||
SurfaceData surfaceData;
|
||||
InitializeSurfaceData(IN, surfaceData);
|
||||
|
||||
// Setup InputData
|
||||
InputData inputData;
|
||||
InitializeInputData(IN, surfaceData.normalTS, inputData);
|
||||
|
||||
// Simple Lighting (Lambert & BlinnPhong)
|
||||
half4 color = UniversalFragmentPBR(inputData, surfaceData);
|
||||
// See Lighting.hlsl to see how this is implemented.
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl
|
||||
|
||||
// Fog
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
//color.a = OutputAlpha(color.a, _Surface);
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
// UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
||||
// Would be nice if we could just use the passes from existing shaders,
|
||||
// However this breaks SRP Batcher compatibility. Instead, we should define them :
|
||||
|
||||
// ShadowCaster, for casting shadows
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
// Universal Pipeline Keywords
|
||||
// (v11+) This is used during shadow map generation to differentiate between directional and punctual (point/spot) light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#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.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedShadowPassVertex (instead of ShadowPassVertex above)
|
||||
|
||||
Varyings DisplacedShadowPassVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthOnly, used for Camera Depth Texture (if cannot copy depth buffer instead, and the DepthNormals below isn't used)
|
||||
Pass {
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode"="DepthOnly" }
|
||||
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthOnlyVertex (instead of DepthOnlyVertex above)
|
||||
|
||||
Varyings DisplacedDepthOnlyVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthNormals, used for SSAO & other custom renderer features that request it
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthNormalsVertex (instead of DepthNormalsVertex above)
|
||||
|
||||
Varyings DisplacedDepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
// Note, while v10 versions ignore this, if you want normal mapping to affect the _CameraNormalsTexture, we could edit the DepthNormals pass
|
||||
// (or if in v12+, use the LitDepthNormalsPass.hlsl instead, which additionally includes parallax and detail normals support)
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.universal/Shaders/LitDepthNormalsPass.hlsl
|
||||
/*
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
#define REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR
|
||||
#endif
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD1;
|
||||
float3 normalWS : TEXCOORD2;
|
||||
|
||||
#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: sign
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings DepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
//input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
|
||||
#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
float sign = input.tangentOS.w * float(GetOddNegativeScale());
|
||||
half4 tangentWS = half4(normalInput.tangentWS.xyz, sign);
|
||||
output.tangentWS = tangentWS;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 DepthNormalsFragment(Varyings input) : SV_TARGET {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
Alpha(SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a, _BaseColor, _Cutoff);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
float3 normalTS = SampleNormal(input.uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
|
||||
|
||||
float3 normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz));
|
||||
#else
|
||||
float3 normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
return float4(PackNormalOctRectEncode(TransformWorldToViewDir(normalWS, true)), 0.0, 0.0);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
*/
|
||||
|
||||
// Meta, used for baking global illumination / lightmaps
|
||||
Pass {
|
||||
Name "Meta"
|
||||
Tags{"LightMode" = "Meta"}
|
||||
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UniversalVertexMeta
|
||||
#pragma fragment UniversalFragmentMeta
|
||||
|
||||
#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
|
||||
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
#ifdef _TANGENT_TO_WORLD
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
#include "PBRSurface.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
|
||||
|
||||
Varyings UniversalVertexMeta(Attributes input) {
|
||||
Varyings output;
|
||||
output.positionCS = MetaVertexPosition(input.positionOS, input.uv1, input.uv2, unity_LightmapST, unity_DynamicLightmapST);
|
||||
output.uv = TRANSFORM_TEX(input.uv0, _BaseMap);
|
||||
output.color = input.color;
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 UniversalFragmentMeta(Varyings input) : SV_Target {
|
||||
SurfaceData surfaceData;
|
||||
InitializeSurfaceData(input, surfaceData);
|
||||
|
||||
BRDFData brdfData;
|
||||
InitializeBRDFData(surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.alpha, brdfData);
|
||||
|
||||
MetaInput metaInput;
|
||||
metaInput.Albedo = brdfData.diffuse + brdfData.specular * brdfData.roughness * 0.5;
|
||||
metaInput.Emission = surfaceData.emission;
|
||||
|
||||
return MetaFragment(metaInput);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// There is also other passes, e.g.
|
||||
// Universal2D, if you need the shader to support the 2D Renderer
|
||||
// UniversalGBuffer, for Deferred rendering support (v12 only)
|
||||
// but not supporting them here. See the URP Shaders source :
|
||||
// https://github.com/Unity-Technologies/Graphics/tree/master/com.unity.render-pipelines.universal/Shaders
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6816eb92a7e6b724d8546b078c69f1fa
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,457 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
/*
|
||||
Roughly equivalent to the URP/SimpleLit.shader (but Forward path only)
|
||||
https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader
|
||||
*/
|
||||
|
||||
Shader "Cyanilux/URPTemplates/SimpleLitShaderExample" {
|
||||
Properties {
|
||||
[MainTexture] _BaseMap("Base Map (RGB) Smoothness / Alpha (A)", 2D) = "white" {}
|
||||
[MainColor] _BaseColor("Base Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[Toggle(_NORMALMAP)] _NormalMapToggle ("Normal Mapping", Float) = 0
|
||||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {}
|
||||
|
||||
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
|
||||
[Toggle(_EMISSION)] _Emission ("Emission", Float) = 0
|
||||
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "white" {}
|
||||
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTestToggle ("Alpha Clipping", Float) = 0
|
||||
_Cutoff ("Alpha Cutoff", Float) = 0.5
|
||||
|
||||
[Toggle(_SPECGLOSSMAP)] _SpecGlossMapToggle ("Use Specular Gloss Map", Float) = 0
|
||||
_SpecColor("Specular Color", Color) = (0.5, 0.5, 0.5, 0.5)
|
||||
_SpecGlossMap("Specular Map", 2D) = "white" {}
|
||||
[Toggle(_GLOSSINESS_FROM_BASE_ALPHA)] _GlossSource ("Glossiness Source, from Albedo Alpha (if on) vs from Specular (if off)", Float) = 0
|
||||
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
float4 _EmissionColor;
|
||||
float4 _SpecColor;
|
||||
float _Cutoff;
|
||||
float _Smoothness;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex LitPassVertex
|
||||
#pragma fragment LitPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
//#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 _ _SPECGLOSSMAP _SPECULAR_COLOR
|
||||
#pragma shader_feature_local_fragment _ _SPECGLOSSMAP
|
||||
#define _SPECULAR_COLOR // always on
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
// URP Keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
// Note, v11 changes this to :
|
||||
// #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
|
||||
#pragma multi_compile _ _SHADOWS_SOFT
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING // v10+ only, renamed from "_MIXED_LIGHTING_SUBTRACTIVE"
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK // v10+ only
|
||||
|
||||
// Unity Keywords
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile_fog
|
||||
|
||||
// GPU Instancing (not supported)
|
||||
//#pragma multi_compile_instancing
|
||||
|
||||
// Includes
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
// Structs
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float4 normalOS : NORMAL;
|
||||
#ifdef _NORMALMAP
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 lightmapUV : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
#else
|
||||
half3 normalWS : TEXCOORD3;
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
float4 color : COLOR;
|
||||
//UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
//UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
// Textures, Samplers & Global Properties
|
||||
// (note, BaseMap, BumpMap and EmissionMap is being defined by the SurfaceInput.hlsl include)
|
||||
TEXTURE2D(_SpecGlossMap); SAMPLER(sampler_SpecGlossMap);
|
||||
|
||||
// Functions
|
||||
half4 SampleSpecularSmoothness(float2 uv, half alpha, half4 specColor, TEXTURE2D_PARAM(specMap, sampler_specMap)) {
|
||||
half4 specularSmoothness = half4(0.0h, 0.0h, 0.0h, 1.0h);
|
||||
#ifdef _SPECGLOSSMAP
|
||||
specularSmoothness = SAMPLE_TEXTURE2D(specMap, sampler_specMap, uv) * specColor;
|
||||
#elif defined(_SPECULAR_COLOR)
|
||||
specularSmoothness = specColor;
|
||||
#endif
|
||||
|
||||
#if UNITY_VERSION >= 202120 // or #if SHADER_LIBRARY_VERSION_MAJOR < 12, but that versioning method is deprecated for newer versions
|
||||
// v12 is changing this, so it's calculated later. Likely so that smoothness value stays 0-1 so it can display better for debug views.
|
||||
#ifdef _GLOSSINESS_FROM_BASE_ALPHA
|
||||
specularSmoothness.a = exp2(10 * alpha + 1);
|
||||
#else
|
||||
specularSmoothness.a = exp2(10 * specularSmoothness.a + 1);
|
||||
#endif
|
||||
#endif
|
||||
return specularSmoothness;
|
||||
}
|
||||
|
||||
// SurfaceData & InputData
|
||||
void InitalizeSurfaceData(Varyings IN, out SurfaceData surfaceData){
|
||||
surfaceData = (SurfaceData)0; // avoids "not completely initalized" errors
|
||||
|
||||
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
|
||||
#ifdef _ALPHATEST_ON
|
||||
// Alpha Clipping
|
||||
clip(baseMap.a - _Cutoff);
|
||||
#endif
|
||||
|
||||
half4 diffuse = baseMap * _BaseColor * IN.color;
|
||||
surfaceData.albedo = diffuse.rgb;
|
||||
surfaceData.normalTS = SampleNormal(IN.uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap));
|
||||
surfaceData.emission = SampleEmission(IN.uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
|
||||
surfaceData.occlusion = 1.0; // unused
|
||||
|
||||
half4 specular = SampleSpecularSmoothness(IN.uv, diffuse.a, _SpecColor, TEXTURE2D_ARGS(_SpecGlossMap, sampler_SpecGlossMap));
|
||||
surfaceData.specular = specular.rgb;
|
||||
surfaceData.smoothness = specular.a * _Smoothness;
|
||||
}
|
||||
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData) {
|
||||
inputData = (InputData)0; // avoids "not completely initalized" errors
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half3 viewDirWS = half3(input.normalWS.w, input.tangentWS.w, input.bitangentWS.w);
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS,half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(inputData.positionWS);
|
||||
inputData.normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
|
||||
viewDirWS = SafeNormalize(viewDirWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
// Fog
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = input.fogFactorAndVertexLight.x;
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = input.fogFactor;
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
/* in v11/v12?, could use :
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactor);
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
*/
|
||||
|
||||
inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS);
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUV);
|
||||
}
|
||||
|
||||
// Vertex Shader
|
||||
Varyings LitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
|
||||
//UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
#ifdef _NORMALMAP
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz, IN.tangentOS);
|
||||
#else
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(IN.normalOS.xyz);
|
||||
#endif
|
||||
|
||||
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
OUT.positionWS = positionInputs.positionWS;
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceViewDir(positionInputs.positionWS);
|
||||
half3 vertexLight = VertexLighting(positionInputs.positionWS, normalInputs.normalWS);
|
||||
half fogFactor = ComputeFogFactor(positionInputs.positionCS.z);
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
OUT.normalWS = half4(normalInputs.normalWS, viewDirWS.x);
|
||||
OUT.tangentWS = half4(normalInputs.tangentWS, viewDirWS.y);
|
||||
OUT.bitangentWS = half4(normalInputs.bitangentWS, viewDirWS.z);
|
||||
#else
|
||||
OUT.normalWS = NormalizeNormalPerVertex(normalInputs.normalWS);
|
||||
//OUT.viewDirWS = viewDirWS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(IN.lightmapUV, unity_LightmapST, OUT.lightmapUV);
|
||||
OUTPUT_SH(OUT.normalWS.xyz, OUT.vertexSH);
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
OUT.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
OUT.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
OUT.shadowCoord = GetShadowCoord(positionInputs);
|
||||
#endif
|
||||
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// Fragment Shader
|
||||
half4 LitPassFragment(Varyings IN) : SV_Target {
|
||||
//UNITY_SETUP_INSTANCE_ID(IN);
|
||||
//UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
|
||||
// Setup SurfaceData
|
||||
SurfaceData surfaceData;
|
||||
InitalizeSurfaceData(IN, surfaceData);
|
||||
|
||||
// Setup InputData
|
||||
InputData inputData;
|
||||
InitializeInputData(IN, surfaceData.normalTS, inputData);
|
||||
|
||||
// Simple Lighting (Lambert & BlinnPhong)
|
||||
//half4 color = UniversalFragmentBlinnPhong(inputData, surfaceData); // v12 only
|
||||
half4 color = UniversalFragmentBlinnPhong(inputData, surfaceData.albedo, half4(surfaceData.specular, 1),
|
||||
surfaceData.smoothness, surfaceData.emission, surfaceData.alpha);
|
||||
// See Lighting.hlsl to see how this is implemented.
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl
|
||||
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
//color.a = OutputAlpha(color.a, _Surface);
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
// UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
||||
// Would be nice if we could just use the passes from existing shaders,
|
||||
// However this breaks SRP Batcher compatibility. Instead, we should define them :
|
||||
|
||||
// ShadowCaster, for casting shadows
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
// Universal Pipeline Keywords
|
||||
// (v11+) This is used during shadow map generation to differentiate between directional and punctual (point/spot) light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#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.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedShadowPassVertex (instead of ShadowPassVertex above)
|
||||
|
||||
Varyings DisplacedShadowPassVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthOnly, used for Camera Depth Texture (if cannot copy depth buffer instead, and the DepthNormals below isn't used)
|
||||
Pass {
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode"="DepthOnly" }
|
||||
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthOnlyVertex (instead of DepthOnlyVertex above)
|
||||
|
||||
Varyings DisplacedDepthOnlyVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthNormals, used for SSAO & other custom renderer features that request it
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthNormalsVertex (instead of DepthNormalsVertex above)
|
||||
|
||||
Varyings DisplacedDepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8edd04e63e13ee24fa199ccb87d74c63
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,79 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
Shader "Cyanilux/URPTemplates/TransparentUnlitShaderExample" {
|
||||
Properties {
|
||||
_BaseMap ("Example Texture", 2D) = "white" {}
|
||||
_BaseColor ("Example Colour", Color) = (0, 0.66, 0.73, 0.5)
|
||||
//_ExampleVector ("Example Vector", Vector) = (0, 1, 0, 0)
|
||||
//_ExampleFloat ("Example Float (Vector1)", Float) = 0.5
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Transparent"
|
||||
"Queue"="Transparent"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
//float4 _ExampleVector;
|
||||
//float _ExampleFloat;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "Unlit"
|
||||
//Tags { "LightMode"="SRPDefaultUnlit" } // (is default anyway)
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UnlitPassVertex
|
||||
#pragma fragment UnlitPassFragment
|
||||
|
||||
// Structs
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
// Textures, Samplers & Global Properties
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
|
||||
// Vertex Shader
|
||||
Varyings UnlitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
// Or :
|
||||
//OUT.positionCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// Fragment Shader
|
||||
half4 UnlitPassFragment(Varyings IN) : SV_Target {
|
||||
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
|
||||
return baseMap * _BaseColor * IN.color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0c68aaf35b97b9439cd476bb0479a20
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
236
Assets/Shaders/URP_ShaderCodeTemplates/URP_Unlit+Template.shader
Normal file
236
Assets/Shaders/URP_ShaderCodeTemplates/URP_Unlit+Template.shader
Normal file
@ -0,0 +1,236 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
Shader "Cyanilux/URPTemplates/Unlit+ShaderExample" {
|
||||
Properties {
|
||||
_BaseMap ("Example Texture", 2D) = "white" {}
|
||||
_BaseColor ("Example Colour", Color) = (0, 0.66, 0.73, 1)
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTestToggle ("Alpha Clipping", Float) = 0
|
||||
_Cutoff ("Alpha Cutoff", Float) = 0.5
|
||||
|
||||
[HideInInspector] _Cull("__cull", Float) = 2.0
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry"
|
||||
"UniversalMaterialType" = "Lit" "IgnoreProjector" = "True"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
float _Cutoff;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "Unlit"
|
||||
//Tags { "LightMode"="SRPDefaultUnlit" } // (is default anyway)
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UnlitPassVertex
|
||||
#pragma fragment UnlitPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature _ALPHATEST_ON
|
||||
|
||||
// Structs
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
// Textures, Samplers & Global Properties
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
|
||||
// Vertex Shader
|
||||
Varyings UnlitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
// Or :
|
||||
//OUT.positionCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// Fragment Shader
|
||||
half4 UnlitPassFragment(Varyings IN) : SV_Target {
|
||||
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
|
||||
#ifdef _ALPHATEST_ON
|
||||
// Alpha Clipping
|
||||
clip(baseMap.a - _Cutoff);
|
||||
#endif
|
||||
|
||||
return baseMap * _BaseColor * IN.color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
// UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
||||
// Would be nice if we could just use the passes from existing shaders,
|
||||
// However this breaks SRP Batcher compatibility. Instead, we should define them :
|
||||
|
||||
// ShadowCaster, for casting shadows
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode"="ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
ColorMask 0
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature _ALPHATEST_ON
|
||||
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
// Universal Pipeline Keywords
|
||||
// (v11+) This is used during shadow map generation to differentiate between directional and punctual (point/spot) light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#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.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedShadowPassVertex (instead of ShadowPassVertex above)
|
||||
|
||||
Varyings DisplacedShadowPassVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthOnly, used for Camera Depth Texture (if cannot copy depth buffer instead, and the DepthNormals below isn't used)
|
||||
Pass {
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode"="DepthOnly" }
|
||||
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature _ALPHATEST_ON
|
||||
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthOnlyVertex (instead of DepthOnlyVertex above)
|
||||
|
||||
Varyings DisplacedDepthOnlyVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// DepthNormals, used for SSAO & other custom renderer features that request it
|
||||
Pass {
|
||||
Name "DepthNormals"
|
||||
Tags { "LightMode"="DepthNormals" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature _ALPHATEST_ON
|
||||
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
//#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#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.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
// Note if we do any vertex displacement, we'll need to change the vertex function. e.g. :
|
||||
/*
|
||||
#pragma vertex DisplacedDepthNormalsVertex (instead of DepthNormalsVertex above)
|
||||
|
||||
Varyings DisplacedDepthNormalsVertex(Attributes input) {
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Example Displacement
|
||||
input.positionOS += float4(0, _SinTime.y, 0, 0);
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionCS = TransformObjectToHClip(input.position.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
|
||||
output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 431ebee5218e4794d891fdf9aae50bd7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,83 @@
|
||||
// Example Shader for Universal RP
|
||||
// Written by @Cyanilux
|
||||
// https://www.cyanilux.com/tutorials/urp-shader-code
|
||||
|
||||
/*
|
||||
Note : URP v12 (2021.3+) added a Depth Priming option :
|
||||
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/manual/whats-new/urp-whats-new.html#depth-prepass-depth-priming-mode
|
||||
This may be auto/enabled in the URP project templates and as a result, this shader may appear invisible.
|
||||
Use the Unlit+ Template instead with the DepthOnly and DepthNormals passes to fix this.
|
||||
*/
|
||||
|
||||
Shader "Cyanilux/URPTemplates/UnlitShaderExample" {
|
||||
Properties {
|
||||
_BaseMap ("Example Texture", 2D) = "white" {}
|
||||
_BaseColor ("Example Colour", Color) = (0, 0.66, 0.73, 1)
|
||||
//_ExampleVector ("Example Vector", Vector) = (0, 1, 0, 0)
|
||||
//_ExampleFloat ("Example Float (Vector1)", Float) = 0.5
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
"Queue"="Geometry"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _BaseColor;
|
||||
//float4 _ExampleVector;
|
||||
//float _ExampleFloat;
|
||||
CBUFFER_END
|
||||
ENDHLSL
|
||||
|
||||
Pass {
|
||||
Name "Unlit"
|
||||
//Tags { "LightMode"="SRPDefaultUnlit" } // (is default anyway)
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UnlitPassVertex
|
||||
#pragma fragment UnlitPassFragment
|
||||
|
||||
// Structs
|
||||
struct Attributes {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
// Textures, Samplers & Global Properties
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
|
||||
// Vertex Shader
|
||||
Varyings UnlitPassVertex(Attributes IN) {
|
||||
Varyings OUT;
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||
OUT.positionCS = positionInputs.positionCS;
|
||||
// Or :
|
||||
//OUT.positionCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
OUT.color = IN.color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
// Fragment Shader
|
||||
half4 UnlitPassFragment(Varyings IN) : SV_Target {
|
||||
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
|
||||
return baseMap * _BaseColor * IN.color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7431ef59f264b6f45befe166efa2f32f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user