12 Commits

Author SHA1 Message Date
eba2a8e0a6 fixed url for rebootkit in submodules 2025-10-24 13:56:32 +02:00
18effac005 working on humbie still 2025-10-24 13:54:27 +02:00
98cf38ac00 updated rkit 2025-10-21 15:25:59 +02:00
cbca728bc3 Merge remote-tracking branch 'origin/astek' 2025-10-18 21:58:34 +02:00
9f0a889eb0 bugfix: camera stuttering when humbie touched the player 2025-10-18 21:57:30 +02:00
b04369531b working on ai still 2025-10-17 10:10:08 +02:00
Bartek
5106d565e2 W.I.P, new skybox, Baked Lightning, detailed vulkan and beach area 2025-10-16 23:25:24 +02:00
0bf2bbfb97 Merge branch 'main' into dev 2025-10-14 16:06:53 +02:00
1d15377885 working on humbies ai 2025-10-14 16:05:57 +02:00
Bartek
7f718f2f6f Hybrid Volumetric Fog + some swamp area test 2025-10-14 16:02:35 +02:00
Bartek
fc4a139d11 Merge branch 'graphics' into astek 2025-10-13 14:56:19 +02:00
Bartek
59d14633a5 VolumetricFog 2.0 2025-10-13 14:55:32 +02:00
261 changed files with 6394 additions and 407 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "Assets/RebootKit"] [submodule "Assets/RebootKit"]
path = Assets/RebootKit path = Assets/RebootKit
url = http://100.64.0.6:3000/RR/RebootKit.git url = https://git.chmurrka.eu/RR/RebootKit.git

8
Assets/Editor.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb91fccbcc88c5e4ba5e73ed6b8057c8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,93 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.IO;
public class CreatePerlinFogAsset : EditorWindow
{
public int size = 64;
public float scale = 0.05f;
public int seed = 1337;
public string assetPath = "Assets/FogNoise.asset";
[MenuItem("Tools/Generate Fog Texture3D")]
static void OpenWindow() => GetWindow<CreatePerlinFogAsset>("Generate Fog 3D");
void OnGUI()
{
GUILayout.Label("Generate 3D Perlin Fog Texture", EditorStyles.boldLabel);
size = EditorGUILayout.IntField("Size", size);
scale = EditorGUILayout.FloatField("Scale", scale);
seed = EditorGUILayout.IntField("Seed", seed);
assetPath = EditorGUILayout.TextField("Asset Path", assetPath);
if (GUILayout.Button("Generate and Save"))
{
var tex = CreatePerlin3D(size, scale, seed);
tex.wrapMode = TextureWrapMode.Repeat;
tex.filterMode = FilterMode.Trilinear;
tex.Apply();
// ensure directory exists
var dir = Path.GetDirectoryName(assetPath);
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
AssetDatabase.CreateAsset(tex, assetPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
EditorUtility.FocusProjectWindow();
Selection.activeObject = AssetDatabase.LoadAssetAtPath<Texture3D>(assetPath);
Debug.Log($"Texture3D saved to {assetPath}");
}
}
static Texture3D CreatePerlin3D(int size, float scale, int seed)
{
var tex = new Texture3D(size, size, size, TextureFormat.RGBA32, false);
var colors = new Color[size * size * size];
System.Random rng = new System.Random(seed);
float offsetX = (float)rng.NextDouble() * 10000f;
float offsetY = (float)rng.NextDouble() * 10000f;
float offsetZ = (float)rng.NextDouble() * 10000f;
int idx = 0;
for (int z = 0; z < size; z++)
{
float wz = (z + offsetZ) * scale;
for (int y = 0; y < size; y++)
{
float wy = (y + offsetY) * scale;
for (int x = 0; x < size; x++)
{
float wx = (x + offsetX) * scale;
float n = FractalPerlin(wx, wy, wz, 3);
colors[idx++] = new Color(n, n, n, n);
}
}
}
tex.SetPixels(colors);
tex.Apply();
return tex;
}
static float FractalPerlin(float x, float y, float z, int octaves)
{
float amp = 1f;
float freq = 1f;
float sum = 0f;
float max = 0f;
for (int i = 0; i < octaves; i++)
{
sum += amp * Mathf.PerlinNoise(x * freq, y * freq);
sum += amp * Mathf.PerlinNoise(y * freq, z * freq);
sum += amp * Mathf.PerlinNoise(z * freq, x * freq);
max += 3f * amp;
amp *= 0.5f;
freq *= 2f;
}
return Mathf.Clamp01(sum / max);
}
}
#endif

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 652f3fea4a0cee84584740a20adda1b5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 921 KiB

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60d9ec5fcaf76684f856b882ab632a45
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -70,7 +70,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 2800000, guid: d10e6a092c503ab4199ecec3ae5c953e, type: 3} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3595323a20e4e9149af6b2682ddbbd16
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11700000
userData:
assetBundleName:
assetBundleVariant:

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:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de9d333e7ece24e488908a9b606d2575
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11700000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b9aa881a4e8a39846be9a61466800446
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11700000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,65 @@
using UnityEngine;
[ExecuteAlways]
public class FogNoiseGenerator : MonoBehaviour
{
public Material targetMaterial;
public string propertyName = "_FogNoise";
public int size = 64;
public float scale = 0.05f;
public int seed = 1337;
void Start() { if (Application.isPlaying) Generate(); }
[ContextMenu("Generate Noise")]
public void Generate()
{
if (targetMaterial == null) { Debug.LogWarning("No target material set"); return; }
var tex = CreatePerlin3D(size, scale, seed);
tex.wrapMode = TextureWrapMode.Repeat;
tex.filterMode = FilterMode.Trilinear;
tex.Apply();
targetMaterial.SetTexture(propertyName, tex);
Debug.Log("Generated Texture3D and assigned to material");
}
static Texture3D CreatePerlin3D(int size, float scale, int seed)
{
var tex = new Texture3D(size, size, size, TextureFormat.RGBA32, false);
var cols = new Color[size * size * size];
var rng = new System.Random(seed);
float ox = (float)rng.NextDouble() * 10000f, oy = (float)rng.NextDouble() * 10000f, oz = (float)rng.NextDouble() * 10000f;
int idx = 0;
for (int z = 0; z < size; z++)
{
float wz = (z + oz) * scale;
for (int y = 0; y < size; y++)
{
float wy = (y + oy) * scale;
for (int x = 0; x < size; x++)
{
float wx = (x + ox) * scale;
float n = FractalPerlin(wx, wy, wz, 3);
cols[idx++] = new Color(n, n, n, n);
}
}
}
tex.SetPixels(cols);
return tex;
}
static float FractalPerlin(float x, float y, float z, int octaves)
{
float amp = 1f, freq = 1f, sum = 0f, max = 0f;
for (int i = 0; i < octaves; i++)
{
sum += amp * Mathf.PerlinNoise(x * freq, y * freq);
sum += amp * Mathf.PerlinNoise(y * freq, z * freq);
sum += amp * Mathf.PerlinNoise(z * freq, x * freq);
max += 3f * amp;
amp *= 0.5f;
freq *= 2f;
}
return Mathf.Clamp01(sum / max);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 491a2f6e8cbd1ff49a2eb93772881d0e

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0d15428c5d6d1a0408461251a83ec103 guid: 122f172c549967c4cbc3ca3e80298b5f
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

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

@@ -0,0 +1,174 @@
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
_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
#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;
// ✅ 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;
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)
{
// 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;
// ✅ Custom Additional Lights
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 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);
fogColor = lerp(fogColor, _AmbientFogColor.rgb, 0.25);
fogColor += lightCol * _GodRayStrength;
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;
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);
return float4(_CustomAdditionalLightColor[0].rgb, 1.0);
}
ENDHLSL
}
}
}

