feat: Main shader LOD detail map

This commit is contained in:
Alexandre Coirier
2026-06-02 07:55:45 +02:00
parent 2f3cd8dc7e
commit 713933b932
16 changed files with 2496 additions and 338 deletions
@@ -40,6 +40,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 2800000, guid: 2da59fbd756c92a4bb2018abf06c4e07, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -102,6 +106,7 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DetailSize: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
@@ -116,6 +121,7 @@ Material:
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _ProjectionBlend: 0.1
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
@@ -40,6 +40,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 2800000, guid: 2da59fbd756c92a4bb2018abf06c4e07, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -110,9 +114,12 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DetailSize: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FogMax: 7
- _FogMin: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
@@ -124,6 +131,7 @@ Material:
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _ProjectionBlend: 0.1
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
@@ -141,6 +149,7 @@ Material:
- _Surface: 0
- _Test: 0
- _TriplanarBlend: 0
- _VertexColor: 0
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 1
@@ -151,6 +160,7 @@ Material:
- _EmissionColor: {r: 256, g: 256, b: 256, a: 1}
- _Emission_intensity: {r: 128, g: 128, b: 128, a: 1}
- _Emissive_intensity: {r: 16, g: 16, b: 16, a: 1}
- _FogColor: {r: 1.8679246, g: 0.62325984, b: 0.25551805, a: 0.5686275}
- _GrainColor: {r: 1, g: 1, b: 1, a: 0.09803922}
- _HighlightColor: {r: 2.118547, g: 2.118547, b: 2.118547, a: 1}
- _ShadowColor: {r: 0.14117646, g: 0.16862747, b: 0.16470587, a: 1}
@@ -55,7 +55,7 @@ Material:
- _QueueControl: 0
- _QueueOffset: 0
m_Colors:
- _ColorA: {r: 1.244819, g: 0.500609, b: 0.2289997, a: 1}
- _ColorA: {r: 1.4980392, g: 0.6024425, b: 0.27558267, a: 1}
- _ColorB: {r: 0.7924528, g: 0.2773978, b: 0.09344961, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
@@ -28,25 +28,30 @@ void Fog_float
//float test = RidgedNoise3D(PositionWS, 10, 2, 2, .5);
float3 camPos = _WorldSpaceCameraPos.xyz;
float depth = distance(camPos, PositionWS);
float depthAtten = smoothstep(10, 100, depth);
float depthAtten = smoothstep(5, 30, depth);
float mask = smoothstep(0, lerp(.3, .1, depthAtten), PositionOS.y) * pow(smoothstep(1, .5, PositionOS.y), 2);
float t = _Time.y * .7;
float s = lerp(Scale.x, 1, .3);
float3 p = PositionWS;// - PivotWS;
p += float3(t, t * .2, t);
p += RidgedNoise3D(p - PivotWS * .9, .1, 3, 1.6, 1) * 3;
float noise = RidgedNoise3D(p - PivotWS * .9, .1, 5, 1.6, 1);
p += noise * 3;
float fog = FBMNoise3D((p - PivotWS * .5), 10 / s, 3, 1.5, .5);
float4 col = lerp(ColorA, ColorB, saturate(RidgedNoise3D((p - PivotWS * .7) * float3(1, 1.6, 1), 3 / s, 3, 1.6, 1)));
float4 col = lerp(ColorA, ColorB, saturate(RidgedNoise3D((p - PivotWS * .9) * float3(1, 1.6, 1), 3 / s, 3, 1.6, 1)));
float mask = smoothstep(0, lerp(.3, .1, depthAtten), PositionOS.y) * pow(smoothstep(1, .5, PositionOS.y - .15 + noise * .3), 2);
// Output
Output = col.rgb;
Alpha = lerp(fog, smoothstep(1, .5, PositionOS.y), depthAtten * mask) * lerp(.2, 1, smoothstep(0, 30, depth)) * mask * col.a;
Alpha = lerp(fog, smoothstep(1, .5, PositionOS.y), depthAtten * mask) * lerp(.2, 1, smoothstep(0, 15, depth)) * mask * col.a;
}
#endif
@@ -0,0 +1,75 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5120607745848675954
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: 10
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: M_ray_Omnissiah
m_Shader: {fileID: -6465566751694194690, guid: 41e1af50dce5647448137abb3f85e49b, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _SampleTexture2D_45427f0cc3994257be048fc580e65bba_Texture_1_Texture2D:
m_Texture: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
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:
- _Debug: 0
- _Demo: 0
- _IgnoreAtten: 1
- _Intendity: 0.828
- _Intensity: 1
- _Noise: 0.786
- _QueueControl: 0
- _QueueOffset: 0
- _Size: 3.92
- _Speed: 2
- _Stop: 1
- _UV: 0
m_Colors:
- _Color: {r: 10.556064, g: 0, b: 0.17448205, a: 0.105882354}
- _Direction: {r: 0, g: 0, b: 1, a: 0}
- _Size: {r: 3, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2f0a42f4b97d23e4599d257dabb0f97d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff