feat: New Theatre volumetric rays

This commit is contained in:
Alexandre Coirier
2026-05-31 23:40:59 +02:00
parent d63ef70e48
commit f0b4b9a428
4 changed files with 1155 additions and 213 deletions
@@ -37,6 +37,10 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _SampleTexture2D_45427f0cc3994257be048fc580e65bba_Texture_1_Texture2D:
m_Texture: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -54,12 +58,17 @@ Material:
- _Debug: 0
- _Demo: 0
- _IgnoreAtten: 1
- _Intendity: 0.828
- _Intensity: 1
- _Noise: 0.786
- _QueueControl: 0
- _QueueOffset: 0
- _Size: 1
- _Speed: 2
- _Stop: 1
- _UV: 0
m_Colors:
- _Color: {r: 11.984315, g: 8.690491, b: 3.2428153, a: 0.07058824}
- _Color: {r: 2, g: 1.3822709, b: 0.7329843, a: 0.09803922}
- _Direction: {r: 0, g: 0, b: 1, a: 0}
- _Size: {r: 3, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
File diff suppressed because it is too large Load Diff
@@ -25,7 +25,7 @@ float3 GetBillboardPositionWS(float3 PositionOS, float3 PivotWS, float3 ViewDirW
float3 ApplayerTaperAndScale(float3 PositionOS, float3 Scale)
{
float taper = lerp(Scale.z, 1, saturate(PositionOS.y));
float taper = lerp(1, Scale.z, saturate(PositionOS.y));
float3 p = PositionOS;
p.xy *= Scale.xy;
@@ -36,10 +36,14 @@ float3 ApplayerTaperAndScale(float3 PositionOS, float3 Scale)
void Ray_float
(
float3 Color,
float Size,
float Speed,
float Intensity,
float4 Color,
float3 PositionOS,
float4 ScreenPos,
uint Orthographic,
float UvDebug,
out float3 OutPosition,
out float3 OutColor
)
@@ -69,6 +73,24 @@ void Ray_float
float2 uv = float2(distance(pSC_0.x, pSC_2.x) / distance(pSC_1.x, pSC_2.x), pOS_0.y / scale.y);
float mask = smoothstep(1, .2, abs(uv.x * 2 - 1));
mask *= smoothstep(0, .1, uv.y);
mask *= pow(smoothstep(1, .3, uv.y * .95), 2);
mask *= smoothstep(1, .98, dot(-viewDir, normalize(TransformObjectToWorldDir(float3(0, 1, 0)))));
float noise = 1;
if (Intensity > 0)
{
float3 noisePos = pivot;
noisePos += float3(uv.x - .5, 0 /*uv.y * .05 / scale.x*/, _Time.y / scale.x / scale.z / Size * Speed * .2);
noise = SimplexNoise3D(noisePos, scale.x * scale.z * Size);
noise = lerp(1, noise, Intensity);
}
OutPosition = TransformWorldToObject(pWS_0);
OutColor = float3(uv, 0);
OutColor = saturate(noise * mask) * Color.rgb * Color.a;
if (UvDebug > 0)
OutColor = lerp(OutColor, float3(uv, 0), UvDebug);
}