View File

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

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

@@ -0,0 +1,227 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Volumetric Light
m_Shader: {fileID: 4800000, guid: 6934182509f924641a5a75ad544128c9, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _GLOSSYREFLECTIONS_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _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}
m_Offset: {x: 0, y: 0}
- _FogNoise:
m_Texture: {fileID: 11700000, guid: 3595323a20e4e9149af6b2682ddbbd16, type: 2}
m_Scale: {x: 100, y: 100}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _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}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _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: 8
- _Cull: 2
- _Cutoff: 0.5
- _DayFactor: 0.091
- _DebugLights: 0
- _Density: 0.1
- _DensityMultiplier: 1.77
- _DensityThreshold: 0.193
- _DepthFade: 0.01
- _DepthStrength: 0.6
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _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: 2
- _HeightModeBlend: 0.496
- _Intensity: 1
- _LavaCrackGlow: 0.8
- _LavaEdgeGlow: 0.5
- _LightScattering: 0.35
- _LightScatteringG: 0.2
- _MaskTiling: 0.03
- _MaxDistance: 6
- _MaxSteps: 26.9
- _Metallic: 0
- _Mode: 0
- _NearEnd: 4
- _NearFade: 0
- _NearStart: 0.05
- _NoiseJitter: 0.02
- _NoiseOffset: 0.6
- _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
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _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:
- _AmbientFogColor: {r: 0.25, g: 0.28, b: 0.3, a: 1}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.7264151, g: 0.607963, b: 0.22957456, a: 1}
- _ColorHigh: {r: 0.65, g: 0.68, b: 0.7, a: 1}
- _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: 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}
- _NightColor: {r: 0.25, g: 0.28, b: 0.3, a: 1}
- _NoiseScrollSpeed: {r: 0.01, g: 0, b: 0.02, a: 0}
- _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
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@@ -2,7 +2,7 @@ fileFormatVersion: 2
guid: 6dad1b85c9bf7884e8a1671ebcd5d1ab guid: 6dad1b85c9bf7884e8a1671ebcd5d1ab
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 2100000 mainObjectFileID: 0
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: 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

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 199 KiB

View File

