Hybrid Volumetric Fog + some swamp area test

This commit is contained in:
Bartek
2025-10-14 16:02:35 +02:00
parent fc4a139d11
commit 7f718f2f6f
67 changed files with 3297 additions and 151 deletions

View File

@@ -0,0 +1,84 @@
Shader "Custom/VolumetricFog_Full"
{
Properties
{
_Density("Fog Density", Range(0,1)) = 0.1
_LightContribution("Light Contribution", Color) = (1,1,1,1)
_LightScattering("Scattering", Range(-1,1)) = 0.0
}
SubShader
{
Tags { "RenderPipeline"="UniversalPipeline" }
Pass
{
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
Varyings Vert(Attributes IN)
{
Varyings OUT;
OUT.positionCS = TransformObjectToHClip(IN.positionOS.xyz);
OUT.uv = IN.uv;
return OUT;
}
float _Density;
float4 _LightContribution;
float _LightScattering;
// Henyey-Greenstein phase function
float henyey_greenstein(float cosTheta, float g)
{
float g2 = g * g;
return (1.0 - g2) / pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5);
}
half4 Frag(Varyings IN) : SV_Target
{
// Raymarching setup (tu wstawiasz swój kod raymarchingu)
float3 rayPosWS = float3(0,0,0); // przykładowa pozycja w świecie
float3 rayDir = float3(0,0,1); // przykładowy kierunek
float3 fogCol = 0;
// === Main Light ===
Light mainLight = GetMainLight();
float phaseMain = henyey_greenstein(dot(rayDir, mainLight.direction), _LightScattering);
fogCol += mainLight.color.rgb * _LightContribution.rgb * phaseMain;
// === Additional Lights ===
int addCount = GetAdditionalLightsCount();
for (int li = 0; li < addCount; li++)
{
Light addLight = GetAdditionalLight(li, rayPosWS);
float3 dir = normalize(addLight.direction);
float atten = addLight.distanceAttenuation * addLight.shadowAttenuation;
float phase = henyey_greenstein(dot(rayDir, dir), _LightScattering);
fogCol += addLight.color.rgb * _LightContribution.rgb * phase * atten;
}
// Final fog color
return float4(fogCol * _Density, 1);
}
ENDHLSL
}
}
}

View File

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

View File

@@ -0,0 +1,167 @@
Shader "Custom/VolumetricFog_ExtendedFX"
{
Properties
{
_ColorLow("Fog Color Low", Color) = (0.6, 0.6, 0.7, 1)
_ColorHigh("Fog Color High", Color) = (0.8, 0.8, 0.9, 1)
_AmbientFogColor("Ambient Fog Color", Color) = (0.3, 0.3, 0.35, 1)
_MaxDistance("Max Distance", Float) = 100
_StepSize("Step Size", Range(0.1, 20)) = 1
_MaxSteps("Max Steps", Range(8, 256)) = 64
_DensityMultiplier("Density Multiplier", Range(0, 10)) = 1
_DensityThreshold("Density Threshold", Range(0, 1)) = 0.1
_HeightFalloff("Height Falloff", Range(0, 2)) = 0.2
_NoiseOffset("Noise Offset", Float) = 0
_NoiseTiling("Noise Tiling", Float) = 1
_FogNoise("Fog Noise", 3D) = "white" {}
_NoiseScrollSpeed("Noise Scroll Speed (XYZ)", Vector) = (0.02, 0, 0.015, 0)
_NoisePulseSpeed("Noise Pulse Speed", Float) = 0.2
_NoisePulseAmount("Noise Pulse Amount", Float) = 0.1
[HDR]_LightContribution("Light Contribution", Color) = (1, 1, 1, 1)
_LightScattering("Light Scattering (g)", Range(-1, 1)) = 0.2
_DepthFade("Depth Fade Strength", Range(0,1)) = 0.3
// ✅ Soft clip dla near fade
_NearStart("Near Fade Start", Float) = 1.0
_NearEnd("Near Fade End", Float) = 3.0
_DayColor("Day Fog Tint", Color) = (0.7,0.75,0.8,1)
_NightColor("Night Fog Tint", Color) = (0.3,0.35,0.4,1)
_DayFactor("Day/Night Blend", Range(0,1)) = 0.5
_GodRayStrength("God Ray Strength", Range(0,1)) = 0.2
_DitherStrength("Dither Strength", Range(0,1)) = 0.3
_ColorSteps("Color Steps", Range(2,32)) = 8
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" }
Pass
{
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment frag
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile _ _ADDITIONAL_LIGHTS
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
float4 _ColorLow, _ColorHigh, _AmbientFogColor;
float _MaxDistance, _StepSize; int _MaxSteps;
float _DensityMultiplier, _DensityThreshold, _HeightFalloff;
float _NoiseOffset, _NoiseTiling; TEXTURE3D(_FogNoise);
float3 _NoiseScrollSpeed; float _NoisePulseSpeed, _NoisePulseAmount;
float4 _LightContribution; float _LightScattering;
float _DepthFade;
float _NearStart, _NearEnd;
float4 _DayColor, _NightColor; float _DayFactor, _GodRayStrength;
float _DitherStrength; float _ColorSteps;
float henyey_greenstein(float cosTheta, float g)
{
float g2 = g * g;
return (1.0 - g2) / (4.0 * PI * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));
}
float get_density(float3 worldPos)
{
float pulse = 1.0 + sin(_Time.y * _NoisePulseSpeed) * _NoisePulseAmount;
float3 noiseCoords = worldPos * 0.01 * _NoiseTiling * pulse;
noiseCoords += _NoiseScrollSpeed * _Time.y;
float4 noise = _FogNoise.SampleLevel(sampler_TrilinearRepeat, noiseCoords, 0);
float density = noise.r;
density = saturate(density - _DensityThreshold) * _DensityMultiplier;
density *= exp(-max(0, worldPos.y) * _HeightFalloff);
return density;
}
half4 frag(Varyings IN) : SV_Target
{
float4 col = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, IN.texcoord);
float depth = SampleSceneDepth(IN.texcoord);
float3 worldPos = ComputeWorldSpacePosition(IN.texcoord, depth, UNITY_MATRIX_I_VP);
float3 entryPoint = _WorldSpaceCameraPos;
float3 viewDir = worldPos - _WorldSpaceCameraPos;
float viewLength = length(viewDir);
float3 rayDir = normalize(viewDir);
float2 pixelCoords = IN.texcoord * _BlitTexture_TexelSize.zw;
float distLimit = min(viewLength, _MaxDistance);
float distTravelled = InterleavedGradientNoise(pixelCoords, (int)(_Time.y / max(HALF_EPS, unity_DeltaTime.x))) * _NoiseOffset;
float transmittance = 1.0;
float3 fogAccum = 0;
[loop]
for (int i = 0; i < _MaxSteps && distTravelled < distLimit; i++)
{
float3 rayPos = entryPoint + rayDir * distTravelled;
float density = get_density(rayPos);
if (density > 0)
{
Light mainLight = GetMainLight(TransformWorldToShadowCoord(rayPos));
float phase = henyey_greenstein(dot(rayDir, mainLight.direction), _LightScattering);
float3 lightCol = mainLight.color.rgb * _LightContribution.rgb * phase * mainLight.shadowAttenuation;
#if defined(_ADDITIONAL_LIGHTS)
uint lightCount = GetAdditionalLightsCount();
[loop]
for (uint li = 0; li < lightCount; li++)
{
Light addLight = GetAdditionalLight(li, rayPos);
float phaseAdd = henyey_greenstein(dot(rayDir, addLight.direction), _LightScattering);
lightCol += addLight.color.rgb * _LightContribution.rgb * phaseAdd * addLight.distanceAttenuation;
}
#endif
float3 fogColor = lerp(_ColorLow.rgb, _ColorHigh.rgb, saturate(rayPos.y * 0.01));
float3 dayNightTint = lerp(_NightColor.rgb, _DayColor.rgb, _DayFactor);
fogColor = lerp(fogColor, dayNightTint, 0.5);
fogColor = lerp(fogColor, _AmbientFogColor.rgb, 0.25);
fogColor += lightCol * _GodRayStrength;
// ✅ Depth fade
float fade = exp(-distTravelled * _DepthFade);
// ✅ Soft clip near fade
float nearFactor = saturate((distTravelled - _NearStart) / (_NearEnd - _NearStart));
density *= fade * nearFactor;
fogAccum += (fogColor + lightCol) * density * _StepSize;
transmittance *= exp(-density * _StepSize);
if (transmittance < 0.01) break;
}
distTravelled += _StepSize;
}
float3 finalFog = fogAccum * transmittance;
float dither = frac(sin(dot(pixelCoords, float2(12.9898,78.233))) * 43758.5453);
finalFog += (dither - 0.5) * _DitherStrength.xxx;
finalFog = floor(finalFog * _ColorSteps) / _ColorSteps;
return float4(lerp(col.rgb, finalFog, 1.0 - saturate(transmittance)), 1.0);
}
ENDHLSL
}
}
}

