feat: added a manual/test ripple to the shader inspector
This commit is contained in:
parent
5b70a11589
commit
269f154cc3
@ -26,9 +26,9 @@ Material:
|
|||||||
m_ModifiedSerializedProperties: 0
|
m_ModifiedSerializedProperties: 0
|
||||||
m_ValidKeywords:
|
m_ValidKeywords:
|
||||||
- _ALPHAPREMULTIPLY_ON
|
- _ALPHAPREMULTIPLY_ON
|
||||||
|
- _MANUAL_RIPPLE
|
||||||
- _OCCLUSIONMAP
|
- _OCCLUSIONMAP
|
||||||
- _SPECULARHIGHLIGHTS_OFF
|
- _SPECULARHIGHLIGHTS_OFF
|
||||||
- _SPECULAR_SETUP
|
|
||||||
- _SURFACE_TYPE_TRANSPARENT
|
- _SURFACE_TYPE_TRANSPARENT
|
||||||
m_InvalidKeywords: []
|
m_InvalidKeywords: []
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
@ -135,17 +135,23 @@ Material:
|
|||||||
- _Glossiness: 0
|
- _Glossiness: 0
|
||||||
- _GlossyReflections: 0
|
- _GlossyReflections: 0
|
||||||
- _ImpactSpeed: 4.22
|
- _ImpactSpeed: 4.22
|
||||||
|
- _ManualRipple: 1
|
||||||
|
- _ManualRippleAmplitude: 0.1
|
||||||
|
- _ManualRippleAnim: 0
|
||||||
|
- _ManualRippleDensity: 15
|
||||||
|
- _ManualRippleFrequency: 20
|
||||||
|
- _ManualRippleRadius: 4
|
||||||
- _MaxWaveDistortion: 1.13
|
- _MaxWaveDistortion: 1.13
|
||||||
- _Metallic: 0.967
|
- _Metallic: 0.88
|
||||||
- _MetallicSpecGlossMapToggle: 0
|
- _MetallicSpecGlossMapToggle: 0
|
||||||
- _MetallicSpecToggle: 1
|
- _MetallicSpecToggle: 0
|
||||||
- _NormalMapToggle: 0
|
- _NormalMapToggle: 0
|
||||||
- _OcclusionStrength: 1
|
- _OcclusionStrength: 1
|
||||||
- _OcclusionToggle: 1
|
- _OcclusionToggle: 1
|
||||||
- _Parallax: 0.005
|
- _Parallax: 0.005
|
||||||
- _QueueOffset: 0
|
- _QueueOffset: 0
|
||||||
- _ReceiveShadows: 1
|
- _ReceiveShadows: 1
|
||||||
- _Smoothness: 0.914
|
- _Smoothness: 0.906
|
||||||
- _SmoothnessSource: 0
|
- _SmoothnessSource: 0
|
||||||
- _SmoothnessTextureChannel: 1
|
- _SmoothnessTextureChannel: 1
|
||||||
- _SpecularHighlights: 1
|
- _SpecularHighlights: 1
|
||||||
@ -178,12 +184,13 @@ Material:
|
|||||||
- _shield_pulse_radius: 1
|
- _shield_pulse_radius: 1
|
||||||
- _shield_size: 0
|
- _shield_size: 0
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0, g: 1, b: 0.029850721, a: 0.45490196}
|
- _BaseColor: {r: 0, g: 1, b: 0.029850721, a: 0.39607844}
|
||||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
- _EmissionColor: {r: 4, g: 1.9433963, b: 1.9433963, a: 0}
|
- _EmissionColor: {r: 4, g: 1.9433963, b: 1.9433963, a: 0}
|
||||||
- _ImpactOrigin: {r: 1, g: 0, b: 0, a: 0}
|
- _ImpactOrigin: {r: 1, g: 0, b: 0, a: 0}
|
||||||
|
- _ManualRippleOrigin: {r: 1, g: 0, b: 0, a: 0}
|
||||||
- _ModelOrigin: {r: 0, g: 0, b: 0, a: 0}
|
- _ModelOrigin: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- _SpecColor: {r: 0.9433962, g: 0.9433962, b: 0.9433962, a: 1}
|
- _SpecColor: {r: 0.990566, g: 0.990566, b: 0.990566, a: 1}
|
||||||
- _WaveOrigin: {r: 1, g: 0, b: 0, a: 0}
|
- _WaveOrigin: {r: 1, g: 0, b: 0, a: 0}
|
||||||
- _impact_origin: {r: 1, g: 0, b: 0, a: 1}
|
- _impact_origin: {r: 1, g: 0, b: 0, a: 1}
|
||||||
- _rotation: {r: 0.1, g: 0, b: 0, a: 1}
|
- _rotation: {r: 0.1, g: 0, b: 0, a: 1}
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
Jakob Feldmann,J4K0B/jakob,J4K0B,23.02.2024 15:25,file:///C:/Users/jakob/AppData/Roaming/OpenOffice/4;
|
||||||
@ -64,13 +64,19 @@ Shader "CustomShaders/GlossyPBRRipples" {
|
|||||||
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
|
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
|
||||||
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "white" {}
|
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "white" {}
|
||||||
|
|
||||||
|
[Space(20)]
|
||||||
|
[Toggle(_MANUAL_RIPPLE)] _ManualRipple("Use Manual/Test Ripple", Float) = 0
|
||||||
|
_ManualRippleOrigin("Ripple Origin", Vector) = (0,0,0)
|
||||||
|
_ManualRippleFrequency("Ripple Frequency", Float) = 0
|
||||||
|
_ManualRippleDensity("Ripple Density", Float) = 0
|
||||||
|
_ManualRippleAmplitude("Ripple Amplitude", Float) = 0
|
||||||
|
_ManualRippleRadius("Ripple Effect Radius", Float) = 0
|
||||||
|
_ManualRippleAnim("Ripple Animation Progress", Range(0.0, 1.0)) = 0
|
||||||
|
|
||||||
// These are inverted fom what the URP/Lit shader does which is a bit annoying.
|
// 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,
|
// 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.
|
// which assumes the keyword is more of an "on" state.
|
||||||
// Not including Detail maps in this template
|
// Not including Detail maps in this template
|
||||||
|
|
||||||
// [Space(20)]
|
|
||||||
// [Toggle(_)]
|
|
||||||
}
|
}
|
||||||
SubShader {
|
SubShader {
|
||||||
Tags {
|
Tags {
|
||||||
@ -122,6 +128,13 @@ Shader "CustomShaders/GlossyPBRRipples" {
|
|||||||
return i * smoothstep(radius, 0, dist);
|
return i * smoothstep(radius, 0, dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
half _ComputeManualRipple(half3 vert, half3 orig, half radius, half freq, half dens, half ampl, half anim) {
|
||||||
|
half dist = distance(vert, orig);
|
||||||
|
half i = sin((freq * anim - dist * dens)) * ampl * _TrapezoidEase(anim * 2 - 1);
|
||||||
|
// Displacement gets lower as it approaches the set max distance
|
||||||
|
return i * smoothstep(radius, 0, dist);
|
||||||
|
}
|
||||||
|
|
||||||
ENDHLSL
|
ENDHLSL
|
||||||
|
|
||||||
Pass {
|
Pass {
|
||||||
@ -143,6 +156,14 @@ Shader "CustomShaders/GlossyPBRRipples" {
|
|||||||
half _RippleRadii[5];
|
half _RippleRadii[5];
|
||||||
half _RippleStartTimes[5];
|
half _RippleStartTimes[5];
|
||||||
half _RippleDurations[5];
|
half _RippleDurations[5];
|
||||||
|
// These are the properties for the singular ripple which can be adjusted in the
|
||||||
|
// inspector.
|
||||||
|
half3 _ManualRippleOrigin = {0,0,0};
|
||||||
|
half _ManualRippleRadius = 0;
|
||||||
|
half _ManualRippleFrequency = 0;
|
||||||
|
half _ManualRippleDensity = 0;
|
||||||
|
half _ManualRippleAmplitude = 0;
|
||||||
|
half _ManualRippleAnim = 0;
|
||||||
|
|
||||||
#pragma vertex LitPassVertex
|
#pragma vertex LitPassVertex
|
||||||
#pragma fragment LitPassFragment
|
#pragma fragment LitPassFragment
|
||||||
@ -159,6 +180,8 @@ Shader "CustomShaders/GlossyPBRRipples" {
|
|||||||
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
|
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
|
||||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
||||||
#pragma shader_feature_local_fragment _OCCLUSIONMAP
|
#pragma shader_feature_local_fragment _OCCLUSIONMAP
|
||||||
|
#pragma shader_feature_local_vertex _MANUAL_RIPPLE
|
||||||
|
|
||||||
|
|
||||||
//#pragma shader_feature_local _PARALLAXMAP // v10+ only
|
//#pragma shader_feature_local _PARALLAXMAP // v10+ only
|
||||||
//#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED // v10+ only
|
//#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED // v10+ only
|
||||||
@ -267,6 +290,17 @@ Shader "CustomShaders/GlossyPBRRipples" {
|
|||||||
_RippleDurations[i]);
|
_RippleDurations[i]);
|
||||||
IN.positionOS.xyz += IN.normalOS * ripple_displacement;
|
IN.positionOS.xyz += IN.normalOS * ripple_displacement;
|
||||||
|
|
||||||
|
#if _MANUAL_RIPPLE
|
||||||
|
ripple_displacement += _ComputeManualRipple(IN.positionOS.xyz,
|
||||||
|
_ManualRippleOrigin,
|
||||||
|
_ManualRippleRadius,
|
||||||
|
_ManualRippleFrequency,
|
||||||
|
_ManualRippleDensity,
|
||||||
|
_ManualRippleAmplitude,
|
||||||
|
_ManualRippleAnim);
|
||||||
|
IN.positionOS.xyz += IN.normalOS * ripple_displacement;
|
||||||
|
#endif
|
||||||
|
|
||||||
// if _TestRipple
|
// if _TestRipple
|
||||||
|
|
||||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
VertexPositionInputs positionInputs = GetVertexPositionInputs(IN.positionOS.xyz);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user