@@ -1,4 +1,4 @@
Shader "Custom/UniversalLiquidSurface_Simplified" Shader "Custom/UniversalLiquidSurface"
{ {
Properties Properties
{ {
@@ -27,7 +27,7 @@ Shader "Custom/UniversalLiquidSurface_Simplified"
_FoamStrength ("Foam Strength", Range(0,2)) = 0.6 _FoamStrength ("Foam Strength", Range(0,2)) = 0.6
_FoamBias ("Foam Bias", Range(-1,1)) = 0.0 _FoamBias ("Foam Bias", Range(-1,1)) = 0.0
// NEW: UV scroll speeds // UV scroll speeds
_WaterNormal1Speed ("Normal Map 1 Speed (X,Y)", Vector) = (0.05, 0.0, 0, 0) _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) _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) _FoamScrollSpeed ("Foam Scroll Speed (X,Y)", Vector) = (0.02, 0.01, 0, 0)
@@ -44,7 +44,7 @@ Shader "Custom/UniversalLiquidSurface_Simplified"
_LavaCrackGlow ("Lava Crack Glow Strength", Float) = 0.8 _LavaCrackGlow ("Lava Crack Glow Strength", Float) = 0.8
_LavaEdgeGlow ("Lava Edge Glow Strength", Float) = 0.5 _LavaEdgeGlow ("Lava Edge Glow Strength", Float) = 0.5
// Procedural bubbles // Procedural bubbles - coś nie bangla
_BubbleDensity ("Bubble Density", Float) = 8.0 _BubbleDensity ("Bubble Density", Float) = 8.0
_BubbleFlow ("Bubble Flow Speed", Float) = 0.5 _BubbleFlow ("Bubble Flow Speed", Float) = 0.5
_BubbleStrength ("Bubble Strength", Float) = 1.5 _BubbleStrength ("Bubble Strength", Float) = 1.5
@@ -104,7 +104,7 @@ Shader "Custom/UniversalLiquidSurface_Simplified"
float4 _NormalMap_ST; float4 _NormalMap_ST;
float4 _FoamTex_ST; float4 _FoamTex_ST;
// Params // Parameters
float4 _BaseColor; float4 _BaseColor;
float _SurfaceType; float _SurfaceType;
@@ -163,7 +163,7 @@ Shader "Custom/UniversalLiquidSurface_Simplified"
return d2-d1; return d2-d1;
} }
// Gerstner // Gerstner, śmieszna nazwa
void GerstnerSimple(float2 dir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nContrib) void GerstnerSimple(float2 dir, float amp, float len, float spd, float2 xz, float t, out float3 disp, out float3 nContrib)
{ {
float2 D = normalize(dir); float2 D = normalize(dir);

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

View File

@@ -21,12 +21,11 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Swamp m_Name: Swamp
m_Shader: {fileID: -6465566751694194690, guid: a655d9278e437bb42809e69a7f606136, type: 3} m_Shader: {fileID: -6465566751694194690, guid: dacb78a819f6aa74fbe8e426b26e1bed, type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
m_InvalidKeywords: m_InvalidKeywords: []
- _EMISSION
m_LightmapFlags: 2 m_LightmapFlags: 2
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
@@ -34,7 +33,7 @@ Material:
stringTagMap: {} stringTagMap: {}
disabledShaderPasses: disabledShaderPasses:
- MOTIONVECTORS - MOTIONVECTORS
m_LockedProperties: m_LockedProperties: _FoamColor
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
@@ -62,18 +61,38 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} 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: - _MainNormal:
m_Texture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3} m_Texture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 15ab7661a961263478d9dafa5605be78, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} 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: - _OcclusionMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@@ -82,6 +101,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} 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: - _SecondaryNormal:
m_Texture: {fileID: 2800000, guid: ca439406e806ecf44a9586510be9477d, type: 3} m_Texture: {fileID: 2800000, guid: ca439406e806ecf44a9586510be9477d, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@@ -104,48 +127,101 @@ Material:
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Ints: [] m_Ints: []
m_Floats: m_Floats:
- _AbsorptionStrength: 0.9
- _AddPrecomputedVelocity: 0 - _AddPrecomputedVelocity: 0
- _AlphaClip: 0 - _AlphaClip: 0
- _AlphaToMask: 0 - _AlphaToMask: 0
- _Angle_Change_Speed: 1
- _Angle_Offset: 2
- _Blend: 0 - _Blend: 0
- _BlendModePreserveSpecular: 1 - _BlendModePreserveSpecular: 1
- _BubbleDensity: 8
- _BubbleFade: 2
- _BubbleFlow: 0.5
- _BubbleStrength: 1.5
- _BumpScale: 1 - _BumpScale: 1
- _ClearCoatMask: 0 - _ClearCoatMask: 0
- _ClearCoatSmoothness: 0 - _ClearCoatSmoothness: 0
- _Cull: 2 - _Cull: 2
- _Cutoff: 0.5 - _Cutoff: 0.5
- _DensityMultiplier: 1
- _DensityThreshold: 0.1
- _Depth: 0.04 - _Depth: 0.04
- _DepthStrength: 0
- _DetailAlbedoMapScale: 1 - _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _Displacement: 0.1 - _Displacement: 0.1
- _DstBlend: 0 - _DstBlend: 0
- _DstBlendAlpha: 0 - _DstBlendAlpha: 0
- _EnvironmentReflections: 1 - _EnvironmentReflections: 1
- _Flow_Speed: 0.02
- _Flow_Strength: 0.5
- _FoamBias: 0.4
- _FoamScrollStrength: 0
- _FoamStrength: 2
- _FresnelStrength: 0
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0
- _GlossyReflections: 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 - _Metallic: 0
- _NoiseOffset: 0
- _NoiseTiling: 1
- _NormalScrollStrength: 0
- _NormalStrenght: 1 - _NormalStrenght: 1
- _NormalStrength: 0.295
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.005 - _Parallax: 0.005
- _QueueControl: 0 - _QueueControl: 0
- _QueueOffset: 0 - _QueueOffset: 0
- _ReceiveShadows: 1 - _ReceiveShadows: 1
- _Smoothness: 0.359 - _RefractionStrength: 0.0285
- _ShorelineSharpness: 0.5
- _ShorelineStrength: 0.496
- _Smoothness: 1
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1
- _SrcBlendAlpha: 1 - _SrcBlendAlpha: 1
- _Strenght: 1.529 - _StepSize: 1
- _Strenght: 0.54
- _Surface: 0 - _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 - _WorkflowMode: 1
- _ZWrite: 1 - _ZWrite: 1
m_Colors: 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} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Deep_Water_Colour: {r: 0.051886797, g: 0.103773594, b: 0, a: 0.7176471} - _Deep_Water_Colour: {r: 0.051886797, g: 0.103773594, b: 0, a: 0.7176471}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _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} - _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} - _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_BuildTextureStacks: []
m_AllowLocking: 1 m_AllowLocking: 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d10e6a092c503ab4199ecec3ae5c953e guid: fb66d42ac66222c4e9a93607103a5f4c
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

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:

View File

@@ -15,7 +15,7 @@ LightingSettings:
m_AlbedoBoost: 1 m_AlbedoBoost: 1
m_IndirectOutputScale: 1 m_IndirectOutputScale: 1
m_UsingShadowmask: 1 m_UsingShadowmask: 1
m_BakeBackend: 1 m_BakeBackend: 2
m_LightmapMaxSize: 1024 m_LightmapMaxSize: 1024
m_LightmapSizeFixed: 0 m_LightmapSizeFixed: 0
m_UseMipmapLimits: 1 m_UseMipmapLimits: 1