View File

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

View File

@@ -27,7 +27,6 @@ Shader "Custom/VolumetricFog_ExtendedFX"
_DepthFade("Depth Fade Strength", Range(0,1)) = 0.3
// ✅ Soft clip dla near fade
_NearStart("Near Fade Start", Float) = 1.0
_NearEnd("Near Fade End", Float) = 3.0
@@ -50,7 +49,6 @@ Shader "Custom/VolumetricFog_ExtendedFX"
#pragma vertex Vert
#pragma fragment frag
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile _ _ADDITIONAL_LIGHTS
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
@@ -69,6 +67,12 @@ Shader "Custom/VolumetricFog_ExtendedFX"
float4 _DayColor, _NightColor; float _DayFactor, _GodRayStrength;
float _DitherStrength; float _ColorSteps;
// ✅ Custom additional lights (z C# feature)
int _CustomAdditionalLightCount;
float4 _CustomAdditionalLightPos[16];
float4 _CustomAdditionalLightColor[16];
float _CustomAdditionalLightRange[16];
float henyey_greenstein(float cosTheta, float g)
{
float g2 = g * g;
@@ -114,21 +118,25 @@ Shader "Custom/VolumetricFog_ExtendedFX"
if (density > 0)
{
// Main Light
Light mainLight = GetMainLight(TransformWorldToShadowCoord(rayPos));
float phase = henyey_greenstein(dot(rayDir, mainLight.direction), _LightScattering);
float3 lightCol = mainLight.color.rgb * _LightContribution.rgb * phase * mainLight.shadowAttenuation;
#if defined(_ADDITIONAL_LIGHTS)
uint lightCount = GetAdditionalLightsCount();
[loop]
for (uint li = 0; li < lightCount; li++)
// ✅ Custom Additional Lights
for (int li = 0; li < _CustomAdditionalLightCount; li++)
{
Light addLight = GetAdditionalLight(li, rayPos);
float phaseAdd = henyey_greenstein(dot(rayDir, addLight.direction), _LightScattering);
lightCol += addLight.color.rgb * _LightContribution.rgb * phaseAdd * addLight.distanceAttenuation;
}
#endif
float3 toLight = _CustomAdditionalLightPos[li].xyz - rayPos;
float dist = length(toLight);
float3 dir = normalize(toLight);
float atten = saturate(1.0 - dist / _CustomAdditionalLightRange[li]);
float phaseAdd = henyey_greenstein(dot(rayDir, dir), _LightScattering);
lightCol += _CustomAdditionalLightColor[li].rgb * _LightContribution.rgb * phaseAdd * atten;
}
// Fog color blending
float3 fogColor = lerp(_ColorLow.rgb, _ColorHigh.rgb, saturate(rayPos.y * 0.01));
float3 dayNightTint = lerp(_NightColor.rgb, _DayColor.rgb, _DayFactor);
fogColor = lerp(fogColor, dayNightTint, 0.5);
@@ -136,10 +144,7 @@ Shader "Custom/VolumetricFog_ExtendedFX"
fogColor += lightCol * _GodRayStrength;
// ✅ Depth fade
float fade = exp(-distTravelled * _DepthFade);
// ✅ Soft clip near fade
float nearFactor = saturate((distTravelled - _NearStart) / (_NearEnd - _NearStart));
density *= fade * nearFactor;
@@ -160,6 +165,8 @@ Shader "Custom/VolumetricFog_ExtendedFX"
finalFog = floor(finalFog * _ColorSteps) / _ColorSteps;
return float4(lerp(col.rgb, finalFog, 1.0 - saturate(transmittance)), 1.0);
return float4(_CustomAdditionalLightColor[0].rgb, 1.0);
}
ENDHLSL
}

View File

