From 7274f6d6234e5bd20dbd440051e8ae7613492458 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 16 Oct 2026 04:06:01 +0200 Subject: [PATCH] Delete the fog marcher nothing draws VolumeRender and VolumeRenderCustom shaders, the four Fog Marching materials, ZoneRenderer's FogMaterial/FogFarFadeFraction and its _DepthCeiling/_DepthBlend writes, the ARPG scene values, and the Volumetric.cginc _TintExponent, texFlow and tintGradient (with its commented-out caller). The live nebula is VolumeCloudRenderer + CloudShader. Unity compile not yet run on this commit. Co-Authored-By: Claude Opus 5.5 --- Assets/Materials/Fog Marching 1.mat | 73 ------ Assets/Materials/Fog Marching 1.mat.meta | 8 - Assets/Materials/Fog Marching Main Menu.mat | 99 -------- .../Materials/Fog Marching Main Menu.mat.meta | 8 - Assets/Materials/Fog Marching Test.mat | 65 ----- Assets/Materials/Fog Marching Test.mat.meta | 8 - Assets/Materials/Fog Marching.mat | 99 -------- Assets/Materials/Fog Marching.mat.meta | 8 - Assets/Scenes/ARPG.unity | 2 - Assets/Scripts/Zone Display/ZoneRenderer.cs | 4 - .../Shaders/Raymarching/VolumeRender.shader | 217 ---------------- .../Raymarching/VolumeRender.shader.meta | 9 - .../Raymarching/VolumeRenderCustom.shader | 236 ------------------ .../VolumeRenderCustom.shader.meta | 3 - Assets/Shaders/Volumetric.cginc | 20 -- 15 files changed, 859 deletions(-) delete mode 100644 Assets/Materials/Fog Marching 1.mat delete mode 100644 Assets/Materials/Fog Marching 1.mat.meta delete mode 100644 Assets/Materials/Fog Marching Main Menu.mat delete mode 100644 Assets/Materials/Fog Marching Main Menu.mat.meta delete mode 100644 Assets/Materials/Fog Marching Test.mat delete mode 100644 Assets/Materials/Fog Marching Test.mat.meta delete mode 100644 Assets/Materials/Fog Marching.mat delete mode 100644 Assets/Materials/Fog Marching.mat.meta delete mode 100644 Assets/Shaders/Raymarching/VolumeRender.shader delete mode 100644 Assets/Shaders/Raymarching/VolumeRender.shader.meta delete mode 100644 Assets/Shaders/Raymarching/VolumeRenderCustom.shader delete mode 100644 Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta diff --git a/Assets/Materials/Fog Marching 1.mat b/Assets/Materials/Fog Marching 1.mat deleted file mode 100644 index 20290c785..000000000 --- a/Assets/Materials/Fog Marching 1.mat +++ /dev/null @@ -1,73 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Fog Marching 1 - m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _Displacement: - m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} - 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} - - _Patch: - m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Surface: - m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _TintTexture: - m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _AlphaFloor: 0.01 - - _DepthBlend: 512 - - _DepthCeiling: 4096 - - _FlowSpeed: 2 - - _Gamma: 0.5 - - _GridCeilingBlend: -300 - - _GridCeilingDensity: 0.01 - - _GridCeilingFollow: 0 - - _GridCeilingOffset: 0 - - _GridFillDensity: 0.001 - - _GridFloorBlend: 100 - - _GridFloorDensity: 2 - - _GridFloorOffset: 20 - - _GridPatchBlend: 50 - - _GridPatchDensity: 2 - - _NoiseExponent: 2.25 - - _NoiseFrequency: 0.015 - - _NoiseSpeed: 0 - - _NoiseStrength: 500 - - _SafetyDistance: 20 - - _Scattering: 0 - - _ScatteringDensityExponent: 0.5 - - _ScatteringDistExponent: 0.5 - - _ScatteringMinDist: 500 - - _StepExponent: 2 - - _TintExponent: 0.1 - - _TurbulenceAmplitude: 100 - - _TurbulenceScale: 100 - m_Colors: - - _Tint: {r: 0.0627451, g: 0.0627451, b: 0.0627451, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Materials/Fog Marching 1.mat.meta b/Assets/Materials/Fog Marching 1.mat.meta deleted file mode 100644 index 00e039020..000000000 --- a/Assets/Materials/Fog Marching 1.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a72896cb7097bfa46a1a8f4092e47c72 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Materials/Fog Marching Main Menu.mat b/Assets/Materials/Fog Marching Main Menu.mat deleted file mode 100644 index b22522a2d..000000000 --- a/Assets/Materials/Fog Marching Main Menu.mat +++ /dev/null @@ -1,99 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Fog Marching Main Menu - m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _Displacement: - m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} - 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} - - _NebulaPatch: - m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaPatchHeight: - m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaSurfaceHeight: - m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaTint: - m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Patch: - m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Surface: - m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _TintTexture: - m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _AlphaFloor: 0 - - _DepthBlend: 512 - - _DepthCeiling: 1024 - - _Exposure: 100 - - _FlowAmplitude: 1 - - _FlowScale: 1 - - _FlowScroll: 1 - - _FlowSpeed: 5 - - _Gamma: 0.3 - - _GridCeilingBlend: -300 - - _GridCeilingDensity: 0.01 - - _GridCeilingFollow: 0 - - _GridCeilingOffset: 0 - - _GridFillDensity: 0.001 - - _GridFloorBlend: 50 - - _GridFloorDensity: 1 - - _GridFloorOffset: 100 - - _GridPatchBlend: 50 - - _GridPatchDensity: 1 - - _NebulaFillDensity: 0.00075 - - _NebulaFloorBlend: 50 - - _NebulaFloorDensity: 1 - - _NebulaFloorOffset: 80 - - _NebulaPatchBlend: 25 - - _NebulaPatchDensity: 0.1 - - _NoiseExponent: 2 - - _NoiseFrequency: 0.02 - - _NoiseSpeed: 0.00001 - - _NoiseStrength: 200 - - _SafetyDistance: 50 - - _Scattering: 0 - - _ScatteringDensityExponent: 8 - - _ScatteringDistExponent: 0.5 - - _ScatteringMinDist: 1 - - _StepExponent: 2 - - _TintExponent: 1.2 - - _TurbulenceAmplitude: 20 - - _TurbulenceScale: 30 - m_Colors: - - _Tint: {r: 0.09411765, g: 0.09411765, b: 0.09411765, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Materials/Fog Marching Main Menu.mat.meta b/Assets/Materials/Fog Marching Main Menu.mat.meta deleted file mode 100644 index 6a5cdb35e..000000000 --- a/Assets/Materials/Fog Marching Main Menu.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e21702a5e6e98b7409d6913663ceab7e -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Materials/Fog Marching Test.mat b/Assets/Materials/Fog Marching Test.mat deleted file mode 100644 index 91b56761e..000000000 --- a/Assets/Materials/Fog Marching Test.mat +++ /dev/null @@ -1,65 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Fog Marching Test - m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _Displacement: - m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} - 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} - - _Patch: - m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Surface: - m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _TintTexture: - m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _AlphaFloor: 0 - - _DepthBlend: 512 - - _DepthCeiling: 4096 - - _Gamma: 0.66 - - _GridCeilingBlend: -300 - - _GridCeilingDensity: 0.01 - - _GridCeilingFollow: 0 - - _GridCeilingOffset: 0 - - _GridFillDensity: 0.000025 - - _GridFloorBlend: 100 - - _GridFloorDensity: 4 - - _GridFloorOffset: 0 - - _GridPatchBlend: 5 - - _GridPatchDensity: 0.1 - - _NoiseFrequency: 0.01 - - _NoiseSpeed: 0.02 - - _NoiseStrength: 50 - - _SafetyDistance: 0 - - _StepExponent: 2 - - _TintExponent: 8 - m_Colors: - - _Tint: {r: 2.0078435, g: 2.0078435, b: 2.0078435, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Materials/Fog Marching Test.mat.meta b/Assets/Materials/Fog Marching Test.mat.meta deleted file mode 100644 index 9f0e3d586..000000000 --- a/Assets/Materials/Fog Marching Test.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad63650ae6d6cc542a5aad16694b3c46 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Materials/Fog Marching.mat b/Assets/Materials/Fog Marching.mat deleted file mode 100644 index 52dc13c19..000000000 --- a/Assets/Materials/Fog Marching.mat +++ /dev/null @@ -1,99 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Fog Marching - m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _Displacement: - m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} - 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} - - _NebulaPatch: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaPatchHeight: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaSurfaceHeight: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NebulaTint: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Patch: - m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Surface: - m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _TintTexture: - m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _AlphaFloor: 0.01 - - _DepthBlend: 512 - - _DepthCeiling: 4096 - - _Exposure: 10 - - _FlowAmplitude: 512 - - _FlowScale: 1024 - - _FlowScroll: 0 - - _FlowSpeed: 1 - - _Gamma: 0.3 - - _GridCeilingBlend: -300 - - _GridCeilingDensity: 0.01 - - _GridCeilingFollow: 0 - - _GridCeilingOffset: 0 - - _GridFillDensity: 0.0005 - - _GridFloorBlend: 50 - - _GridFloorDensity: 1 - - _GridFloorOffset: 10 - - _GridPatchBlend: 150 - - _GridPatchDensity: 1 - - _NebulaFillDensity: 0.00075 - - _NebulaFloorBlend: 150 - - _NebulaFloorDensity: 1 - - _NebulaFloorOffset: 0 - - _NebulaPatchBlend: 51.47 - - _NebulaPatchDensity: 0.25 - - _NoiseExponent: 3 - - _NoiseFrequency: 0.005 - - _NoiseSpeed: 0 - - _NoiseStrength: -400 - - _SafetyDistance: 200 - - _Scattering: 50 - - _ScatteringDensityExponent: 1 - - _ScatteringDistExponent: 1.5 - - _ScatteringMinDist: 10 - - _StepExponent: 2 - - _TintExponent: 2 - - _TurbulenceAmplitude: 20 - - _TurbulenceScale: 60 - m_Colors: - - _Tint: {r: 0.01, g: 0.01, b: 0.01, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Materials/Fog Marching.mat.meta b/Assets/Materials/Fog Marching.mat.meta deleted file mode 100644 index 04c6076f8..000000000 --- a/Assets/Materials/Fog Marching.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2ff39f5d101241043ba1dcde19d92f77 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index 9c650e2f0..9591afb11 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -16332,8 +16332,6 @@ MonoBehaviour: - {fileID: 488792362} - {fileID: 970624071} - {fileID: 2095741464} - FogMaterial: {fileID: 2100000, guid: 2ff39f5d101241043ba1dcde19d92f77, type: 2} - FogFarFadeFraction: 0.125 FarPlaneDistanceMultiplier: 1 AsteroidMeshes: - Mesh: {fileID: 4300004, guid: bdb4c719a85f3f2419f6c573dd1daf15, type: 3} diff --git a/Assets/Scripts/Zone Display/ZoneRenderer.cs b/Assets/Scripts/Zone Display/ZoneRenderer.cs index e92c78c27..0ecb45f2f 100644 --- a/Assets/Scripts/Zone Display/ZoneRenderer.cs +++ b/Assets/Scripts/Zone Display/ZoneRenderer.cs @@ -30,8 +30,6 @@ public class ZoneRenderer : MonoBehaviour public CinemachineVirtualCamera SceneCamera; public Camera[] FogCameras; public Camera[] MinimapCameras; - public Material FogMaterial; - public float FogFarFadeFraction = .125f; public float FarPlaneDistanceMultiplier = 2; public InstancedMesh[] AsteroidMeshes; public int AsteroidSpritesheetWidth = 4; @@ -141,8 +139,6 @@ public class ZoneRenderer : MonoBehaviour foreach (var camera in FogCameras) camera.orthographicSize = value; SceneCamera.m_Lens.FarClipPlane = value * FarPlaneDistanceMultiplier; - FogMaterial.SetFloat("_DepthCeiling", value); - FogMaterial.SetFloat("_DepthBlend", FogFarFadeFraction * value); } } diff --git a/Assets/Shaders/Raymarching/VolumeRender.shader b/Assets/Shaders/Raymarching/VolumeRender.shader deleted file mode 100644 index a6e5b4fc2..000000000 --- a/Assets/Shaders/Raymarching/VolumeRender.shader +++ /dev/null @@ -1,217 +0,0 @@ -Shader "VolSample/Volume Render Auto" { - Properties { - _MainTex( "", 2D ) = "white" {} - _StepExponent("Step Exponent", float) = 1 - //_GridTransform("Grid Transform", Vector) = (0,0,0,0) - _Exposure("Exposure", float) = 1 - _Gamma("Gamma", float) = .5 - _TintExponent("Tint Exponent", float) = .5 - _DepthCeiling("Depth Ceiling", float) = 1000 - _DepthBlend("Depth Blend", float) = 100 - _SafetyDistance("Safety Distance", float) = 20 - _Scattering("Scattering", float) = 1 - _ScatteringMinDist("ScatteringMinDist", float) = 1 - _ScatteringDistExponent("ScatteringDistExponent", float) = 1 - _ScatteringDensityExponent("ScatteringDensityExponent", float) = 1 - } - - CGINCLUDE; - - uniform sampler2D _MainTex; - uniform sampler2D _CameraDepthTexture; - - #include "UnityCG.cginc" - #include "Assets/Shaders/Volumetric.cginc" - - // the number of volume samples to take - #define SAMPLE_COUNT 96 - - // Shared shader code for pixel view rays, given screen pos and camera frame vectors. - // Camera vectors are passed in as this shader is run from a post proc camera, so the unity built-in values are not useful. - uniform float4x4 _CamProj; - uniform float4x4 _CamInvProj; - uniform float3 _CamPos; - uniform float3 _CamForward; - uniform float3 _CamRight; - uniform float _HalfFov; - uniform int _FrameNumber; - - uniform float _StepExponent; - - uniform half _Gamma, - _Exposure, - _DepthCeiling, - _DepthBlend, - _Scattering, - _ScatteringDensityExponent, - _ScatteringDistExponent, - _ScatteringMinDist; - - // Dithering - sampler2D _DitheringTex; - float4 _DitheringCoords; - - inline float nrand(float2 ScreenUVs) - { - return frac(sin(ScreenUVs.x * 12.9898 + ScreenUVs.y * 78.233) * 43758.5453); - } - - void RaymarchStep( in float3 pos, in float stepSize, in float weight, inout float4 sum, in float scatter, inout float scatterSum) - { - float4 col = VolumeSampleColor( pos ); - col.a *= stepSize * weight; - sum.rgb += col.rgb * col.a * (1.0 - sum.a); - sum.a += col.a; - scatterSum += pow(sum.a, _ScatteringDensityExponent) * scatter; - } - - float4 RayMarch( in float3 origin, in float3 direction, in float zbuf, in float2 screenUV, out float scatterSum ) - { - scatterSum = 0; - float blue = tex2D(_DitheringTex, screenUV * _DitheringCoords.xy + _DitheringCoords.zw).r; - //float rand = frac(blue + _FrameNumber * 1.61803398875); - //return float4(rand, rand, rand, 1); - //half rand = frac(nrand(screenUV) + _FrameNumber * 1.61803398875); - //half rand = nrand(screenUV + frac(_Time.x)); - half rand = blue; - float4 sum = (float4)0.; - scatterSum = 0.; - - // setup sampling - - float rayDist = 0; - for( int i = 0; i < SAMPLE_COUNT; i++ ) - { - float prevRayDist = rayDist; - rayDist = pow((i+rand)/SAMPLE_COUNT,_StepExponent) * _DepthCeiling + 1; - float distToSurf = zbuf - rayDist; - if( distToSurf <= 0.001 || sum.a > .99) break; - - float step = rayDist - prevRayDist; - //float wt = (distToSurf >= step) ? 1. : distToSurf / step; - - RaymarchStep( origin + rayDist * direction, step, 1-rayDist/_DepthCeiling, sum, _Scattering/pow(max(rayDist,_ScatteringMinDist),_ScatteringDistExponent), scatterSum); - } - - sum.rgb = pow( sum.rgb / pow(100,_TintExponent), 1 / _Gamma ) * _Exposure; - return sum; - } - - struct v2f - { - float4 pos : SV_POSITION; - float4 screenPos : TEXCOORD1; - }; - - v2f vert( appdata_base v ) - { - v2f o; - o.pos = UnityObjectToClipPos( v.vertex ); - o.screenPos = ComputeScreenPos( o.pos ); - return o; - } - - void computeCamera( in float2 q, out float3 rayOrigin, out float3 rayDirection ) - { - rayOrigin = _WorldSpaceCameraPos; - - float2 p = 2.0*(q - 0.5); - float4 d = mul(_CamProj, float4(p, 0, 1)); - d.xyz /= d.w; - //rd = (d - rayOrigin); - rayDirection = normalize(d - rayOrigin); - rayOrigin = d; - //rayOrigin += _ProjectionParams.y * rd; - } - - inline float LinearEyeDepthToOutDepth(float z) - { - return (1 - _ZBufferParams.w * z) / (_ZBufferParams.z * z); - } - - float3 DepthToWorld(float2 uv, float depth) { - float z = (1-depth) * 2.0 - 1.0; - - float4 clipSpacePosition = float4(uv * 2.0 - 1.0, z, 1.0); - - float4 viewSpacePosition = mul(_CamInvProj,clipSpacePosition); - viewSpacePosition /= viewSpacePosition.w; - - float4 worldSpacePosition = mul(unity_ObjectToWorld,viewSpacePosition); - - return worldSpacePosition.xyz; - } - - // MRT shader - struct FragmentOutput - { - half4 dest0 : COLOR0; - half4 dest1 : COLOR1; - }; - - FragmentOutput frag( v2f i ) : SV_Target //out float outDepth : SV_Depth - { - FragmentOutput o; - - float2 q = i.screenPos.xy / i.screenPos.w; - - // camera - float3 rayOrigin, rayDirection; - computeCamera( q, rayOrigin, rayDirection ); - - // z buffer / scene depth for this pixel - float4 screenPos = UNITY_PROJ_COORD( i.screenPos ); - float2 screenUV = screenPos.xy / screenPos.w; - - float depthSample = tex2Dproj( _CameraDepthTexture, screenPos ).r; - //float depthValue = LinearEyeDepth(depthSample); - - float3 worldDepth = DepthToWorld(screenPos, depthSample); - float depthValue = length(worldDepth-rayOrigin); - - // march through volume - float scatter; - float4 clouds = RayMarch( rayOrigin, rayDirection, depthValue, screenUV, scatter ); - o.dest1 = .5 + scatter*.5;//smoothstep(1,.99,clouds.a)*pow(clouds.a,1)*.5; - - float3 bgcol = tex2Dlod( _MainTex, float4(q, 0., 0.) ); - // add in camera render colours, if not zfar (so we exclude skybox) - if(clouds.a < .99 && depthValue < _DepthCeiling) - { - // Blend out camera render when outside marching range - if( depthValue >= _DepthCeiling - _DepthBlend ) - clouds.a = lerp(clouds.a, 1, (depthValue - (_DepthCeiling - _DepthBlend)) / _DepthBlend); - - //clouds.xyz = lerp(clouds.xyz, bgcol, 1-clouds.a); - clouds.xyz += (1. - clouds.a) * bgcol; - // assume zbuffer represents opaque surface - - } - clouds.a = 1.; - - //outDepth = LinearEyeDepthToOutDepth(min(depthValue, rayDist)); - - o.dest0 = clouds; - return o; - } - - - ENDCG - - Subshader - { - Pass - { - ZTest Always Cull Off ZWrite Off - - CGPROGRAM - #pragma target 3.0 - #pragma vertex vert - #pragma fragment frag - ENDCG - } - } - - Fallback off - -} // shader diff --git a/Assets/Shaders/Raymarching/VolumeRender.shader.meta b/Assets/Shaders/Raymarching/VolumeRender.shader.meta deleted file mode 100644 index 7ca59e2ad..000000000 --- a/Assets/Shaders/Raymarching/VolumeRender.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7a890b6ceccf53c44bfc54b18b5daa58 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader deleted file mode 100644 index cf0a548b3..000000000 --- a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader +++ /dev/null @@ -1,236 +0,0 @@ -Shader "VolSample/Volume Render" { - Properties { - _MainTex( "", 2D ) = "white" {} - _StepExponent("Step Exponent", float) = 1 - _NebulaSurfaceHeight("Surface Displacement", 2D) = "black" {} - _NebulaPatch("Patch", 2D) = "black" {} - _NebulaPatchHeight("Patch Displacement", 2D) = "black" {} - _NebulaTint("Tint Texture", 2D ) = "white" {} - [HDR]_Tint("Tint Color", Color) = (1,1,1,1) - //_GridTransform("Grid Transform", Vector) = (0,0,0,0) - _NebulaFillDensity("Fill Density", float) = 1 - _NebulaFloorDensity("Floor Density", float) = 1 - _NebulaPatchDensity("Patch Density", float) = 1 - _NebulaFloorOffset("Floor Offset", float) = 1 - _NebulaFloorBlend("Floor Blend", float) = 1 - _NebulaPatchBlend("Patch Blend", float) = 1 - _Exposure("Exposure", float) = 1 - _Gamma("Gamma", float) = .5 - _TintExponent("Tint Exponent", float) = .5 - _DepthCeiling("Depth Ceiling", float) = 1000 - _DepthBlend("Depth Blend", float) = 100 - _NoiseAmplitude("Noise Amplitude", float) = 1 - _NoiseScale("Noise Scale", float) = 100 - _NoiseExponent("Noise Exponent", float) = 2 - _NoiseSpeed("Noise Speed", float) = 1 - _FlowScroll("Flow Scroll", float) = 1 - _FlowScale("Flow Scale", float) = 1 - _FlowAmplitude("Flow Amplitude", float) = 1 - _FlowSpeed("Flow Speed", float) = 1 - _SafetyDistance("Safety Distance", float) = 20 - _Scattering("Scattering", float) = 1 - _ScatteringMinDist("ScatteringMinDist", float) = 1 - _ScatteringDistExponent("ScatteringDistExponent", float) = 1 - _ScatteringDensityExponent("ScatteringDensityExponent", float) = 1 - } - - CGINCLUDE; - - uniform sampler2D _MainTex; - uniform sampler2D _CameraDepthTexture; - - #include "UnityCG.cginc" - #include "Assets/Shaders/Volumetric.cginc" - - // the number of volume samples to take - #define SAMPLE_COUNT 96 - - // Shared shader code for pixel view rays, given screen pos and camera frame vectors. - // Camera vectors are passed in as this shader is run from a post proc camera, so the unity built-in values are not useful. - uniform float4x4 _CamProj; - uniform float4x4 _CamInvProj; - uniform float3 _CamPos; - uniform float3 _CamForward; - uniform float3 _CamRight; - uniform float _HalfFov; - uniform int _FrameNumber; - - uniform float _StepExponent; - - uniform half _Gamma, - _Exposure, - _DepthCeiling, - _DepthBlend, - _Scattering, - _ScatteringDensityExponent, - _ScatteringDistExponent, - _ScatteringMinDist; - - // Dithering - sampler2D _DitheringTex; - float4 _DitheringCoords; - - inline float nrand(float2 ScreenUVs) - { - return frac(sin(ScreenUVs.x * 12.9898 + ScreenUVs.y * 78.233) * 43758.5453); - } - - void RaymarchStep( in float3 pos, in float stepSize, in float weight, inout float4 sum, in float scatter, inout float scatterSum) - { - float4 col = VolumeSampleColor( pos ); - col.a *= stepSize * weight; - sum.rgb += col.rgb * col.a * (1.0 - sum.a); - sum.a += col.a; - scatterSum += pow(col.a, _ScatteringDensityExponent) * scatter; - } - - float4 RayMarch( in float3 origin, in float3 direction, in float zbuf, in float2 screenUV, out float scatterSum ) - { - scatterSum = 0; - float blue = tex2D(_DitheringTex, screenUV * _DitheringCoords.xy + _DitheringCoords.zw).r; - //float rand = frac(blue + _FrameNumber * 1.61803398875); - //return float4(rand, rand, rand, 1); - //half rand = frac(nrand(screenUV) + _FrameNumber * 1.61803398875); - //half rand = nrand(screenUV + frac(_Time.x)); - half rand = blue; - float4 sum = (float4)0.; - scatterSum = 0.; - - // setup sampling - - float rayDist = 0; - for( int i = 0; i < SAMPLE_COUNT; i++ ) - { - float prevRayDist = rayDist; - rayDist = pow((i+rand)/SAMPLE_COUNT,_StepExponent) * _DepthCeiling + 1; - float distToSurf = zbuf - rayDist; - if( distToSurf <= 0.001 || sum.a > .99) break; - - float step = rayDist - prevRayDist; - //float wt = (distToSurf >= step) ? 1. : distToSurf / step; - - RaymarchStep( origin + rayDist * direction, step, 1-rayDist/_DepthCeiling, sum, _Scattering/pow(max(rayDist,_ScatteringMinDist),_ScatteringDistExponent), scatterSum); - } - - sum.rgb = pow( sum.rgb, 1 / _Gamma ) * _Exposure; - return sum; - } - - struct v2f - { - float4 pos : SV_POSITION; - float4 screenPos : TEXCOORD1; - }; - - v2f vert( appdata_base v ) - { - v2f o; - o.pos = UnityObjectToClipPos( v.vertex ); - o.screenPos = ComputeScreenPos( o.pos ); - return o; - } - - void computeCamera( in float2 q, out float3 rayOrigin, out float3 rd ) - { - rayOrigin = _WorldSpaceCameraPos; - - float2 p = 2.0*(q - 0.5); - float4 d = mul(_CamProj, float4(p, 0, 1)); - d.xyz /= d.w; - //rd = (d - rayOrigin); - rd = normalize(d - rayOrigin); - rayOrigin = d; - //rayOrigin += _ProjectionParams.y * rd; - } - - inline float LinearEyeDepthToOutDepth(float z) - { - return (1 - _ZBufferParams.w * z) / (_ZBufferParams.z * z); - } - - float3 DepthToWorld(float2 uv, float depth) { - float z = (1-depth) * 2.0 - 1.0; - - float4 clipSpacePosition = float4(uv * 2.0 - 1.0, z, 1.0); - - float4 viewSpacePosition = mul(_CamInvProj,clipSpacePosition); - viewSpacePosition /= viewSpacePosition.w; - - float4 worldSpacePosition = mul(unity_ObjectToWorld,viewSpacePosition); - - return worldSpacePosition.xyz; - } - - // MRT shader - struct FragmentOutput - { - half4 dest0 : COLOR0; - half4 dest1 : COLOR1; - }; - - FragmentOutput frag( v2f i ) : SV_Target //out float outDepth : SV_Depth - { - FragmentOutput o; - - float2 q = i.screenPos.xy / i.screenPos.w; - - // camera - float3 rayOrigin, rayDirection; - computeCamera( q, rayOrigin, rayDirection ); - - // z buffer / scene depth for this pixel - float4 screenPos = UNITY_PROJ_COORD( i.screenPos ); - float2 screenUV = screenPos.xy / screenPos.w; - - float depthSample = tex2Dproj( _CameraDepthTexture, screenPos ).r; - //float depthValue = LinearEyeDepth(depthSample); - - float3 worldDepth = DepthToWorld(screenPos, depthSample); - float depthValue = length(worldDepth-rayOrigin); - - // march through volume - float scatter; - float4 clouds = RayMarch( rayOrigin, rayDirection, depthValue, screenUV, scatter ); - o.dest1 = .5 + scatter*.5;//smoothstep(1,.99,clouds.a)*pow(clouds.a,1)*.5; - - float3 bgcol = tex2Dlod( _MainTex, float4(q, 0., 0.) ); - // add in camera render colours, if not zfar (so we exclude skybox) - if(clouds.a < .99 && depthValue < _DepthCeiling) - { - // Blend out camera render when outside marching range - if( depthValue >= _DepthCeiling - _DepthBlend ) - clouds.a = lerp(clouds.a, 1, (depthValue - (_DepthCeiling - _DepthBlend)) / _DepthBlend); - - //clouds.xyz = lerp(clouds.xyz, bgcol, 1-clouds.a); - clouds.xyz += (1. - clouds.a) * bgcol; - // assume zbuffer represents opaque surface - - } - clouds.a = 1.; - - //outDepth = LinearEyeDepthToOutDepth(min(depthValue, rayDist)); - - o.dest0 = clouds; - return o; - } - - - ENDCG - - Subshader - { - Pass - { - ZTest Always Cull Off ZWrite Off - - CGPROGRAM - #pragma target 3.0 - #pragma vertex vert - #pragma fragment frag - ENDCG - } - } - - Fallback off - -} // shader diff --git a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta deleted file mode 100644 index a0f8d767f..000000000 --- a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7940bc6e15d348ff930f4ebb3c475cf2 -timeCreated: 1623409494 \ No newline at end of file diff --git a/Assets/Shaders/Volumetric.cginc b/Assets/Shaders/Volumetric.cginc index 2ceb66314..dd48ddc86 100644 --- a/Assets/Shaders/Volumetric.cginc +++ b/Assets/Shaders/Volumetric.cginc @@ -24,7 +24,6 @@ uniform half _NebulaFillDensity, _NebulaFloorBlend, _NebulaPatchBlend, _NebulaLuminance, - _TintExponent, _TintLodExponent, _NebulaNoiseScale, _NebulaNoiseExponent, @@ -107,16 +106,6 @@ float cloudDensity(float3 pos, float surfaceDisp) return patchDensity + max(0,floorDensity); } -// TODO: Get this working? -float2 texFlow(float3 pos) -{ - const float2 fluidUv = getUVFluid(pos.xz); - if(any(fluidUv<0)||any(fluidUv>1)) return 0; - const float2 fluidSample = tex2Dlod(_FluidVelocity, half4(fluidUv, 0, 0)).xy; - // TODO: remove magic number for fluid texture dimensions - return float3(fluidSample.x,0,fluidSample.y) * (512 / _FluidTransform.z); -} - float2 gravGradient (float2 uv) { return float2( @@ -236,20 +225,11 @@ float4 VolumeSampleColor(float3 pos) return float4(tint, d); } -float2 tintGradient (float2 uv) -{ - return float2( - length(tex2Dlod(_NebulaTint, float4(uv.x + _NebulaTint_TexelSize.x, uv.y, 0, 0))) - length(tex2Dlod(_NebulaTint, float4(uv.x - _NebulaTint_TexelSize.x, uv.y, 0, 0))), - length(tex2Dlod(_NebulaTint, float4(uv.x, uv.y + _NebulaTint_TexelSize.y, 0, 0))) - length(tex2Dlod(_NebulaTint, float4(uv.x, uv.y - _NebulaTint_TexelSize.y, 0, 0))) - ); -} - float3 VolumeSampleColorSimple(float3 pos, float3 normal) { float2 uv = getUV(pos.xz); float3 low = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, _DynamicLodLow)).rgb; float3 high = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, _DynamicLodHigh)).rgb * _DynamicSkyBoost; float upness = dot(normal, float3(0,1,0)); - //float lambert = 2 - dot(normalize(normal.xz), normalize(tintGradient(uv))); return lerp(low,high,sqrt((upness+1)/2)) * _DynamicIntensity / (density(pos)+1); }