Binary file not shown.

View File

@@ -21,11 +21,12 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Skybox m_Name: Skybox
m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} m_Shader: {fileID: 108, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
m_InvalidKeywords: [] m_InvalidKeywords:
- _MAPPING_LATITUDE_LONGITUDE_LAYOUT
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
@@ -78,7 +79,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 3c72539d75679f346b8b204b0da29dbe, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:
@@ -138,12 +139,16 @@ Material:
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0
- _GlossyReflections: 0 - _GlossyReflections: 0
- _ImageType: 0
- _Layout: 0
- _Mapping: 1
- _Metallic: 0 - _Metallic: 0
- _MirrorOnBack: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.005 - _Parallax: 0.005
- _QueueOffset: 0 - _QueueOffset: 0
- _ReceiveShadows: 1 - _ReceiveShadows: 1
- _Rotation: 0 - _Rotation: 34
- _Smoothness: 0.5 - _Smoothness: 0.5
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -37,9 +37,9 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 1
nPOTScale: 1 nPOTScale: 1
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50

View File

@@ -129,6 +129,8 @@ MonoBehaviour:
m_PrefilterScreenCoord: 1 m_PrefilterScreenCoord: 1
m_PrefilterNativeRenderPass: 1 m_PrefilterNativeRenderPass: 1
m_PrefilterUseLegacyLightmaps: 0 m_PrefilterUseLegacyLightmaps: 0
m_PrefilterReflectionProbeBlending: 0
m_PrefilterReflectionProbeBoxProjection: 0
m_ShaderVariantLogLevel: 0 m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0 m_ShadowCascades: 0
m_Textures: m_Textures:

View File

@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b00045f12942b46c698459096c89274e, type: 3} m_Script: {fileID: 11500000, guid: b00045f12942b46c698459096c89274e, type: 3}
m_Name: FullScreenPassRendererFeature m_Name: Volumetric Fog
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Active: 1 m_Active: 1
injectionPoint: 600 injectionPoint: 600
@@ -72,6 +72,21 @@ MonoBehaviour:
clearStencil: 0 clearStencil: 0
previewInEditMode: 1 previewInEditMode: 1
showInPreviewCamera: 1 showInPreviewCamera: 1
--- !u!114 &-825162153970602008
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 65a4c2f000271724085c351f781aa683, type: 3}
m_Name: VolumetricFogFeature
m_EditorClassIdentifier:
m_Active: 1
settings: {fogShader: {fileID: 4800000, guid: 6934182509f924641a5a75ad544128c9, type: 3}, fogMaterialOverride: {fileID: 2100000, guid: 0566d3eee3019ea45aa4c3cf95baa188, type: 2}, injectionPoint: 600, halfResolution: 0}
_material: {fileID: 2100000, guid: 0566d3eee3019ea45aa4c3cf95baa188, type: 2}
--- !u!114 &-325266136160137181 --- !u!114 &-325266136160137181
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -207,7 +222,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Active: 1 m_Active: 1
m_Settings: m_Settings:
AOMethod: 0 AOMethod: 1
Downsample: 0 Downsample: 0
AfterOpaque: 0 AfterOpaque: 0
Source: 1 Source: 1
@@ -219,12 +234,3 @@ MonoBehaviour:
BlurQuality: 2 BlurQuality: 2
Falloff: 100 Falloff: 100
SampleCount: -1 SampleCount: -1
m_BlueNoise256Textures:
- {fileID: 2800000, guid: 36f118343fc974119bee3d09e2111500, type: 3}
- {fileID: 2800000, guid: 4b7b083e6b6734e8bb2838b0b50a0bc8, type: 3}
- {fileID: 2800000, guid: c06cc21c692f94f5fb5206247191eeee, type: 3}
- {fileID: 2800000, guid: cb76dd40fa7654f9587f6a344f125c9a, type: 3}
- {fileID: 2800000, guid: e32226222ff144b24bf3a5a451de54bc, type: 3}
- {fileID: 2800000, guid: 3302065f671a8450b82c9ddf07426f3a, type: 3}
- {fileID: 2800000, guid: 56a77a3e8d64f47b6afe9e3c95cb57d5, type: 3}
m_Shader: {fileID: 4800000, guid: 0849e84e3d62649e8882e9d6f056a017, type: 3}

View File

@@ -10,7 +10,7 @@ TerrainLayer:
m_DiffuseTexture: {fileID: 2800000, guid: b39336e67b68db14aa4a8a7f883e5aff, type: 3} m_DiffuseTexture: {fileID: 2800000, guid: b39336e67b68db14aa4a8a7f883e5aff, type: 3}
m_NormalMapTexture: {fileID: 2800000, guid: a8a2fc863627f464e838ba616a1d5789, type: 3} m_NormalMapTexture: {fileID: 2800000, guid: a8a2fc863627f464e838ba616a1d5789, type: 3}
m_MaskMapTexture: {fileID: 2800000, guid: bd4c61d030690814097a2076498d1c75, type: 3} m_MaskMapTexture: {fileID: 2800000, guid: bd4c61d030690814097a2076498d1c75, type: 3}
m_TileSize: {x: 100, y: 100} m_TileSize: {x: 10, y: 10}
m_TileOffset: {x: 0, y: 0} m_TileOffset: {x: 0, y: 0}
m_Specular: {r: 0, g: 0, b: 0, a: 0} m_Specular: {r: 0, g: 0, b: 0, a: 0}
m_Metallic: 0 m_Metallic: 0

View File

@@ -10,7 +10,7 @@ TerrainLayer:
m_DiffuseTexture: {fileID: 2800000, guid: 87735acf16005914dba9087627517773, type: 3} m_DiffuseTexture: {fileID: 2800000, guid: 87735acf16005914dba9087627517773, type: 3}
m_NormalMapTexture: {fileID: 2800000, guid: c8b8fa1b153cfd3428c4c5c2fded152e, type: 3} m_NormalMapTexture: {fileID: 2800000, guid: c8b8fa1b153cfd3428c4c5c2fded152e, type: 3}
m_MaskMapTexture: {fileID: 2800000, guid: 240efe9002d9e7a44b9f2a592f357102, type: 3} m_MaskMapTexture: {fileID: 2800000, guid: 240efe9002d9e7a44b9f2a592f357102, type: 3}
m_TileSize: {x: 200, y: 200} m_TileSize: {x: 10, y: 10}
m_TileOffset: {x: 0, y: 0} m_TileOffset: {x: 0, y: 0}
m_Specular: {r: 0, g: 0, b: 0, a: 0} m_Specular: {r: 0, g: 0, b: 0, a: 0}
m_Metallic: 0 m_Metallic: 0

View File

@@ -76,7 +76,7 @@ TextureImporter:
platformSettings: platformSettings:
- serializedVersion: 4 - serializedVersion: 4
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 256 maxTextureSize: 2048
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1

View File

@@ -76,7 +76,7 @@ TextureImporter:
platformSettings: platformSettings:
- serializedVersion: 4 - serializedVersion: 4
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 256 maxTextureSize: 2048
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1

View File

@@ -76,7 +76,7 @@ TextureImporter:
platformSettings: platformSettings:
- serializedVersion: 4 - serializedVersion: 4
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 256 maxTextureSize: 2048
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 2 textureCompression: 2

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7ba665ddebe34f608f00db5d8107b685
timeCreated: 1761225260

View File