@@ -0,0 +1,198 @@
Shader "Custom/VolumetricFog_Hybrid"
{
Properties
{
_ColorLow("Fog Color Low", Color) = (0.6, 0.6, 0.7, 1)
_ColorHigh("Fog Color High", Color) = (0.8, 0.8, 0.9, 1)
_AmbientFogColor("Ambient Fog Color", Color) = (0.3, 0.3, 0.35, 1)
_MaxDistance("Max Distance", Float) = 100
_StepSize("Step Size", Range(0.1, 20)) = 1
_MaxSteps("Max Steps", Range(8, 256)) = 64
_DensityMultiplier("Density Multiplier", Range(0, 10)) = 1
_DensityThreshold("Density Threshold", Range(0, 1)) = 0.1
_HeightFalloff("Height Falloff", Range(0, 2)) = 0.2
_NoiseOffset("Noise Offset", Float) = 0
_NoiseTiling("Noise Tiling", Float) = 1
_FogNoise("Fog Noise", 3D) = "white" {}
_NoiseScrollSpeed("Noise Scroll Speed (XYZ)", Vector) = (0.02, 0, 0.015, 0)
_NoisePulseSpeed("Noise Pulse Speed", Float) = 0.2
_NoisePulseAmount("Noise Pulse Amount", Float) = 0.1
[HDR]_LightContribution("Light Contribution", Color) = (1, 1, 1, 1)
_LightScattering("Light Scattering (g)", Range(-1, 1)) = 0.2
_DepthFade("Depth Fade Strength", Range(0,1)) = 0.3
_NearStart("Near Fade Start", Float) = 1.0
_NearEnd("Near Fade End", Float) = 3.0
_DayColor("Day Fog Tint", Color) = (0.7,0.75,0.8,1)
_NightColor("Night Fog Tint", Color) = (0.3,0.35,0.4,1)
_DayFactor("Day/Night Blend", Range(0,1)) = 0.5
_GodRayStrength("God Ray Strength", Range(0,1)) = 0.2
_DitherStrength("Dither Strength", Range(0,1)) = 0.3
_ColorSteps("Color Steps", Range(2,32)) = 8
// Sterowanie zależnością od wysokości
_HeightModeBlend("Height Mode Blend (0=World,1=Camera)", Range(0,1)) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" }
Pass
{
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment frag
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
float4 _ColorLow, _ColorHigh, _AmbientFogColor;
float _MaxDistance, _StepSize; int _MaxSteps;
float _DensityMultiplier, _DensityThreshold, _HeightFalloff;
float _NoiseOffset, _NoiseTiling; TEXTURE3D(_FogNoise);
float3 _NoiseScrollSpeed; float _NoisePulseSpeed, _NoisePulseAmount;
float4 _LightContribution; float _LightScattering;
float _DepthFade;
float _NearStart, _NearEnd;
float4 _DayColor, _NightColor; float _DayFactor, _GodRayStrength;
float _DitherStrength; float _ColorSteps;
int _CustomAdditionalLightCount;
float4 _CustomAdditionalLightPos[16];
float4 _CustomAdditionalLightColor[16];
float _CustomAdditionalLightRange[16];
float _HeightModeBlend;
// ——— Helpers ———
float henyey_greenstein(float cosTheta, float g)
{
float g2 = g * g;
return (1.0 - g2) / (4.0 * PI * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));
}
// Hybrydowa gęstość mgły: miks world height i camera height + relY
float get_density(float3 worldPos)
{
// 3D noise coords pozostawiamy w world space (topologia nadal „rzeźbi” mgłę),
// ale wysokościowy spadek gęstości kontrolujemy hybrydą.
float pulse = 1.0 + sin(_Time.y * _NoisePulseSpeed) * _NoisePulseAmount;
float3 noiseCoords = worldPos * 0.01 * _NoiseTiling * pulse;
noiseCoords += _NoiseScrollSpeed * _Time.y;
float4 noise = _FogNoise.SampleLevel(sampler_TrilinearRepeat, noiseCoords, 0);
float density = noise.r;
density = saturate(density - _DensityThreshold) * _DensityMultiplier;
// World vs Camera height falloff
float camY = _WorldSpaceCameraPos.y;
float relY = worldPos.y - camY; // wysokość względem kamery
float worldFactor = exp(-max(0, worldPos.y) * _HeightFalloff);
float camFactor = exp(-max(0, camY) * _HeightFalloff); // stały względem raya
float relFactor = exp(-abs(relY) * _HeightFalloff); // „chmura” wokół kamery
// Hybryda: najpierw łączymy world i relY (wygląda kamerowo), potem mieszamy z camY stałym
float camLike = lerp(worldFactor, relFactor, _HeightModeBlend);
float hybrid = lerp(worldFactor, camLike, _HeightModeBlend); // przy 1.0 = relY (kamerowo), przy 0.0 = world
density *= hybrid;
return density;
}
half4 frag(Varyings IN) : SV_Target
{
float4 col = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, IN.texcoord);
float depth = SampleSceneDepth(IN.texcoord);
float3 worldPos = ComputeWorldSpacePosition(IN.texcoord, depth, UNITY_MATRIX_I_VP);
float3 entryPoint = _WorldSpaceCameraPos;
float3 viewDir = worldPos - _WorldSpaceCameraPos;
float viewLength = length(viewDir);
float3 rayDir = normalize(viewDir);
float2 pixelCoords = IN.texcoord * _BlitTexture_TexelSize.zw;
float distLimit = min(viewLength, _MaxDistance);
float distTravelled = InterleavedGradientNoise(pixelCoords, (int)(_Time.y / max(HALF_EPS, unity_DeltaTime.x))) * _NoiseOffset;
float transmittance = 1.0;
float3 fogAccum = 0;
[loop]
for (int i = 0; i < _MaxSteps && distTravelled < distLimit; i++)
{
float3 rayPos = entryPoint + rayDir * distTravelled;
float density = get_density(rayPos);
if (density > 0)
{
// Lighting
Light mainLight = GetMainLight(TransformWorldToShadowCoord(rayPos));
float phase = henyey_greenstein(dot(rayDir, mainLight.direction), _LightScattering);
float3 lightCol = mainLight.color.rgb * _LightContribution.rgb * phase * mainLight.shadowAttenuation;
for (int li = 0; li < _CustomAdditionalLightCount; li++)
{
float3 toLight = _CustomAdditionalLightPos[li].xyz - rayPos;
float dist = length(toLight);
float3 dir = normalize(toLight);
float atten = saturate(1.0 - dist / _CustomAdditionalLightRange[li]);
float phaseAdd = henyey_greenstein(dot(rayDir, dir), _LightScattering);
lightCol += _CustomAdditionalLightColor[li].rgb * _LightContribution.rgb * phaseAdd * atten;
}
// Fog color: przestajemy wiązać gradient z worldPos.y — używamy wysokości względnej do kamery
float camY = _WorldSpaceCameraPos.y;
float relY = rayPos.y - camY;
float worldColorF = saturate(rayPos.y * 0.01);
float camColorF = saturate(relY * 0.01); // ten daje „stały” wygląd niezależnie od poziomu mapy
float colorF = lerp(worldColorF, camColorF, _HeightModeBlend);
float3 fogColor = lerp(_ColorLow.rgb, _ColorHigh.rgb, colorF);
float3 dayNightTint = lerp(_NightColor.rgb, _DayColor.rgb, _DayFactor);
fogColor = lerp(fogColor, dayNightTint, 0.5);
fogColor = lerp(fogColor, _AmbientFogColor.rgb, 0.25);
fogColor += lightCol * _GodRayStrength;
// Fading
float fade = exp(-distTravelled * _DepthFade);
float nearFactor = saturate((distTravelled - _NearStart) / (_NearEnd - _NearStart));
density *= fade * nearFactor;
fogAccum += (fogColor + lightCol) * density * _StepSize;
transmittance *= exp(-density * _StepSize);
if (transmittance < 0.01) break;
}
distTravelled += _StepSize;
}
float3 finalFog = fogAccum * transmittance;
// Dither + quantize
float dither = frac(sin(dot(pixelCoords, float2(12.9898,78.233))) * 43758.5453);
finalFog += (dither - 0.5) * _DitherStrength.xxx;
finalFog = floor(finalFog * _ColorSteps) / _ColorSteps;
return float4(lerp(col.rgb, finalFog, 1.0 - saturate(transmittance)), 1.0);
}
ENDHLSL
}
}
}

View File

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

View File

@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Volumetric Light
m_Shader: {fileID: 4800000, guid: 6934182509f924641a5a75ad544128c9, type: 3}
m_Shader: {fileID: 4800000, guid: 3cab4a81dc81edb48beccc00c14366f4, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
@@ -49,6 +49,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FogMask:
m_Texture: {fileID: 2800000, guid: 122f172c549967c4cbc3ca3e80298b5f, type: 3}
m_Scale: {x: 0, y: 0}
@@ -65,6 +69,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -91,43 +99,57 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AbsorptionStrength: 0.6
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _AmbientScattering: 0.1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BubbleDensity: 8
- _BubbleFade: 2
- _BubbleFlow: 0.5
- _BubbleStrength: 1.5
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorSteps: 6
- _ColorSteps: 8
- _Cull: 2
- _Cutoff: 0.5
- _DayFactor: 0.091
- _DebugLights: 0
- _Density: 0.1
- _DensityMultiplier: 2.2
- _DensityThreshold: 0.18
- _DepthFade: 0.01
- _DepthStrength: 0.6
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DitherStrength: 0.04
- _DitherStrength: 0.036
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FoamBias: 0
- _FoamStrength: 0.6
- _FresnelStrength: 0.2
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _GodRayStrength: 0.25
- _HG_G: 0.2
- _HeightFalloff: 0.4
- _HeightFalloff: 1.21
- _HeightModeBlend: 0.528
- _Intensity: 1
- _LavaCrackGlow: 0.8
- _LavaEdgeGlow: 0.5
- _LightScattering: 0.35
- _LightScatteringG: 0.2
- _MaskTiling: 0.03
- _MaxDistance: 60
- _MaxDistance: 5.84
- _MaxSteps: 64
- _Metallic: 0
- _Mode: 0
- _NearEnd: 3
- _NearEnd: 4
- _NearFade: 0
- _NearStart: 0.05
- _NoiseJitter: 0.02
@@ -135,11 +157,15 @@ Material:
- _NoisePulseAmount: 0.07
- _NoisePulseSpeed: 0.15
- _NoiseTiling: 0.8
- _NormalStrength: 0.6
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _RefractionStrength: 0.015
- _ShadowStrength: 1
- _ShorelineSharpness: 6
- _ShorelineStrength: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
@@ -148,7 +174,16 @@ Material:
- _StepScale: 4
- _StepSize: 1
- _Surface: 0
- _SurfaceDetail: 0.4
- _SurfaceType: 0
- _UVSec: 0
- _VertexDistortSpeed: 1.5
- _VertexDistortStrength: 0
- _VoronoiScale: 5
- _VoronoiThreshold: 0.3
- _WaveAmplitude: 0.12
- _WaveLength: 12
- _WaveSpeed: 1
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
@@ -159,8 +194,10 @@ Material:
- _ColorLow: {r: 0.45, g: 0.48, b: 0.5, a: 1}
- _DayColor: {r: 0.6, g: 0.65, b: 0.7, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 1, b: 1, a: 1}
- _FoamScrollSpeed: {r: 0.02, g: 0.01, b: 0, a: 0}
- _FogBaseColor: {r: 0.78, g: 0.82, b: 0.9, a: 1}
- _LightContribution: {r: 18.618134, g: 14.44776, b: 12.382816, a: 1}
- _LightContribution: {r: 28.982248, g: 28.982248, b: 28.982248, a: 1}
- _MainLightColor: {r: 1, g: 1, b: 1, a: 1}
- _MainLightDir: {r: 0, g: -1, b: 0, a: 0}
- _MaskOffset: {r: -0.23, g: -0.32, b: 0, a: 0}
@@ -169,6 +206,10 @@ Material:
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _UserMainLightColor: {r: 1, g: 1, b: 1, a: 1}
- _UserMainLightDir: {r: 0, g: -1, b: 0, a: 0}
- _WaterNormal1Speed: {r: 0.05, g: 0, b: 0, a: 0}
- _WaterNormal2Speed: {r: 0, g: -0.03, b: 0, a: 0}
- _WaterTint: {r: 0.09999997, g: 0.54999995, b: 0.7, a: 1}
- _WaveDirection: {r: 1, g: 0.2, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &6285378627783397592

View File

@@ -2,7 +2,7 @@ fileFormatVersion: 2
guid: 6dad1b85c9bf7884e8a1671ebcd5d1ab
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class VolumetricFogLightsFeature : ScriptableRendererFeature
{
class LightsPass : ScriptableRenderPass
{
static readonly int _CountID = Shader.PropertyToID("_FogLightCount");
static readonly int _PosID = Shader.PropertyToID("_FogLightPos");
static readonly int _ColorID = Shader.PropertyToID("_FogLightColor");
static readonly int _RangeID = Shader.PropertyToID("_FogLightRange");
const int MAX = 16;
Vector4[] pos = new Vector4[MAX];
Vector4[] color = new Vector4[MAX];
float[] range = new float[MAX];
public override void Execute(ScriptableRenderContext ctx, ref RenderingData data)
{
int count = 0;
foreach (var vl in data.lightData.visibleLights)
{
if (count >= MAX) break;
if (vl.lightType == LightType.Point || vl.lightType == LightType.Spot)
{
pos[count] = vl.light.transform.position;
color[count] = vl.finalColor;
range[count] = vl.range;
count++;
}
}
var cmd = CommandBufferPool.Get("FogLights");
cmd.SetGlobalInt(_CountID, count);
cmd.SetGlobalVectorArray(_PosID, pos);
cmd.SetGlobalVectorArray(_ColorID, color);
cmd.SetGlobalFloatArray(_RangeID, range);
ctx.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
Debug.Log($"[FogLights] Passed {count} lights to shader");
}
}
LightsPass pass;
public override void Create()
{
pass = new LightsPass { renderPassEvent = RenderPassEvent.BeforeRendering };
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData data)
{
renderer.EnqueuePass(pass);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c9a1a02d6aceacf4183afbdb4fcb58e5

View File

@@ -0,0 +1,409 @@
Shader "Custom/UniversalLiquidSurface2.0"
{
Properties
{
// Common
_MainTex ("Main Texture", 2D) = "white" {}
_BaseColor("Base Color", Color) = (1,1,1,1)
[Enum(Water,0,Lava,1,Ice,2,River,3)] _SurfaceType ("Surface Type", Float) = 0
_MainTexAlpha ("MainTex Alpha Strength", Range(0,1)) = 1.0
// Water
_WaterTint ("Water Tint", Color) = (0.1, 0.55, 0.7, 1.0)
_DepthStrength ("Depth Strength", Range(0,1)) = 0.6
_Smoothness ("Smoothness", Range(0,1)) = 0.8
_MainTexBlend ("MainTex Blend Strength", Range(0,1)) = 0.3
_WaveAmplitude ("Wave Amplitude", Float) = 0.12
_WaveLength ("Wave Length", Float) = 12.0
_WaveSpeed ("Wave Speed", Float) = 1.0
_WaveDirection ("Wave Direction X,Y", Vector) = (1, 0.2, 0, 0)
[Normal]_NormalMap ("Normal Map", 2D) = "bump" {}
_NormalStrength ("Normal Strength", Range(0,1)) = 0.6
_SurfaceDetail ("Surface Detail", Range(0,1)) = 0.4
_RefractionStrength ("Refraction Strength", Range(0,0.05)) = 0.015
_FresnelStrength ("Fresnel Strength", Range(0,1)) = 0.2
_FoamTex ("Foam Texture", 2D) = "white" {}
_FoamStrength ("Foam Strength", Range(0,2)) = 0.6
_FoamBias ("Foam Bias", Range(-1,1)) = 0.0
_FoamColor ("Foam Color", Color) = (1,1,1,1)
_NormalScrollStrength ("Normal Scroll Strength", Range(0,1)) = 1.0
_FoamScrollStrength ("Foam Scroll Strength", Range(0,1)) = 1.0
// UV scroll speeds
_WaterNormal1Speed ("Normal Map 1 Speed (X,Y)", Vector) = (0.05, 0.0, 0, 0)
_WaterNormal2Speed ("Normal Map 2 Speed (X,Y)", Vector) = (0.0, -0.03, 0, 0)
_FoamScrollSpeed ("Foam Scroll Speed (X,Y)", Vector) = (0.02, 0.01, 0, 0)
// Shoreline & absorption
_ShorelineStrength ("Shoreline Foam Strength", Range(0,2)) = 1.0
_ShorelineSharpness ("Shoreline Sharpness", Range(0.5, 12)) = 6.0
_AbsorptionStrength ("Depth Absorption Strength", Range(0,1)) = 0.6
// Lava
_EmissionColor ("Emission Color", Color) = (1,0.4,0,1)
_VoronoiScale ("Voronoi Scale", Float) = 5.0
_VoronoiThreshold ("Voronoi Threshold", Range(0,1)) = 0.3
_LavaCrackGlow ("Lava Crack Glow Strength", Float) = 0.8
_LavaEdgeGlow ("Lava Edge Glow Strength", Float) = 0.5
// Procedural bubbles - coś nie bangla
_BubbleDensity ("Bubble Density", Float) = 8.0
_BubbleFlow ("Bubble Flow Speed", Float) = 0.5
_BubbleStrength ("Bubble Strength", Float) = 1.5
_BubbleFade ("Bubble Fade Sharpness", Float) = 2.0
// Vertex distortion
_VertexDistortStrength ("Vertex Distortion Strength", Float) = 0.0
_VertexDistortSpeed ("Vertex Distortion Speed", Float) = 1.5
}
SubShader
{
Tags { "RenderPipeline"="UniversalRenderPipeline" "RenderType"="Transparent" "Queue"="Transparent" }
LOD 250
Pass
{
Name "UniversalForward"
Tags { "LightMode"="UniversalForward" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#ifndef UNITY_PI
#define UNITY_PI 3.14159265359
#endif
struct Attributes {
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float3 normalOS : NORMAL;
};
struct Varyings {
float4 positionHCS : SV_POSITION;
float2 uv : TEXCOORD0;
float3 worldPos : TEXCOORD1;
float3 normalWS : TEXCOORD2;
float3 viewDirWS : TEXCOORD3;
float4 screenPos : TEXCOORD4;
};
// Textures
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
TEXTURE2D(_NormalMap); SAMPLER(sampler_NormalMap);
TEXTURE2D(_FoamTex); SAMPLER(sampler_FoamTex);
TEXTURE2D(_CameraDepthTexture); SAMPLER(sampler_CameraDepthTexture);
TEXTURE2D(_CameraColorTexture); SAMPLER(sampler_CameraColorTexture);
// ST
float4 _MainTex_ST;
float4 _NormalMap_ST;
float4 _FoamTex_ST;
// Parameters
float4 _BaseColor;
float _SurfaceType;
float4 _FoamColor;
float _MainTexAlpha;
float4 _WaterTint;
float _DepthStrength;
float _Smoothness;
float _WaveAmplitude;
float _WaveLength;
float _WaveSpeed;
float4 _WaveDirection;
float _NormalStrength;
float _SurfaceDetail;
float _RefractionStrength;
float _FresnelStrength;
float _FoamStrength;
float _FoamBias;
float4 _WaterNormal1Speed;
float4 _WaterNormal2Speed;
float4 _FoamScrollSpeed;
float _MainTexBlend;
float _NormalScrollStrength;
float _FoamScrollStrength;
float _ShorelineStrength;
float _ShorelineSharpness;
float _AbsorptionStrength;
float4 _EmissionColor;
float _VoronoiScale;
float _VoronoiThreshold;
float _LavaCrackGlow;
float _LavaEdgeGlow;
float _BubbleDensity;
float _BubbleFlow;
float _BubbleStrength;
float _BubbleFade;
float _VertexDistortStrength;
float _VertexDistortSpeed;
float2 ApplyST(float2 uv, float4 st) { return uv * st.xy + st.zw; }
// Voronoi edge noise
float voronoiEdge(float2 uv)
{
float2 g = floor(uv), f = frac(uv);
float d1=1.0, d2=1.0;
[unroll] for(int y=-1;y<=1;y++)
[unroll] for(int x=-1;x<=1;x++)
{
float2 o=float2(x,y);
float2 h=frac(sin(dot(g+o,float2(127.1,311.7))) * 43758.5453);
float2 r=o+h-f; float d=dot(r,r);
if(d<d1){d2=d1; d1=d;} else if(d<d2){d2=d;}
}
return d2-d1;
}
// Gerstner, śmieszna nazwa
void GerstnerSimple(float2 dir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nContrib)
{
float2 D = normalize(dir);
float k = (2.0 * UNITY_PI) / max(len, 0.0001);
float w = sqrt(9.81 * k);
float ph = k * dot(D, xz) + (spd > 0 ? spd : w) * t;
float steep = 0.5;
float Q = steep * amp * k;
float c = cos(ph);
float s = sin(ph);
disp.x = D.x * (Q * amp * c);
disp.z = D.y * (Q * amp * c);
disp.y = amp * s;
float3 n;
n.x = -D.x * Q * s;
n.z = -D.y * Q * s;
n.y = 1.0 - Q * c;
nContrib = n;
}
void GenerateWaves(float2 baseDir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nSum)
{
float angle = 0.35;
float2 d0 = baseDir;
float2 d1 = float2(baseDir.x * cos(angle) - baseDir.y * sin(angle),
baseDir.x * sin(angle) + baseDir.y * cos(angle));
float2 d2 = -baseDir.yx;
float3 dd0, nn0; GerstnerSimple(d0, amp, len, spd, xz, t, dd0, nn0);
float3 dd1, nn1; GerstnerSimple(d1, amp * 0.6, len * 0.7, spd * 1.2, xz, t, dd1, nn1);
float3 dd2, nn2; GerstnerSimple(d2, amp * 0.4, len * 0.5, spd * 0.8, xz, t, dd2, nn2);
disp = dd0 + dd1 + dd2;
nSum = normalize(nn0 + nn1 + nn2);
}
Varyings vert(Attributes IN)
{
// Global vertex distortion
if(_VertexDistortStrength > 1e-4)
{
float w1 = sin(IN.positionOS.x*2 + _Time.y*_VertexDistortSpeed) *
cos(IN.positionOS.z*2 + _Time.y*_VertexDistortSpeed*1.3);
float w2 = sin(IN.positionOS.x*3.5 + _Time.y*(_VertexDistortSpeed*1.7)) *
sin(IN.positionOS.z*2.8 + _Time.y*(_VertexDistortSpeed*2.1));
float boil = sin(_Time.y*(_VertexDistortSpeed*0.8))*0.2;
IN.positionOS.y += (w1*0.6 + w2*0.4 + boil) * _VertexDistortStrength;
}
float3 wpos = TransformObjectToWorld(IN.positionOS.xyz);
float3 nWS = TransformObjectToWorldNormal(IN.normalOS);
if (_SurfaceType == 0)
{
float2 baseDir = normalize(_WaveDirection.xy);
float3 d, nC;
GenerateWaves(baseDir, _WaveAmplitude, _WaveLength, _WaveSpeed, wpos.xz, _Time.y, d, nC);
wpos += d;
nWS = normalize(nC);
}
Varyings OUT;
OUT.worldPos = wpos;
OUT.positionHCS = TransformWorldToHClip(wpos);
OUT.uv = IN.uv;
OUT.normalWS = nWS;
OUT.viewDirWS = GetWorldSpaceViewDir(wpos);
OUT.screenPos = ComputeScreenPos(OUT.positionHCS);
return OUT;
}
half4 frag(Varyings IN):SV_Target
{
half3 finalColor=0, emission=0;
float3 N = normalize(IN.normalWS);
float3 V = normalize(IN.viewDirWS);
float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
if (_SurfaceType == 0) // WATER
{
// głębia sceny
float rawD = SAMPLE_TEXTURE2D(_CameraDepthTexture, sampler_CameraDepthTexture, screenUV).r;
float sceneD = LinearEyeDepth(rawD, _ZBufferParams);
float fragD = IN.positionHCS.w;
float diff = max(sceneD - fragD, 0.0);
// nieliniowa absorpcja
float absorb = saturate(pow(diff * _AbsorptionStrength, 1.5));
// kolory głębi
float3 tint = _WaterTint.rgb;
float3 deep = tint * float3(0.25, 0.35, 0.3);
float3 waterCol = lerp(tint, deep, absorb);
// normal maps z dodatkowym szumem
float2 noiseUV = IN.uv * 10.0 + _Time.y * 0.1;
float noise = frac(sin(dot(noiseUV, float2(12.9898,78.233))) * 43758.5453);
float2 uvA = ApplyST(IN.uv, _NormalMap_ST)
+ _WaterNormal1Speed.xy * _Time.y * _NormalScrollStrength
+ noise * 0.02 * _NormalScrollStrength;
float2 uvB = ApplyST(IN.uv, _NormalMap_ST)
+ _WaterNormal2Speed.xy * _Time.y * _NormalScrollStrength
- noise * 0.02 * _NormalScrollStrength;
float3 nA = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, uvA));
float3 nB = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, uvB));
float3 wn = normalize(lerp(nA, nB, _SurfaceDetail));
wn = normalize(float3(wn.xy * _NormalStrength, wn.z));
// refraction i reflection
float2 refUV = screenUV + wn.xy * _RefractionStrength;
half3 refraction = SAMPLE_TEXTURE2D(_CameraColorTexture, sampler_CameraColorTexture, refUV).rgb;
half3 reflection = SAMPLE_TEXTURE2D(_CameraColorTexture, sampler_CameraColorTexture, screenUV).rgb;
// blend zależny od smoothness
float3 surfaceCol = lerp(refraction, reflection, _Smoothness);
// fresnel modulowany smoothness
float fresnel = pow(1.0 - saturate(dot(V, wn)), 3.0) * _FresnelStrength * _Smoothness;
// foam wieloskalowy
float2 foamUV = ApplyST(IN.uv, _FoamTex_ST)
+ _FoamScrollSpeed.xy * _Time.y * _FoamScrollStrength;
float foam1 = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 2.0).r;
float foam2 = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 5.0).r;
float foamTexV = saturate(foam1 * 0.6 + foam2 * 0.4);
float slopeFoam = saturate((1.0 - N.y) + _FoamBias);
float foamSurf = saturate(slopeFoam * foamTexV) * _FoamStrength;
float shoreMask = saturate(1.0 - diff * _ShorelineSharpness);
float shoreFoam = shoreMask * foamTexV * _ShorelineStrength;
// piana zależna od głębokości
float depthFoam = saturate(1.0 - diff * 0.5);
// alpha z tekstury
float4 baseTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv,_MainTex_ST)) * _BaseColor;
float texAlpha = baseTex.a * _MainTexAlpha;
// finalny kolor
finalColor = lerp(waterCol, surfaceCol, 0.2); // mniej odbić, bardziej mętna
finalColor = lerp(finalColor, baseTex.rgb, _MainTexBlend);
emission += (foamSurf + shoreFoam) * _FoamColor.rgb * depthFoam;
emission += fresnel;
float outAlpha = saturate(lerp(0.85, 0.45, absorb) + (foamSurf + shoreFoam) * 0.1);
outAlpha *= texAlpha;
return half4(finalColor + emission, outAlpha);
}
else if (_SurfaceType == 1) // LAVA
{
float2 uvAnim = IN.uv * _VoronoiScale;
float edge = voronoiEdge(uvAnim);
float cracks = smoothstep(_VoronoiThreshold, _VoronoiThreshold + 0.02, edge);
half3 rockTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv, _MainTex_ST)).rgb;
half3 rockColor = pow(rockTex * _BaseColor.rgb, 1.3);
half3 lavaHot = float3(1.0, 0.35, 0.05);
half3 lavaCore = float3(1.0, 0.6, 0.2);
float boilPulse = 0.5 + 0.5 * sin(_Time.y * 4.0 + uvAnim.x * 3.0 + uvAnim.y * 5.0);
half3 lavaColor = lerp(lavaHot, lavaCore, boilPulse);
finalColor = lerp(lavaColor, rockColor, cracks);
emission = lavaColor * (1.0 - cracks) * _EmissionColor.rgb * _LavaCrackGlow;
float2 uvBubbles = IN.uv * _BubbleDensity + float2(0, _Time.y * _BubbleFlow);
float bubbleMask = smoothstep(0.2, 0.2 + 0.05 * _BubbleFade, voronoiEdge(uvBubbles));
emission += bubbleMask * _BubbleStrength * (1.0 - cracks) * _EmissionColor.rgb;
float fres = pow(1.0 - saturate(dot(N, V)), 3.0);
emission += lavaColor * fres * _LavaEdgeGlow * _EmissionColor.rgb;
return half4(finalColor + emission, 1.0);
}
else if (_SurfaceType == 2) // ICE
{
half3 iceTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv, _MainTex_ST)).rgb;
finalColor = iceTex * _BaseColor.rgb;
float fres = pow(1.0 - saturate(dot(N, V)), 4.0);
emission = fres * float3(0.6, 0.85, 1.0) * 0.6;
return half4(finalColor + emission, 1.0);
}
else if (_SurfaceType == 3) // RIVER
{
float2 uvFlow = ApplyST(IN.uv, _MainTex_ST);
uvFlow.y += _Time.y * 0.2;
half3 riverTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uvFlow).rgb * _BaseColor.rgb;
float2 foamUV = ApplyST(IN.uv, _FoamTex_ST) + _FoamScrollSpeed.xy * _Time.y;
float foam = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 2.0).r;
emission = foam * _FoamStrength * riverTex;
finalColor = riverTex;
return half4(finalColor + emission, 1.0);
}
return half4(finalColor + emission, 1.0);
}
ENDHLSL
}
}
CustomEditor "LiquidSurfaceShaderGUI_Simplified"
}

View File

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

View File

@@ -0,0 +1,412 @@
Shader "Custom/UniversalLiquidSurface2.0"
{
Properties
{
// Common
_MainTex ("Main Texture", 2D) = "white" {}
_BaseColor("Base Color", Color) = (1,1,1,1)
[Enum(Water,0,Lava,1,Ice,2,River,3)] _SurfaceType ("Surface Type", Float) = 0
_MainTexAlpha ("MainTex Alpha Strength", Range(0,1)) = 1.0
// Water
_WaterTint ("Water Tint", Color) = (0.1, 0.55, 0.7, 1.0)
_DepthStrength ("Depth Strength", Range(0,1)) = 0.6
_Smoothness ("Smoothness", Range(0,1)) = 0.8
_MainTexBlend ("MainTex Blend Strength", Range(0,1)) = 0.3
_WaveAmplitude ("Wave Amplitude", Float) = 0.12
_WaveLength ("Wave Length", Float) = 12.0
_WaveSpeed ("Wave Speed", Float) = 1.0
_WaveDirection ("Wave Direction X,Y", Vector) = (1, 0.2, 0, 0)
[Normal]_NormalMap ("Normal Map", 2D) = "bump" {}
_NormalStrength ("Normal Strength", Range(0,1)) = 0.6
_SurfaceDetail ("Surface Detail", Range(0,1)) = 0.4
_RefractionStrength ("Refraction Strength", Range(0,0.05)) = 0.015
_FresnelStrength ("Fresnel Strength", Range(0,1)) = 0.2
_FoamTex ("Foam Texture", 2D) = "white" {}
_FoamStrength ("Foam Strength", Range(0,2)) = 0.6
_FoamBias ("Foam Bias", Range(-1,1)) = 0.0
_FoamColor ("Foam Color", Color) = (1,1,1,1)
_NormalScrollStrength ("Normal Scroll Strength", Range(0,1)) = 1.0
_FoamScrollStrength ("Foam Scroll Strength", Range(0,1)) = 1.0
// UV scroll speeds
_WaterNormal1Speed ("Normal Map 1 Speed (X,Y)", Vector) = (0.05, 0.0, 0, 0)
_WaterNormal2Speed ("Normal Map 2 Speed (X,Y)", Vector) = (0.0, -0.03, 0, 0)
_FoamScrollSpeed ("Foam Scroll Speed (X,Y)", Vector) = (0.02, 0.01, 0, 0)
// Shoreline & absorption
_ShorelineStrength ("Shoreline Foam Strength", Range(0,2)) = 1.0
_ShorelineSharpness ("Shoreline Sharpness", Range(0.5, 12)) = 6.0
_AbsorptionStrength ("Depth Absorption Strength", Range(0,1)) = 0.6
// Lava
_EmissionColor ("Emission Color", Color) = (1,0.4,0,1)
_VoronoiScale ("Voronoi Scale", Float) = 5.0
_VoronoiThreshold ("Voronoi Threshold", Range(0,1)) = 0.3
_LavaCrackGlow ("Lava Crack Glow Strength", Float) = 0.8
_LavaEdgeGlow ("Lava Edge Glow Strength", Float) = 0.5
// Procedural bubbles - coś nie bangla
_BubbleDensity ("Bubble Density", Float) = 8.0
_BubbleFlow ("Bubble Flow Speed", Float) = 0.5
_BubbleStrength ("Bubble Strength", Float) = 1.5
_BubbleFade ("Bubble Fade Sharpness", Float) = 2.0
// Vertex distortion
_VertexDistortStrength ("Vertex Distortion Strength", Float) = 0.0
_VertexDistortSpeed ("Vertex Distortion Speed", Float) = 1.5
}
SubShader
{
Tags { "RenderPipeline"="UniversalRenderPipeline" "RenderType"="Transparent" "Queue"="Transparent" }
LOD 250
Pass
{
Name "UniversalForward"
Tags { "LightMode"="UniversalForward" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#ifndef UNITY_PI
#define UNITY_PI 3.14159265359
#endif
struct Attributes {
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float3 normalOS : NORMAL;
};
struct Varyings {
float4 positionHCS : SV_POSITION;
float2 uv : TEXCOORD0;
float3 worldPos : TEXCOORD1;
float3 normalWS : TEXCOORD2;
float3 viewDirWS : TEXCOORD3;
float4 screenPos : TEXCOORD4;
};
// Textures
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
TEXTURE2D(_NormalMap); SAMPLER(sampler_NormalMap);
TEXTURE2D(_FoamTex); SAMPLER(sampler_FoamTex);
TEXTURE2D(_CameraDepthTexture); SAMPLER(sampler_CameraDepthTexture);
TEXTURE2D(_CameraColorTexture); SAMPLER(sampler_CameraColorTexture);
// ST
float4 _MainTex_ST;
float4 _NormalMap_ST;
float4 _FoamTex_ST;
// Parameters
float4 _BaseColor;
float _SurfaceType;
float4 _FoamColor;
float _MainTexAlpha;
float4 _WaterTint;
float _DepthStrength;
float _Smoothness;
float _WaveAmplitude;
float _WaveLength;
float _WaveSpeed;
float4 _WaveDirection;
float _NormalStrength;
float _SurfaceDetail;
float _RefractionStrength;
float _FresnelStrength;
float _FoamStrength;
float _FoamBias;
float4 _WaterNormal1Speed;
float4 _WaterNormal2Speed;
float4 _FoamScrollSpeed;
float _MainTexBlend;
float _NormalScrollStrength;
float _FoamScrollStrength;
float _ShorelineStrength;
float _ShorelineSharpness;
float _AbsorptionStrength;
float4 _EmissionColor;
float _VoronoiScale;
float _VoronoiThreshold;
float _LavaCrackGlow;
float _LavaEdgeGlow;
float _BubbleDensity;
float _BubbleFlow;
float _BubbleStrength;
float _BubbleFade;
float _VertexDistortStrength;
float _VertexDistortSpeed;
float2 ApplyST(float2 uv, float4 st) { return uv * st.xy + st.zw; }
// Voronoi edge noise
float voronoiEdge(float2 uv)
{
float2 g = floor(uv), f = frac(uv);
float d1=1.0, d2=1.0;
[unroll] for(int y=-1;y<=1;y++)
[unroll] for(int x=-1;x<=1;x++)
{
float2 o=float2(x,y);
float2 h=frac(sin(dot(g+o,float2(127.1,311.7))) * 43758.5453);
float2 r=o+h-f; float d=dot(r,r);
if(d<d1){d2=d1; d1=d;} else if(d<d2){d2=d;}
}
return d2-d1;
}
// Gerstner, śmieszna nazwa
void GerstnerSimple(float2 dir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nContrib)
{
float2 D = normalize(dir);
float k = (2.0 * UNITY_PI) / max(len, 0.0001);
float w = sqrt(9.81 * k);
float ph = k * dot(D, xz) + (spd > 0 ? spd : w) * t;
float steep = 0.5;
float Q = steep * amp * k;
float c = cos(ph);
float s = sin(ph);
disp.x = D.x * (Q * amp * c);
disp.z = D.y * (Q * amp * c);
disp.y = amp * s;
float3 n;
n.x = -D.x * Q * s;
n.z = -D.y * Q * s;
n.y = 1.0 - Q * c;
nContrib = n;
}
void GenerateWaves(float2 baseDir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nSum)
{
float angle = 0.35;
float2 d0 = baseDir;
float2 d1 = float2(baseDir.x * cos(angle) - baseDir.y * sin(angle),
baseDir.x * sin(angle) + baseDir.y * cos(angle));
float2 d2 = -baseDir.yx;
float3 dd0, nn0; GerstnerSimple(d0, amp, len, spd, xz, t, dd0, nn0);
float3 dd1, nn1; GerstnerSimple(d1, amp * 0.6, len * 0.7, spd * 1.2, xz, t, dd1, nn1);
float3 dd2, nn2; GerstnerSimple(d2, amp * 0.4, len * 0.5, spd * 0.8, xz, t, dd2, nn2);
disp = dd0 + dd1 + dd2;
nSum = normalize(nn0 + nn1 + nn2);
}
Varyings vert(Attributes IN)
{
// Global vertex distortion
if(_VertexDistortStrength > 1e-4)
{
float w1 = sin(IN.positionOS.x*2 + _Time.y*_VertexDistortSpeed) *
cos(IN.positionOS.z*2 + _Time.y*_VertexDistortSpeed*1.3);
float w2 = sin(IN.positionOS.x*3.5 + _Time.y*(_VertexDistortSpeed*1.7)) *
sin(IN.positionOS.z*2.8 + _Time.y*(_VertexDistortSpeed*2.1));
float boil = sin(_Time.y*(_VertexDistortSpeed*0.8))*0.2;
IN.positionOS.y += (w1*0.6 + w2*0.4 + boil) * _VertexDistortStrength;
}
float3 wpos = TransformObjectToWorld(IN.positionOS.xyz);
float3 nWS = TransformObjectToWorldNormal(IN.normalOS);
if (_SurfaceType == 0)
{
float2 baseDir = normalize(_WaveDirection.xy);
float3 d, nC;
GenerateWaves(baseDir, _WaveAmplitude, _WaveLength, _WaveSpeed, wpos.xz, _Time.y, d, nC);
wpos += d;
nWS = normalize(nC);
}
Varyings OUT;
OUT.worldPos = wpos;
OUT.positionHCS = TransformWorldToHClip(wpos);
OUT.uv = IN.uv;
OUT.normalWS = nWS;
OUT.viewDirWS = GetWorldSpaceViewDir(wpos);
OUT.screenPos = ComputeScreenPos(OUT.positionHCS);
return OUT;
}
half4 frag(Varyings IN):SV_Target
{
half3 finalColor=0, emission=0;
float3 N = normalize(IN.normalWS);
float3 V = normalize(IN.viewDirWS);
float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
if (_SurfaceType == 0) // WATER
{
// głębia sceny
float rawD = SAMPLE_TEXTURE2D(_CameraDepthTexture, sampler_CameraDepthTexture, screenUV).r;
float sceneD = LinearEyeDepth(rawD, _ZBufferParams);
float fragD = IN.positionHCS.w;
float diff = max(sceneD - fragD, 0.0);
// nieliniowa absorpcja
float absorb = saturate(pow(diff * _AbsorptionStrength, 1.5));
// kolory głębi
float3 tint = _WaterTint.rgb;
float3 deep = tint * float3(0.25, 0.35, 0.3);
float3 waterCol = lerp(tint, deep, absorb);
// pobranie MainTex od razu
float4 baseTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv,_MainTex_ST)) * _BaseColor;
float texAlpha = baseTex.a * _MainTexAlpha;
// wmieszanie MainTex do koloru wody (multiply, jak w Shader Graph)
waterCol *= lerp(1.0, baseTex.rgb, _MainTexBlend);
// normal maps z dodatkowym szumem
float2 noiseUV = IN.uv * 10.0 + _Time.y * 0.1;
float noise = frac(sin(dot(noiseUV, float2(12.9898,78.233))) * 43758.5453);
float2 uvA = ApplyST(IN.uv, _NormalMap_ST)
+ _WaterNormal1Speed.xy * _Time.y * _NormalScrollStrength
+ noise * 0.02 * _NormalScrollStrength;
float2 uvB = ApplyST(IN.uv, _NormalMap_ST)
+ _WaterNormal2Speed.xy * _Time.y * _NormalScrollStrength
- noise * 0.02 * _NormalScrollStrength;
float3 nA = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, uvA));
float3 nB = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, uvB));
float3 wn = normalize(lerp(nA, nB, _SurfaceDetail));
wn = normalize(float3(wn.xy * _NormalStrength, wn.z));
// refraction i reflection
float2 refUV = screenUV + wn.xy * _RefractionStrength;
half3 refraction = SAMPLE_TEXTURE2D(_CameraColorTexture, sampler_CameraColorTexture, refUV).rgb;
half3 reflection = SAMPLE_TEXTURE2D(_CameraColorTexture, sampler_CameraColorTexture, screenUV).rgb;
// blend zależny od smoothness
float3 surfaceCol = lerp(refraction, reflection, _Smoothness);
// fresnel modulowany smoothness
float fresnel = pow(1.0 - saturate(dot(V, wn)), 3.0) * _FresnelStrength * _Smoothness;
// foam wieloskalowy
float2 foamUV = ApplyST(IN.uv, _FoamTex_ST)
+ _FoamScrollSpeed.xy * _Time.y * _FoamScrollStrength;
float foam1 = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 2.0).r;
float foam2 = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 5.0).r;
float foamTexV = saturate(foam1 * 0.6 + foam2 * 0.4);
float slopeFoam = saturate((1.0 - N.y) + _FoamBias);
float foamSurf = saturate(slopeFoam * foamTexV) * _FoamStrength;
float shoreMask = saturate(1.0 - diff * _ShorelineSharpness);
float shoreFoam = shoreMask * foamTexV * _ShorelineStrength;
// piana zależna od głębokości
float depthFoam = saturate(1.0 - diff * 0.5);
// finalny kolor: miks wody i odbić
finalColor = lerp(waterCol, surfaceCol, 0.2);
// emisja piany i fresnela
emission += (foamSurf + shoreFoam) * _FoamColor.rgb * depthFoam;
emission += fresnel;
// alpha
float outAlpha = saturate(lerp(0.85, 0.45, absorb) + (foamSurf + shoreFoam) * 0.1);
outAlpha *= texAlpha;
return half4(finalColor + emission, outAlpha);
}
else if (_SurfaceType == 1) // LAVA
{
float2 uvAnim = IN.uv * _VoronoiScale;
float edge = voronoiEdge(uvAnim);
float cracks = smoothstep(_VoronoiThreshold, _VoronoiThreshold + 0.02, edge);
half3 rockTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv, _MainTex_ST)).rgb;
half3 rockColor = pow(rockTex * _BaseColor.rgb, 1.3);
half3 lavaHot = float3(1.0, 0.35, 0.05);
half3 lavaCore = float3(1.0, 0.6, 0.2);
float boilPulse = 0.5 + 0.5 * sin(_Time.y * 4.0 + uvAnim.x * 3.0 + uvAnim.y * 5.0);
half3 lavaColor = lerp(lavaHot, lavaCore, boilPulse);
finalColor = lerp(lavaColor, rockColor, cracks);
emission = lavaColor * (1.0 - cracks) * _EmissionColor.rgb * _LavaCrackGlow;
float2 uvBubbles = IN.uv * _BubbleDensity + float2(0, _Time.y * _BubbleFlow);
float bubbleMask = smoothstep(0.2, 0.2 + 0.05 * _BubbleFade, voronoiEdge(uvBubbles));
emission += bubbleMask * _BubbleStrength * (1.0 - cracks) * _EmissionColor.rgb;
float fres = pow(1.0 - saturate(dot(N, V)), 3.0);
emission += lavaColor * fres * _LavaEdgeGlow * _EmissionColor.rgb;
return half4(finalColor + emission, 1.0);
}
else if (_SurfaceType == 2) // ICE
{
half3 iceTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, ApplyST(IN.uv, _MainTex_ST)).rgb;
finalColor = iceTex * _BaseColor.rgb;
float fres = pow(1.0 - saturate(dot(N, V)), 4.0);
emission = fres * float3(0.6, 0.85, 1.0) * 0.6;
return half4(finalColor + emission, 1.0);
}
else if (_SurfaceType == 3) // RIVER
{
float2 uvFlow = ApplyST(IN.uv, _MainTex_ST);
uvFlow.y += _Time.y * 0.2;
half3 riverTex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uvFlow).rgb * _BaseColor.rgb;
float2 foamUV = ApplyST(IN.uv, _FoamTex_ST) + _FoamScrollSpeed.xy * _Time.y;
float foam = SAMPLE_TEXTURE2D(_FoamTex, sampler_FoamTex, foamUV * 2.0).r;
emission = foam * _FoamStrength * riverTex;
finalColor = riverTex;
return half4(finalColor + emission, 1.0);
}
return half4(finalColor + emission, 1.0);
}
ENDHLSL
}
}
CustomEditor "LiquidSurfaceShaderGUI_Simplified"
}