@@ -5,7 +5,7 @@ using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;
using Logger = RebootKit.Engine.Foundation.Logger; using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho { namespace RebootReality.jelycho.Actors {
public class ActorSpawner : Actor { public class ActorSpawner : Actor {
static readonly Logger s_Logger = new Logger(nameof(ActorSpawner)); static readonly Logger s_Logger = new Logger(nameof(ActorSpawner));

View File

@@ -6,7 +6,7 @@ using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using Logger = RebootKit.Engine.Foundation.Logger; using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho { namespace RebootReality.jelycho.Actors {
public class ButtonActor : Actor, IInteractable { public class ButtonActor : Actor, IInteractable {
static readonly Logger s_Logger = new Logger(nameof(ButtonActor)); static readonly Logger s_Logger = new Logger(nameof(ButtonActor));

View File

@@ -0,0 +1,8 @@
namespace RebootReality.jelycho.Actors {
public interface IHasHealth {
ulong Health { get; }
ulong MaxHealth { get; }
bool IsAlive();
}
}

View File

@@ -1,4 +1,4 @@
namespace RebootReality.jelycho { namespace RebootReality.jelycho.Actors {
public interface IInteractable { public interface IInteractable {
void SetHighlight(bool highlight); void SetHighlight(bool highlight);
void Interact(); void Interact();

View File

@@ -4,6 +4,7 @@ using RebootKit.Engine.Main;
using RebootKit.Engine.Network; using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using RebootReality.jelycho.InfectedArea; using RebootReality.jelycho.InfectedArea;
using RebootReality.jelycho.Main;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;

View File

@@ -1,5 +1,6 @@
using RebootKit.Engine.Network; using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Actors;
using RebootReality.jelycho.Enemies; using RebootReality.jelycho.Enemies;
using UnityEngine; using UnityEngine;
@@ -24,7 +25,7 @@ namespace RebootReality.jelycho.Beacons {
} }
} }
public class MotherActor : Actor, IKillable { public class MotherActor : Actor, IHasHealth {
MotherActorData m_ActorData = new MotherActorData(); MotherActorData m_ActorData = new MotherActorData();
[field: SerializeField] public Transform GutConnector { get; private set; } [field: SerializeField] public Transform GutConnector { get; private set; }
@@ -37,14 +38,22 @@ namespace RebootReality.jelycho.Beacons {
} }
// //
// @MARK: IKillable // @MARK: IHasHealth
// //
public ulong Health {
get {
return m_ActorData.Health;
}
private set {
m_ActorData.Health = value;
}
}
[field: SerializeField] public ulong MaxHealth { get; private set; }
public bool IsAlive() { public bool IsAlive() {
return m_ActorData.Health > 0; return m_ActorData.Health > 0;
} }
public ulong OnHit(Actor attacker, ulong damage) {
return damage;
}
} }
} }

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aaf9c8fc3fd047bfa82bdf2c1422c6be
timeCreated: 1761224582

View File

@@ -7,7 +7,7 @@ using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using Logger = RebootKit.Engine.Foundation.Logger; using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho { namespace RebootReality.jelycho.Damage {
public class HitboxManagerActor : Actor { public class HitboxManagerActor : Actor {
static readonly Logger s_Logger = new Logger(nameof(HitboxManagerActor)); static readonly Logger s_Logger = new Logger(nameof(HitboxManagerActor));
static readonly Collider[] s_CollidersBuffer = new Collider[512]; static readonly Collider[] s_CollidersBuffer = new Collider[512];
@@ -54,25 +54,6 @@ namespace RebootReality.jelycho {
hurtbox.ReceiveDamage(attacker, damage, p); hurtbox.ReceiveDamage(attacker, damage, p);
} }
// if (s_CollidersBuffer[i].TryGetComponent(out IKillable killable)) {
// Actor killableActor = killable as Actor;
// if (killableActor == attacker) {
// continue;
// }
//
// if (killable is IHasHitFeedback hitFeedback) {
// float3 p = s_CollidersBuffer[i].ClosestPoint(origin);
// if (ShouldShowHitboxes()) {
// DbgDraw.Sphere(p, Quaternion.identity, Vector3.one * 0.1f, Color.magenta, m_HitboxDebugDuration);
// }
//
// hitFeedback.HitFeedback(p);
// }
//
// // @TODO: send command to server to hit an killable
// killable.OnHit(attacker, damage);
// }
} }
} }

View File

@@ -1,7 +1,7 @@
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using Unity.Mathematics; using Unity.Mathematics;
namespace RebootReality.jelycho { namespace RebootReality.jelycho.Damage {
public interface IHurtbox { public interface IHurtbox {
void ReceiveDamage(Actor attacker, ulong damage, float3 worldHitPos); void ReceiveDamage(Actor attacker, ulong damage, float3 worldHitPos);
} }

View File

@@ -1,10 +0,0 @@
using RebootKit.Engine.Simulation;
namespace RebootReality.jelycho.Enemies {
public interface IKillable {
bool IsAlive();
// @NOTE: Returns damage dealt
ulong OnHit(Actor attacker, ulong damage);
}
}

View File

@@ -2,6 +2,7 @@
using RebootKit.Engine.Extensions; using RebootKit.Engine.Extensions;
using RebootKit.Engine.Main; using RebootKit.Engine.Main;
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Enemies.Zombie;
using Unity.Collections; using Unity.Collections;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 72a9c46420c34ee594e3a68ac031a649
timeCreated: 1761227055

View File

@@ -6,15 +6,19 @@ using RebootKit.Engine.Extensions;
using RebootKit.Engine.Main; using RebootKit.Engine.Main;
using RebootKit.Engine.Network; using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Actors;
using RebootReality.jelycho.Beacons;
using RebootReality.jelycho.Main;
using RebootReality.jelycho.Player; using RebootReality.jelycho.Player;
using TriInspector; using TriInspector;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
using Logger = RebootKit.Engine.Foundation.Logger; using Logger = RebootKit.Engine.Foundation.Logger;
using Random = UnityEngine.Random;
using UnityEvent = UnityEngine.Events.UnityEvent; using UnityEvent = UnityEngine.Events.UnityEvent;
namespace RebootReality.jelycho.Enemies { namespace RebootReality.jelycho.Enemies.Zombie {
public class ZombieActorData : IActorData { public class ZombieActorData : IActorData {
public void Serialize(NetworkBufferWriter writer) { public void Serialize(NetworkBufferWriter writer) {
} }
@@ -61,33 +65,61 @@ namespace RebootReality.jelycho.Enemies {
} }
} }
public class ZombieBlackboard { class ZombiePickVictim : IStrategy {
public ZombieActor Self; public BehaviourNode.Status Process(Actor target, float dt) {
if (target is not ZombieActor zombie) {
return BehaviourNode.Status.Failure;
}
Actor victim = zombie.FindNewVictim();
if (victim == null) {
return BehaviourNode.Status.Failure;
}
return BehaviourNode.Status.Success;
}
}
class ZombieGoToPlayer : IStrategy {
public BehaviourNode.Status Process(Actor target, float dt) {
if (target is not ZombieActor zombie) {
return BehaviourNode.Status.Failure;
}
if (!zombie.HasTravelDestination) {
float3 victimPos = zombie.Victim.transform.position;
float dstToVictimSq = math.distancesq(victimPos, zombie.transform.position);
if (dstToVictimSq < 1.0f) {
return BehaviourNode.Status.Success;
}
zombie.GoTo(victimPos);
return BehaviourNode.Status.Running;
}
return BehaviourNode.Status.Running;
}
} }
[DeclareBoxGroup("Body parts")] [DeclareBoxGroup("Body parts")]
public class ZombieActor : Actor, IKillable { [DeclareBoxGroup("Animations")]
public class ZombieActor : Actor, IHasHealth {
static readonly Logger s_Logger = new Logger(nameof(ZombieActor)); static readonly Logger s_Logger = new Logger(nameof(ZombieActor));
static readonly int s_MovementSpeedHash = Animator.StringToHash("MovementSpeed");
enum AIState {
Idle,
Dead,
AttackBase,
AttackCharacter,
PanicEscape,
Berserk
}
[SerializeField] AnimancerComponent m_Animancer; [SerializeField] AnimancerComponent m_Animancer;
[SerializeField] NavMeshAgent m_NavAgent; [SerializeField] NavMeshAgent m_NavAgent;
public NavMeshAgent NavAgent {
get {
return m_NavAgent;
}
}
[SerializeField] Collider m_RootCollider; [SerializeField] Collider m_RootCollider;
[SerializeField] Rigidbody[] m_RagdollRigidbodies; [SerializeField] Rigidbody[] m_RagdollRigidbodies;
[SerializeField] float m_MaxAttackDistance = 1.0f; [SerializeField] float m_MaxAttackDistance = 2.0f;
[SerializeField] float m_LoseInterestMinDistance = 10.0f; [SerializeField] float m_LoseInterestMinDistance = 10.0f;
[SerializeField] ulong m_BaseDamage = 10; [SerializeField] ulong m_BaseDamage = 10;
[SerializeField] float m_AttackDelay = 1.0f; [SerializeField] float m_AttackDelay = 1.0f;
@@ -98,30 +130,60 @@ namespace RebootReality.jelycho.Enemies {
[SerializeField, Group("Body parts")] ZombieBodyPart m_LeftLeg; [SerializeField, Group("Body parts")] ZombieBodyPart m_LeftLeg;
[SerializeField, Group("Body parts")] ZombieBodyPart m_RightLeg; [SerializeField, Group("Body parts")] ZombieBodyPart m_RightLeg;
AIState m_State = AIState.Idle; [SerializeField, Group("Animations")] TransitionAsset m_GroundLocomotion;
[SerializeField, Group("Animations")] StringAsset m_GroundLocomotionPropertyRight;
[SerializeField, Group("Animations")] StringAsset m_GroundLocomotionPropertyForward;
SmoothedVector2Parameter m_SmoothLocomotionDirection;
PlayerActor m_PlayerTarget; [SerializeField, Group("Animations")] AnimationClip[] m_AttackClips;
float m_NextAttackTimer;
public UnityEvent died = new UnityEvent();
BehaviourTree m_BehaviourTree; BehaviourTree m_BehaviourTree;
public enum MindState {
Normal,
RunAway,
Berserk
}
public bool IsRagdoll { get; private set; } = false;
public MindState Mind { get; private set; } = MindState.Normal;
public Actor Victim { get; private set; }
public bool HasTravelDestination { get; private set; }
public float3 TravelDestination { get; private set; }
public UnityEvent died = new UnityEvent();
// //
// @MARK: Unity callbacks // @MARK: Unity callbacks
// //
void Awake() { void Awake() {
SetRagdollLocal(false); SetRagdollLocal(IsRagdoll);
m_SmoothLocomotionDirection = new SmoothedVector2Parameter(m_Animancer,
m_GroundLocomotionPropertyRight,
m_GroundLocomotionPropertyForward,
0.1f);
m_Animancer.Play(m_GroundLocomotion);
m_BehaviourTree = new BehaviourTree("Zombie Behaviour"); m_BehaviourTree = new BehaviourTree("Zombie Behaviour");
var rootSelector = new Selector("Root"); var rootSelector = new Selector("Root");
m_BehaviourTree.AddChild(rootSelector); m_BehaviourTree.AddChild(rootSelector);
var attackPlayerSequence = new Sequence("Attack Player", rootSelector.AddChild(CreateNormalSequence());
() => m_PlayerTarget != null); }
rootSelector.AddChild(attackPlayerSequence);
BehaviourNode CreateNormalSequence() {
var normalSequence = new Sequence("Normal", () => Mind == MindState.Normal);
normalSequence.AddChild(new Leaf("Pick Victim", new ZombiePickVictim()));
var attackPlayerSequence = new Sequence("Attack Player", IsVictimPlayer);
normalSequence.AddChild(attackPlayerSequence);
attackPlayerSequence.AddChild(new Leaf("Go to Player", new ZombieGoToPlayer()));
var attackMotherSequence = new Sequence("Attack Mother", IsVictimMother);
normalSequence.AddChild(attackMotherSequence);
return normalSequence;
} }
// //
@@ -134,8 +196,11 @@ namespace RebootReality.jelycho.Enemies {
return; return;
} }
float velXZ = m_NavAgent.velocity.With(y: 0).magnitude; float3 vel = m_NavAgent.velocity;
// m_Animator.SetFloat(s_MovementSpeedHash, velXZ); float forwardVelocity = math.dot(m_NavAgent.transform.forward, vel);
float rightVelocity = math.dot(m_NavAgent.transform.right, vel);
m_SmoothLocomotionDirection.TargetValue = new Vector2(rightVelocity, forwardVelocity);
} }
public override void OnServerTick(float deltaTime) { public override void OnServerTick(float deltaTime) {
@@ -146,107 +211,71 @@ namespace RebootReality.jelycho.Enemies {
return; return;
} }
m_BehaviourTree.Process(deltaTime); if (HasTravelDestination) {
return; float3 pos = transform.position;
switch (m_State) { if (math.distancesq(pos, TravelDestination) <= 1.0f) {
case AIState.Idle: { HasTravelDestination = false;
ServerTickIdle(deltaTime); m_NavAgent.isStopped = true;
break; }
} }
case AIState.AttackBase: { m_BehaviourTree.Process(this, deltaTime);
ServerTickAttackBase(deltaTime);
break;
}
case AIState.AttackCharacter: {
ServerTickAttackCharacter(deltaTime);
break;
}
case AIState.PanicEscape: {
break;
}
case AIState.Berserk: {
ServerTickBerserk(deltaTime);
break;
}
}
} }
// //
// @MARK: Zombie // @MARK: Zombie
// //
void ServerTickIdle(float dt) { public bool GoTo(float3 pos) {
(PlayerActor playerActor, float distSqToPlayer) = FindClosestPlayerActor(transform.position); if (!RR.IsServer()) {
if (playerActor == null || distSqToPlayer >= m_LoseInterestMinDistance * m_LoseInterestMinDistance) { s_Logger.Error("Only server can call GoTo");
return; return false;
} }
m_State = AIState.AttackCharacter; TravelDestination = pos;
m_PlayerTarget = playerActor; HasTravelDestination = true;
s_Logger.Info($"Found player actor to attack: {m_PlayerTarget}");
m_NavAgent.SetDestination(m_PlayerTarget.transform.position);
m_NavAgent.isStopped = false; m_NavAgent.isStopped = false;
return m_NavAgent.SetDestination(TravelDestination);
} }
void ServerTickAttackCharacter(float dt) { public bool IsVictimPlayer() {
if (m_PlayerTarget == null || !m_PlayerTarget.IsAlive()) { return Victim is PlayerActor;
SetIdleState();
return;
}
float3 playerPos = m_PlayerTarget.transform.position;
float3 zombiePos = transform.position;
float distToPlayerSq = math.distancesq(playerPos, zombiePos);
if (distToPlayerSq >= m_LoseInterestMinDistance * m_LoseInterestMinDistance) {
SetIdleState();
return;
}
if (distToPlayerSq <= m_MaxAttackDistance * m_MaxAttackDistance) {
m_NextAttackTimer -= dt;
if (m_NextAttackTimer <= 0.0f) {
// m_Animator.CrossFade("Attack_0", 0.0f, 0);
m_NextAttackTimer = m_AttackDelay;
}
if (!m_NavAgent.isStopped) {
m_NavAgent.isStopped = true;
}
return;
}
float distFromDstToTargetSq = math.distancesq(playerPos, m_NavAgent.destination);
if (distFromDstToTargetSq > 1.0f) {
m_NavAgent.isStopped = false;
m_NavAgent.SetDestination(m_PlayerTarget.transform.position);
}
} }
void ServerTickAttackBase(float dt) { public bool IsVictimMother() {
return Victim is MotherActor;
} }
void ServerTickBerserk(float dt) { public Actor FindNewVictim() {
if (!RR.IsServer()) {
s_Logger.Error("Only server can call FindNewVictim");
return null;
}
Victim = null;
(PlayerActor playerActor, float distSqToPlayer) = FindClosestPlayerActor(transform.position);
if (playerActor != null && distSqToPlayer < m_LoseInterestMinDistance * m_LoseInterestMinDistance) {
Victim = playerActor;
return Victim;
}
if (RR.World.Context is WorldContext ctx) {
Victim = ctx.BaseManager.Mother;
return Victim;
}
return null;
} }
void SetIdleState() { public void PerformAttack() {
m_PlayerTarget = null; m_Animancer.Play(m_AttackClips.Random());
m_State = AIState.Idle;
} }
void Die() { void Die() {
s_Logger.Info("Die");
EnableRagdoll(); EnableRagdoll();
m_NavAgent.enabled = false; m_NavAgent.enabled = false;
m_State = AIState.Dead;
died.Invoke(); died.Invoke();
} }
@@ -281,7 +310,7 @@ namespace RebootReality.jelycho.Enemies {
} }
protected override void OnActorEventClient(ActorEvent actorEvent) { protected override void OnActorEventClient(ActorEvent actorEvent) {
ZombieActorEvents zombieEvent = (ZombieActorEvents) actorEvent.EventID; var zombieEvent = (ZombieActorEvents) actorEvent.EventID;
switch (zombieEvent) { switch (zombieEvent) {
case ZombieActorEvents.EnableRagdoll: { case ZombieActorEvents.EnableRagdoll: {
@@ -309,36 +338,15 @@ namespace RebootReality.jelycho.Enemies {
} }
// //
// @MARK: IKillable // @MARK: IHasHealth
// //
public ulong Health { get; private set; } = 100; public ulong Health { get; private set; } = 100;
public ulong MaxHealth { get; private set; } = 100;
public bool IsAlive() { public bool IsAlive() {
return Health > 0; return Health > 0;
} }
public ulong OnHit(Actor attacker, ulong damage) {
if (!RR.IsServer()) {
s_Logger.Error("OnHit can only be called on the server.");
return 0;
}
if (!IsAlive()) {
return 0;
}
s_Logger.Info($"Hit: {damage}");
damage = math.min(damage, Health);
Health -= damage;
if (Health <= 0) {
Die();
return damage;
}
return damage;
}
// //
// @MARK: damage? // @MARK: damage?
// //
@@ -348,7 +356,12 @@ namespace RebootReality.jelycho.Enemies {
} }
} }
public void ReceiveDamage(ulong damage, ZombieBodyPartType bodyPartType) { public void ReceiveBodyPartDamage(ulong damage, ZombieBodyPartType bodyPartType) {
if (!RR.IsServer()) {
s_Logger.Error("ReceiveBodyPartDamage can only be called on the server.");
return;
}
if (!IsAlive()) { if (!IsAlive()) {
return; return;
} }
@@ -358,10 +371,26 @@ namespace RebootReality.jelycho.Enemies {
return; return;
} }
bodyPart.HideParts(); bool isBodyPartDestroyed = Random.Range(0.0f, 1.0f) > 0.5f;
bodyPart.bloodStreamParticles.Play();
Die(); if (isBodyPartDestroyed) {
bodyPart.HideParts();
bodyPart.bloodStreamParticles.Play();
if (bodyPartType == ZombieBodyPartType.Head) {
damage = Health;
} else if (bodyPartType == ZombieBodyPartType.LeftLeg ||
bodyPartType == ZombieBodyPartType.RightLeg) {
}
}
damage = math.min(damage, Health);
Health -= damage;
if (Health <= 0) {
Die();
}
} }
public bool HasBodyPart(ZombieBodyPartType bodyPart) { public bool HasBodyPart(ZombieBodyPartType bodyPart) {

View File

@@ -1,10 +1,12 @@
using RebootKit.Engine.Main; using RebootKit.Engine.Main;
using RebootKit.Engine.Simulation; using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Damage;
using RebootReality.jelycho.Main;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using UnityEngine.Assertions; using UnityEngine.Assertions;
namespace RebootReality.jelycho.Enemies { namespace RebootReality.jelycho.Enemies.Zombie {
public class ZombieHurtbox : MonoBehaviour, IHurtbox { public class ZombieHurtbox : MonoBehaviour, IHurtbox {
public ZombieActor owner; public ZombieActor owner;
[SerializeField] ZombieBodyPartType m_BodyPart = ZombieBodyPartType.Body; [SerializeField] ZombieBodyPartType m_BodyPart = ZombieBodyPartType.Body;
@@ -18,7 +20,7 @@ namespace RebootReality.jelycho.Enemies {
return; return;
} }
owner.ReceiveDamage(damage, m_BodyPart); owner.ReceiveBodyPartDamage(damage, m_BodyPart);
if (RR.World.Context is WorldContext worldContext) { if (RR.World.Context is WorldContext worldContext) {
worldContext.FeedbacksManager.SpawnBloodSplash(worldHitPos); worldContext.FeedbacksManager.SpawnBloodSplash(worldHitPos);

Some files were not shown because too many files have changed in this diff Show More