View File

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

View File

@@ -7,13 +7,18 @@ public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI
public override void OnGUI(MaterialEditor m, MaterialProperty[] props)
{
var surface = P("_SurfaceType", props);
var mainTex = P("_MainTex", props);
var baseCol = P("_BaseColor", props);
var surface = P("_SurfaceType", props);
var mainTex = P("_MainTex", props);
var baseCol = P("_BaseColor", props);
var mainTexAlpha = P("_MainTexAlpha", props); // NOWE
var smooth = P("_Smoothness", props); // NOWE
// Water
var tint = P("_WaterTint", props);
var depth = P("_DepthStrength", props);
var mainTexBlend = P("_MainTexBlend", props);
var waveAmp = P("_WaveAmplitude", props);
var waveLen = P("_WaveLength", props);
@@ -30,8 +35,10 @@ public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI
var foamTex = P("_FoamTex", props);
var foamStr = P("_FoamStrength", props);
var foamBias = P("_FoamBias", props);
var foamCol = P("_FoamColor", props);
var normalScrollStr = P("_NormalScrollStrength", props);
var foamScrollStr = P("_FoamScrollStrength", props);
// NEW: UV scroll speeds
var n1Spd = P("_WaterNormal1Speed", props);
var n2Spd = P("_WaterNormal2Speed", props);
var foamSpd = P("_FoamScrollSpeed", props);
@@ -61,6 +68,16 @@ public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI
if (mainTex != null && baseCol != null)
m.TexturePropertySingleLine(new GUIContent("Main Texture"), mainTex, baseCol);
if (mainTexAlpha != null)
m.ShaderProperty(mainTexAlpha, "MainTex Alpha Strength"); // NOWE
if (smooth != null)
m.ShaderProperty(smooth, "Smoothness"); // NOWE
if (mainTexBlend != null)
m.ShaderProperty(mainTexBlend, "MainTex Blend Strength");
if (normalScrollStr != null)
m.ShaderProperty(normalScrollStr, "Normal Scroll Strength");
if (foamScrollStr != null)
m.ShaderProperty(foamScrollStr, "Foam Scroll Strength");
EditorGUILayout.Space();
@@ -94,6 +111,7 @@ public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI
EditorGUILayout.LabelField("Foam", EditorStyles.boldLabel);
if (foamTex != null) m.TexturePropertySingleLine(new GUIContent("Foam Texture"), foamTex, foamStr);
if (foamBias != null) m.ShaderProperty(foamBias, "Foam Bias");
if (foamCol != null) m.ShaderProperty(foamCol, "Foam Color");
if (shoreStr != null) m.ShaderProperty(shoreStr, "Shoreline Strength");
if (shoreSharp!= null) m.ShaderProperty(shoreSharp, "Shoreline Sharpness");
@@ -133,6 +151,7 @@ public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI
EditorGUILayout.LabelField("River Settings", EditorStyles.boldLabel);
if (foamTex != null) m.TexturePropertySingleLine(new GUIContent("Foam Texture"), foamTex, foamStr);
if (foamSpd != null) m.ShaderProperty(foamSpd, "Foam Scroll Speed (X,Y)");
if (foamCol != null) m.ShaderProperty(foamCol, "Foam Color");
break;
}

View File

@@ -21,12 +21,11 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Swamp
m_Shader: {fileID: -6465566751694194690, guid: a655d9278e437bb42809e69a7f606136, type: 3}
m_Shader: {fileID: -6465566751694194690, guid: dacb78a819f6aa74fbe8e426b26e1bed, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _EMISSION
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@@ -34,7 +33,7 @@ Material:
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_LockedProperties: _FoamColor
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@@ -62,18 +61,38 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Flow_Map:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 2800000, guid: 6118636ae97e09d43a2697fcff3d036f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FogNoise:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Lava_Texture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainNormal:
m_Texture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 15ab7661a961263478d9dafa5605be78, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: 6118636ae97e09d43a2697fcff3d036f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -82,6 +101,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Rock_Texture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SecondaryNormal:
m_Texture: {fileID: 2800000, guid: ca439406e806ecf44a9586510be9477d, type: 3}
m_Scale: {x: 1, y: 1}
@@ -104,48 +127,101 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AbsorptionStrength: 0.9
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Angle_Change_Speed: 1
- _Angle_Offset: 2
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BubbleDensity: 8
- _BubbleFade: 2
- _BubbleFlow: 0.5
- _BubbleStrength: 1.5
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DensityMultiplier: 1
- _DensityThreshold: 0.1
- _Depth: 0.04
- _DepthStrength: 0
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _Displacement: 0.1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _Flow_Speed: 0.02
- _Flow_Strength: 0.5
- _FoamBias: 0.4
- _FoamScrollStrength: 0
- _FoamStrength: 2
- _FresnelStrength: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Heightmap_Strength: 1
- _Island_Density: 5
- _LavaCrackGlow: 0.8
- _LavaEdgeGlow: 0.5
- _LightScattering: 0.2
- _MainTexAlpha: 1
- _MainTexBlend: 1
- _MaxDistance: 100
- _Metallic: 0
- _NoiseOffset: 0
- _NoiseTiling: 1
- _NormalScrollStrength: 0
- _NormalStrenght: 1
- _NormalStrength: 0.295
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.359
- _RefractionStrength: 0.0285
- _ShorelineSharpness: 0.5
- _ShorelineStrength: 0.496
- _Smoothness: 1
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Strenght: 1.529
- _StepSize: 1
- _Strenght: 0.54
- _Surface: 0
- _SurfaceDetail: 0.54
- _SurfaceType: 0
- _Thickness: 0.1
- _Thickness_Falloff: 0.02
- _VertexDistortSpeed: 0
- _VertexDistortStrength: 0
- _VoronoiScale: 5
- _VoronoiThreshold: 0.3
- _WaveAmplitude: 0
- _WaveLength: 0
- _WaveSpeed: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor: {r: 0.18102476, g: 0.4150943, b: 0, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Deep_Water_Colour: {r: 0.051886797, g: 0.103773594, b: 0, a: 0.7176471}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 0.3018868, g: 0.2828889, b: 0, a: 1}
- _FoamScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
- _Lava_Color: {r: 32, g: 1.581884, b: 0, a: 0}
- _Lava_Speed: {r: 0, g: 0, b: 0, a: 0}
- _LightContribution: {r: 1, g: 1, b: 1, a: 1}
- _Rock_Color: {r: 0.30980387, g: 0.22745097, b: 0.17254895, a: 1}
- _Shallow_Water_Colour: {r: 0.18867923, g: 0.3207547, b: 0, a: 0.6745098}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _WaterNormal1Speed: {r: 0, g: 0, b: 0, a: 0}
- _WaterNormal2Speed: {r: 0, g: 0, b: 0, a: 0}
- _WaterTint: {r: 0.05, g: 0.15, b: 0.08, a: 1}
- _WaveDirection: {r: 0, g: -0.03, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

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