New Clouds In Game Scene

Implemented new raymarching shader in game scene
This commit is contained in:
Reinier Vens 2022-07-11 08:14:00 +01:00
commit cda321ba4a
27 changed files with 186 additions and 269 deletions

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 1.3
- _Depth: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832
@ -70,7 +70,7 @@ Material:
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Phase: 0
- _Power: 8
- _Power: 64
- _SinePower: 1.25
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 0.1
- _Depth: 0.05
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832

View file

@ -78,6 +78,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.39424297, b: 0.09900004, a: 1}
- _Color: {r: 1, g: 0.40000004, b: 0.100000024, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 139.4
- _Depth: 50
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 50
- _Depth: 150
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1

View file

@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Sector Patch Depth Large
m_Shader: {fileID: 4800000, guid: ccdbaf77577994d46b0e61c53d5dc4a9, type: 3}
m_Shader: {fileID: 4800000, guid: 0faec6a8d1d622042a127d413974b551, type: 3}
m_ShaderKeywords: B
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@ -57,12 +57,12 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Constant: -2.3
- _Constant: -29.6
- _Cutoff: 0.5
- _Depth: 10
- _Depth: 20
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 0.005
- _Frequency: 0.001
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1

View file

@ -57,12 +57,12 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Constant: -2.2
- _Constant: -5
- _Cutoff: 0.5
- _Depth: 11.4
- _Depth: 10
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 0.01
- _Frequency: 0.005
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1

View file

@ -57,12 +57,12 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Constant: -50
- _Constant: -51.6
- _Cutoff: 0.5
- _Depth: 100
- _Depth: 10
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 0.002
- _Frequency: 0.0002
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 0.25
- _Depth: 0.01
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832

View file

@ -86,7 +86,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Scale: 4.8001804
- _Scale: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View file

@ -10,10 +10,12 @@ float GetDensity(float3 startPos, float3 dir, float maxSampleDistance, float ray
[loop]
for (int j = 0; j < SAMPLE_COUNT; j++) {
float prevRayDist = raymarchDistance;
raymarchDistance = pow((j+raymarchOffset)/SAMPLE_COUNT,2) * maxSampleDistance;
raymarchDistance = pow((j+raymarchOffset)/SAMPLE_COUNT,2) * _ProjectionParams.z;
if(raymarchDistance > maxSampleDistance) break;
float step = raymarchDistance - prevRayDist;
float3 rayPos = startPos + dir * raymarchDistance;
IntegrateRaymarch(startPos, rayPos, dir, step, result);
float fade = smoothstep(_ProjectionParams.z*.75,_ProjectionParams.z*.95, raymarchDistance);
IntegrateRaymarch(startPos, rayPos, fade, step, result);
if (result.intTransmittance < 0.01f) {
result.intTransmittance = 0;
break;

View file

@ -45,8 +45,7 @@ Shader "Yangrc/CloudShader"
{
CGINCLUDE
float GetRaymarchEndFromSceneDepth(float sceneDepth) {
float raymarchEnd = 0.0f;
float GetRaymarchEndFromSceneDepth(float sceneDepth, out float raymarchEnd) {
#if ALLOW_CLOUD_FRONT_OBJECT
raymarchEnd = sceneDepth * _ProjectionParams.z; //raymarch to scene depth.
#else
@ -54,7 +53,7 @@ Shader "Yangrc/CloudShader"
//Note: In horizon:zero dawn, they clip some part using lod(use max operator) z-buffer.
//I don't implement here cause that's exactly what hi-z buffer does, and any production rendering pipeline should share a hi-z buffer by their own.
#endif
return raymarchEnd;
return sceneDepth<.99;
}
ENDCG
@ -126,7 +125,8 @@ Shader "Yangrc/CloudShader"
worldPos /= worldPos.w;
float sceneDepth = Linear01Depth(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos)).r);
float raymarchEnd = GetRaymarchEndFromSceneDepth(sceneDepth);
float raymarchEnd;
bool occluded = GetRaymarchEndFromSceneDepth(sceneDepth, raymarchEnd);
float3 viewDir = normalize(worldPos.xyz - _WorldSpaceCameraPos);
float2 screenPos = i.screenPos.xy / i.screenPos.w;
@ -142,8 +142,9 @@ Shader "Yangrc/CloudShader"
int iteration_count;
float density = HierarchicalRaymarch(worldPos, viewDir, raymarchEnd, offset, /*out*/intensity, /*out*/distance, /*out*/iteration_count);
#else
float density = GetDensity(worldPos, viewDir, raymarchEnd, offset, /*out*/intensity, /*out*/distance);
float density = GetDensity(_WorldSpaceCameraPos, viewDir, raymarchEnd, offset, /*out*/intensity, /*out*/distance);
#endif
if(!occluded) density = 1;
return float4(intensity, pack(distance, density));
}
@ -269,7 +270,7 @@ Shader "Yangrc/CloudShader"
}
}
//Code from https://zhuanlan.zhihu.com/p/64993622.
float gamma = 1.5f;
float gamma = 0.5f;
float4 mu = m1 / 9;
float4 sigma = sqrt(abs(m2 / 9 - mu * mu));
float4 minc = mu - gamma * sigma;
@ -277,7 +278,7 @@ Shader "Yangrc/CloudShader"
prevSample = ClipAABB(minc, maxc, prevSample);
//Blend
raymarchResult = lerp(float4(prevSample.rgb, density), float4(raymarchResult.rgb, density2), max(0.1f, outOfBound));
raymarchResult = lerp(float4(prevSample.rgb, density), float4(raymarchResult.rgb, density2), max(0.05f, outOfBound));
}
return raymarchResult;
}
@ -338,7 +339,7 @@ Shader "Yangrc/CloudShader"
half4 frag(v2f i) : SV_Target
{
float3 vspos = float3(i.vsray, 1.0);
float4 worldPos = mul(unity_CameraToWorld,float4(vspos,1.0));
//float4 worldPos = mul(unity_CameraToWorld,float4(vspos,1.0));
half4 mcol = tex2D(_MainTex,i.uv);
float4 currSample = tex2D(_CloudTex, i.uv);
@ -351,7 +352,7 @@ Shader "Yangrc/CloudShader"
float4 result;
result = currSample;
return half4(mcol.rgb * (1 - result.a) + result.rgb * result.a, 1);
return half4(mcol.rgb * (1 - result.a) + result.rgb, 1);
}
ENDCG
}

View file

@ -290,7 +290,7 @@ void InitRaymarchStatus(inout RaymarchStatus result){
result.depth = 0.0f;
}
void IntegrateRaymarch(float3 startPos, float3 rayPos, float3 viewdir, float stepsize, inout RaymarchStatus result){
void IntegrateRaymarch(float3 startPos, float3 rayPos, float fade, float stepsize, inout RaymarchStatus result){
float4 c = VolumeSampleColor(rayPos);
float density = c.a;//SampleDensity(rayPos, 0, false, wetness);
if (density <= 0.0f)
@ -299,8 +299,8 @@ void IntegrateRaymarch(float3 startPos, float3 rayPos, float3 viewdir, float ste
float clampedExtinction = max(extinction, 1e-7);
float transmittance = exp(-extinction * stepsize);
float3 luminance = c.rgb;//SampleEnergy(rayPos, viewdir);
float3 luminance = c.rgb * (1-fade);//SampleEnergy(rayPos, viewdir);
float3 integScatt = (luminance - luminance * transmittance) / clampedExtinction;
float depthWeight = result.intTransmittance * (1-transmittance); //Is it a better idead to use (1-transmittance) * intTransmittance as depth weight?

BIN
Assets/Resources/Settings.asset (Stored with Git LFS)

Binary file not shown.

BIN
Assets/Resources/Volume Settings.asset (Stored with Git LFS)

Binary file not shown.

View file

@ -5177,7 +5177,7 @@ MonoBehaviour:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 4096
FarClipPlane: 2048
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:
@ -13660,7 +13660,7 @@ MonoBehaviour:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 8192
FarClipPlane: 4096
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:
@ -15934,6 +15934,7 @@ GameObject:
- component: {fileID: 1009503731}
- component: {fileID: 1009503735}
- component: {fileID: 1009503736}
- component: {fileID: 1009503728}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
@ -15941,6 +15942,19 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1009503728
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1009503727}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13f1fa636e0245e42be783568a76e3d6, type: 3}
m_Name:
m_EditorClassIdentifier:
NoiseTexture: {fileID: 2800000, guid: 7c0a392de8821f345824a79dea0d0d41, type: 3}
--- !u!114 &1009503729
MonoBehaviour:
m_ObjectHideFlags: 0
@ -16062,7 +16076,7 @@ MonoBehaviour:
- {fileID: 2095741464}
FogMaterial: {fileID: 2100000, guid: 2ff39f5d101241043ba1dcde19d92f77, type: 2}
FogFarFadeFraction: 0.125
FarPlaneDistanceMultiplier: 2
FarPlaneDistanceMultiplier: 1
AsteroidMeshes:
- Mesh: {fileID: 4300004, guid: bdb4c719a85f3f2419f6c573dd1daf15, type: 3}
Material: {fileID: 2100000, guid: ce975d2d2ccd0914b9260b7d66319aaa, type: 2}
@ -16167,17 +16181,17 @@ MonoBehaviour:
TargetCamera: {fileID: 2115559089}
ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3}
ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2}
Span: 256
Speed: -0.25
MinimumSize: 0.0025
MaximumSize: 0.005
Spacing: 1.5
Ceiling: -430
Floor: -50
HeightExponent: 100000
Span: 128
Speed: -0.15
MinimumSize: 0
MaximumSize: 0.5
Spacing: 6
Ceiling: -200
Floor: -40
HeightExponent: 1000000
NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
NebulaPatchHeight: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2}
NebulaPatch: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2}
NebulaPatchHeight: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2}
NebulaPatch: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2}
NebulaTint: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2}
Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3}
@ -30679,7 +30693,6 @@ GameObject:
- component: {fileID: 2115559092}
- component: {fileID: 2115559093}
- component: {fileID: 2115559094}
- component: {fileID: 2115559095}
- component: {fileID: 2115559088}
m_Layer: 0
m_Name: Main Camera
@ -30697,11 +30710,20 @@ MonoBehaviour:
m_GameObject: {fileID: 2115559087}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ae335524e949404bb57f1612ec4b9b5, type: 3}
m_Script: {fileID: 11500000, guid: 9f1db61281524fb40bc9a1f6acce6baf, type: 3}
m_Name:
m_EditorClassIdentifier:
isDefaultListener: 1
listenerId: 0
configuration: {fileID: 11400000, guid: a15886e93ac3e7847861da392782f13d, type: 2}
downSample: 0
quality: 0
allowCloudFrontObject: 1
useApSystem: 0
useHierarchicalHeightMap: 0
cloudShader: {fileID: 4800000, guid: 84e97169589c5e94e8521fe4deb2e3f8, type: 3}
heightPreprocessShader: {fileID: 7200000, guid: 40276bd53f35a694e8d4e025ca310775,
type: 3}
cloudHeightProcessShader: {fileID: 4800000, guid: b80bf04ca56d3d642a6b925cff3f5ddf,
type: 3}
--- !u!20 &2115559089
Camera:
m_ObjectHideFlags: 0
@ -30726,7 +30748,7 @@ Camera:
width: 1
height: 1
near clip plane: 0.3
far clip plane: 4096
far clip plane: 2048
field of view: 60
orthographic: 0
orthographic size: 5
@ -30779,7 +30801,7 @@ MonoBehaviour:
finalBlitToCameraTarget: 0
antialiasingMode: 3
temporalAntialiasing:
jitterSpread: 1
jitterSpread: 0.1
sharpness: 0
stationaryBlending: 0.99
motionBlending: 0.99
@ -30889,28 +30911,6 @@ MonoBehaviour:
_shader: {fileID: 4800000, guid: 2d020ca820b3647479e78b8c3d26e3a6, type: 3}
_downSampleMode: 2
_iteration: 4
--- !u!114 &2115559095
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2115559087}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f27db6b94e477054e96392f94dc50c9d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_listeners:
initialListenerList: []
useDefaultListeners: 1
isEnvironmentAware: 0
isStaticObject: 0
m_positionOffsetData:
KeepMe: 0
positionOffset: {x: 0, y: 0, z: 0}
m_posOffsetData: {fileID: 0}
listenerMask: 1
--- !u!1 &2117796865
GameObject:
m_ObjectHideFlags: 0

Binary file not shown.

Binary file not shown.

View file

@ -399,14 +399,14 @@ MonoBehaviour:
m_LookaheadIgnoreY: 0
m_HorizontalDamping: 0.5
m_VerticalDamping: 0.5
m_ScreenX: 0.6
m_ScreenY: 0.44
m_ScreenX: 0.45
m_ScreenY: 0.45
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_SoftZoneWidth: 0.8
m_SoftZoneHeight: 0.8
m_BiasX: -0.00000007450581
m_BiasY: -0.00000007450581
m_BiasX: -0.000000074505806
m_BiasY: -0.000000074505806
m_CenterOnActivate: 1
--- !u!114 &412917869
MonoBehaviour:
@ -440,17 +440,17 @@ MonoBehaviour:
m_YDamping: 0
m_ZDamping: 0
m_TargetMovementOnly: 0
m_ScreenX: 0.4
m_ScreenY: 0.85
m_CameraDistance: 225
m_ScreenX: 0.75
m_ScreenY: 0.75
m_CameraDistance: 381.18
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_DeadZoneDepth: 0
m_UnlimitedSoftZone: 0
m_SoftZoneWidth: 0.8
m_SoftZoneHeight: 0.8
m_BiasX: -0.0000000372529
m_BiasY: -0.00000007450581
m_BiasX: 0
m_BiasY: -0.000000074505806
m_CenterOnActivate: 1
m_GroupFramingMode: 2
m_AdjustmentMode: 0
@ -784,7 +784,7 @@ MonoBehaviour:
FieldOfView: 35
OrthographicSize: 5
NearClipPlane: 1
FarClipPlane: 2048
FarClipPlane: 1024
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:
@ -802,8 +802,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 741153267}
m_LocalRotation: {x: 0.312603, y: 0.53486377, z: -0.22206932, w: 0.75291795}
m_LocalPosition: {x: -283.46375, y: 64.4197, z: -64.52852}
m_LocalRotation: {x: 0.24134962, y: 0.7351235, z: -0.5426147, w: 0.32697564}
m_LocalPosition: {x: -144.21849, y: 325.46454, z: 116.09439}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 412917866}
@ -820,6 +820,8 @@ GameObject:
m_Component:
- component: {fileID: 750375534}
- component: {fileID: 750375535}
- component: {fileID: 750375537}
- component: {fileID: 750375536}
m_Layer: 0
m_Name: Manager
m_TagString: Untagged
@ -857,14 +859,14 @@ MonoBehaviour:
TargetCamera: {fileID: 965376323}
ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3}
ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2}
Span: 256
Speed: -0.25
Span: 128
Speed: -0.05
MinimumSize: 0
MaximumSize: 1
Spacing: 2
Ceiling: 0
Floor: 200
HeightExponent: 100000
MaximumSize: 0.5
Spacing: 6
Ceiling: 200
Floor: -50
HeightExponent: 1000000
NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
NebulaPatchHeight: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2}
NebulaPatch: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2}
@ -872,6 +874,32 @@ MonoBehaviour:
Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3}
GravityCamera: {fileID: 2103364771}
--- !u!114 &750375536
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 750375533}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13f1fa636e0245e42be783568a76e3d6, type: 3}
m_Name:
m_EditorClassIdentifier:
NoiseTexture: {fileID: 2800000, guid: 7c0a392de8821f345824a79dea0d0d41, type: 3}
--- !u!114 &750375537
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 750375533}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7c5a918e14b16a544a71c29614632602, type: 3}
m_Name:
m_EditorClassIdentifier:
MusicSoundbankName: Main_Menu
--- !u!1 &765320284
GameObject:
m_ObjectHideFlags: 0
@ -1066,7 +1094,7 @@ PrefabInstance:
- target: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309,
type: 3}
propertyPath: m_LocalPosition.y
value: -130
value: -56.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 046dde0f4600bce41ad33c476f99b309, type: 3}
@ -1086,10 +1114,6 @@ GameObject:
m_Component:
- component: {fileID: 850359437}
- component: {fileID: 850359436}
- component: {fileID: 850359438}
- component: {fileID: 850359441}
- component: {fileID: 850359439}
- component: {fileID: 850359440}
m_Layer: 0
m_Name: Persist
m_TagString: Untagged
@ -1123,83 +1147,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &850359438
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850359435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4eab75687879a445a2a2397d86a2172, type: 3}
m_Name:
m_EditorClassIdentifier:
InitializationSettings: {fileID: 11400000, guid: ca1886ece3dfc5e49902e78defccd355,
type: 2}
basePath:
language:
defaultPoolSize: 0
lowerPoolSize: 0
streamingPoolSize: 0
memoryCutoffThreshold: 0
monitorPoolSize: 0
monitorQueuePoolSize: 0
callbackManagerBufferSize: 0
spatialAudioPoolSize: 0
maxSoundPropagationDepth: 0
engineLogging: 0
--- !u!114 &850359439
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850359435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7c5a918e14b16a544a71c29614632602, type: 3}
m_Name:
m_EditorClassIdentifier:
MusicSoundbankName: Main_Menu
--- !u!114 &850359440
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850359435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13f1fa636e0245e42be783568a76e3d6, type: 3}
m_Name:
m_EditorClassIdentifier:
NoiseTexture: {fileID: 2800000, guid: 7c0a392de8821f345824a79dea0d0d41, type: 3}
--- !u!114 &850359441
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850359435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1f1a89fa3598c644a67edc70006ab8b, type: 3}
m_Name:
m_EditorClassIdentifier:
triggerList: ae8d9d44f7e1664c
useOtherObject: 0
data:
idInternal: 0
valueGuidInternal:
WwiseObjectReference: {fileID: 11400000, guid: 1f7596d26fd55df42a4027d547caa78a,
type: 2}
decodeBank: 0
loadAsynchronous: 0
saveDecodedBank: 0
unloadTriggerList: 958ca0ea
bankNameInternal:
valueGuidInternal:
--- !u!1 &965376321
GameObject:
m_ObjectHideFlags: 0
@ -1210,8 +1157,6 @@ GameObject:
m_Component:
- component: {fileID: 965376324}
- component: {fileID: 965376323}
- component: {fileID: 965376327}
- component: {fileID: 965376326}
- component: {fileID: 965376325}
- component: {fileID: 965376322}
- component: {fileID: 965376328}
@ -1281,7 +1226,7 @@ Camera:
width: 1
height: 1
near clip plane: 1
far clip plane: 2048
far clip plane: 1024
field of view: 35
orthographic: 0
orthographic size: 5
@ -1307,8 +1252,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965376321}
m_LocalRotation: {x: 0.312603, y: 0.53486377, z: -0.22206932, w: 0.75291795}
m_LocalPosition: {x: -283.46375, y: 64.4197, z: -64.52852}
m_LocalRotation: {x: 0.24134962, y: 0.7351235, z: -0.5426147, w: 0.32697564}
m_LocalPosition: {x: -144.21849, y: 325.46454, z: 116.09439}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -1334,7 +1279,7 @@ MonoBehaviour:
finalBlitToCameraTarget: 0
antialiasingMode: 3
temporalAntialiasing:
jitterSpread: 1
jitterSpread: 0.1
sharpness: 0.5
stationaryBlending: 0.975
motionBlending: 0.95
@ -1376,42 +1321,6 @@ MonoBehaviour:
- assemblyQualifiedName: UnityEngine.Rendering.PostProcessing.DepthOfField, Assembly-CSharp,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_AfterStackBundles: []
--- !u!114 &965376326
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965376321}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ae335524e949404bb57f1612ec4b9b5, type: 3}
m_Name:
m_EditorClassIdentifier:
isDefaultListener: 1
listenerId: 0
--- !u!114 &965376327
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965376321}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f27db6b94e477054e96392f94dc50c9d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_listeners:
initialListenerList: []
useDefaultListeners: 1
isEnvironmentAware: 0
isStaticObject: 0
m_positionOffsetData:
KeepMe: 0
positionOffset: {x: 0, y: 0, z: 0}
m_posOffsetData: {fileID: 0}
listenerMask: 1
--- !u!114 &965376328
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1762,7 +1671,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1362573162}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -206, z: 0}
m_LocalPosition: {x: 0, y: -214, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}

View file

@ -58,22 +58,22 @@ public class MapView : MonoBehaviour
void SetZoom()
{
ZoneRenderer.ViewDistance = _viewDistance * _aspectRatio;
//ZoneRenderer.ViewDistance = _viewDistance * _aspectRatio;
Minimap.orthographicSize = MinimapGravity.orthographicSize = _viewDistance;
_gravityRendererTransform.localScale = new Vector3(_viewDistance*_aspectRatio*2, _viewDistance*2, 1);
}
public void BindInput(AetheriaInput.UIActions input)
{
_input = input;
_input.ScrollWheel.performed += OnScroll;
}
// public void BindInput(AetheriaInput.UIActions input)
// {
// _input = input;
// _input.ScrollWheel.performed += OnScroll;
// }
private void OnScroll(InputAction.CallbackContext context)
{
_viewDistance *= (1 - context.ReadValue<Vector2>().y * ZoomSpeed);
SetZoom();
}
// private void OnScroll(InputAction.CallbackContext context)
// {
// _viewDistance *= (1 - context.ReadValue<Vector2>().y * ZoomSpeed);
// SetZoom();
// }
void Update()
{
@ -96,7 +96,7 @@ public class MapView : MonoBehaviour
private void OnDisable()
{
_input.ScrollWheel.performed -= OnScroll;
// _input.ScrollWheel.performed -= OnScroll;
Main.gameObject.SetActive(true);
_minimapGravityCopyTransform.enabled = true;

View file

@ -23,7 +23,7 @@ public class VolumeSampling : MonoBehaviour
//public int DownsampleBlurMask = 2;
private Camera _camera;
private RenderBuffer[] _mrt;
private RenderTexture _blurMask;
private Texture2D _blurMask;
private Texture2D _disabledBlurMask;
private float _flowScroll;
@ -40,15 +40,13 @@ public class VolumeSampling : MonoBehaviour
//Debug.Log($"Supported MRT count: {SystemInfo.supportedRenderTargetCount}");
_camera = GetComponent<Camera>();
_mrt = new RenderBuffer[2];
_blurMask = new RenderTexture(Screen.width, Screen.height, 0, GraphicsFormat.R8_UNorm);
//_blurMask = new RenderTexture(Screen.width, Screen.height, 0, GraphicsFormat.R8_UNorm);
_blurMask = Color.white.ToTexture();
_disabledBlurMask = Color.black.ToTexture();
}
private void OnPreRender()
{
// Shader needs this matrix to generate world space rays
Shader.SetGlobalMatrix("_CamProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
Shader.SetGlobalMatrix("_CamInvProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
}
//[ImageEffectOpaque]
@ -66,6 +64,9 @@ public class VolumeSampling : MonoBehaviour
if(GridTransform != null)
Shader.SetGlobalVector("_GridTransform", new Vector4(GridTransform.position.x,GridTransform.position.z,GridTransform.localScale.x));
//
// Shader needs this matrix to generate world space rays
// Shader.SetGlobalMatrix("_CamProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
// Shader.SetGlobalMatrix("_CamInvProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
// _mrt[0] = destination.colorBuffer;
// _mrt[1] = _blurMask.colorBuffer;
//
@ -87,7 +88,6 @@ public class VolumeSampling : MonoBehaviour
Shader.SetGlobalTexture("_NebulaTint", NebulaTint);
Shader.SetGlobalFloat("_NebulaFillDensity", Settings.DefaultEnvironment.Nebula.FillDensity);
Shader.SetGlobalFloat("_SafetyDistance", Settings.DefaultEnvironment.Nebula.FillDistance);
Shader.SetGlobalFloat("_NebulaFloorDensity", Settings.DefaultEnvironment.Nebula.FloorDensity);
Shader.SetGlobalFloat("_NebulaPatchDensity", Settings.DefaultEnvironment.Nebula.PatchDensity);
Shader.SetGlobalFloat("_NebulaFloorOffset", Settings.DefaultEnvironment.Nebula.FloorOffset);

View file

@ -439,12 +439,12 @@ public class ZoneRenderer : MonoBehaviour
loot.ViewDirection = PerspectiveEntity.LookDirection;
}
if (SlimeRenderer.SpawnPositions.Length != _suns.Length)
SlimeRenderer.SpawnPositions = new Vector2[_suns.Length];
for (var i = 0; i < _suns.Length; i++)
{
SlimeRenderer.SpawnPositions[i] = _suns[i].Body.transform.position.Flatland();
}
// if (SlimeRenderer.SpawnPositions.Length != _suns.Length)
// SlimeRenderer.SpawnPositions = new Vector2[_suns.Length];
// for (var i = 0; i < _suns.Length; i++)
// {
// SlimeRenderer.SpawnPositions[i] = _suns[i].Body.transform.position.Flatland();
// }
foreach (var belt in Zone.AsteroidBelts)
{
@ -518,8 +518,8 @@ public class ZoneRenderer : MonoBehaviour
var depthRange = Settings.PlanetSettings.ZoneDepth - startDepth + _maxDepth;
// MinimapGravityQuad.material.SetFloat("_StartDepth", startDepth);
// MinimapGravityQuad.material.SetFloat("_DepthRange", depthRange);
FogMaterial.SetFloat("_GridOffset", Settings.PlanetSettings.ZoneBoundaryFog);
FogMaterial.SetVector("_GridTransform", new Vector4(fogPos.x, fogPos.z, _viewDistance * 2));
Shader.SetGlobalFloat("_GridOffset", Settings.PlanetSettings.ZoneBoundaryFog);
Shader.SetGlobalVector("_GridTransform", new Vector4(fogPos.x, fogPos.z, _viewDistance * 2));
// var gravPos = MinimapGravityQuad.transform.position;
// gravPos.y = -Settings.PlanetSettings.ZoneDepth - _maxDepth;
// MinimapGravityQuad.transform.position = gravPos;

View file

@ -127,15 +127,15 @@ void UpdateParticles(uint3 id : SV_DispatchThreadID, int3 groupID : SV_GroupThre
x * spacing + xt * spacing + perlinNoise1D(RandomValue()*1024)*spacing, 0,
y * spacing + yt * spacing + perlinNoise1D(RandomValue()*1024)*spacing);
const float2 puv = float2(.5,.5) - (particles[id.x].position.xz - _GridTransform.xy) / _GridTransform.z;
const float gravDepth = Heightmap.SampleLevel(samplerHeightmap, puv, 0.0f).r + _NebulaFloorOffset;
const float headroom = ceilingHeight + gravDepth;
particles[id.x].position.y = -gravDepth + floorHeight + headroom *
const float gravHeight = -Heightmap.SampleLevel(samplerHeightmap, puv, 0.0f).r + _NebulaFloorOffset;
const float headroom = ceilingHeight - gravHeight;
particles[id.x].position.y = gravHeight + floorHeight + headroom *
pow(RandomValue(), max(1, heightExponent/(headroom*headroom))) +
perlinNoise1D(RandomValue()*1024)*spacing/2;
float noise;
const float3 flowDir = flow(particles[id.x].position, noise);
particles[id.x].position += flowDir * (lifetime * noise);
const float density = pow(d(particles[id.x].position) + .01, .25);
const float density = pow(f(particles[id.x].position) + .01, 0.15);
particles[id.x].size = lerp(minimumSize, maximumSize, saturate(RandomValue() * density)) * parabola(lifetime, 2);
particles[id.x].color = HueTexture.SampleLevel(samplerHueTexture, float2(RandomValue(), 0.0f), 0.0f).rgb * density;
}

View file

@ -60,10 +60,10 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DistanceIntensityExponent: 1
- _DistanceSizeExponent: 0.1
- _DistanceIntensityExponent: 3.5
- _DistanceSizeExponent: 0.5
- _DstBlend: 0
- _EmissionGain: 0.156
- _EmissionGain: 0.268
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
@ -71,7 +71,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Power: 0.5
- _Power: 1
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
@ -80,5 +80,5 @@ Material:
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 5.992157, g: 5.992157, b: 5.992157, a: 1}
- _TintColor: {r: 1.4980392, g: 1.4980392, b: 1.4980392, a: 1}
m_BuildTextureStacks: []

View file

@ -65,7 +65,7 @@
o.uv = quadPoints[id] + 0.5f;
//transfer color of particle and global tint to vertex
o.color = float4(particles[inst].color, 1) * _TintColor * pow(100, _DistanceIntensityExponent) / pow(dist, _DistanceIntensityExponent);
o.color = float4(particles[inst].color * _TintColor.rgb, 100 * pow(100, _DistanceIntensityExponent) / pow(dist, _DistanceIntensityExponent));
o.screenPos = ComputeScreenPos(o.pos);
return o;
@ -144,7 +144,7 @@
o.uv = quadPoints[id] + 0.5f;
//transfer color of particle and global tint to vertex
o.color = float4(particles[inst].color * _TintColor.rgb, pow(100, _DistanceIntensityExponent) / pow(dist, _DistanceIntensityExponent));
o.color = float4(particles[inst].color * _TintColor.rgb, 100 * pow(100, _DistanceIntensityExponent) / pow(dist, _DistanceIntensityExponent));
o.screenPos = ComputeScreenPos(o.pos);
return o;

View file

@ -92,13 +92,18 @@ float parabola( float x, float k )
return pow( 4.0*x*(1.0-x), k );
}
float2 getUV(float3 pos)
{
return -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5);
}
float f(float3 pos)
{
float2 uv = -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5);
float2 uv = getUV(pos);
const float surfaceDisp = tex2Dlod(_NebulaSurfaceHeight, half4(uv, 0, 0)).r;
const float dist = pos.y + surfaceDisp - _NebulaFloorOffset;
const float fillDensity = smoothstep(_SafetyDistance,0,dist) * _NebulaFillDensity;
const float fillDensity = smoothstep(min(_SafetyDistance,surfaceDisp),0,dist) * _NebulaFillDensity;
if(dist < _SafetyDistance)
{
@ -172,8 +177,8 @@ float d(float3 pos)
pos.y += (noise1 + noise2);
const float lerp3 = frac(_Time.x * _FlowSpeed * 2);
const float lerp4 = frac(_Time.x * _FlowSpeed * 2 + .5);
const float noise3 = pow(triNoise3d((pos-fl * lerp3) / _NoiseScale * 2), _NoiseExponent) * _NoiseAmplitude * tri2(lerp3) / 2;
const float noise4 = pow(triNoise3d((pos-fl * lerp4) / _NoiseScale * 2), _NoiseExponent) * _NoiseAmplitude * tri2(lerp4) / 2;
const float noise3 = pow(triNoise3d((pos+fl * lerp3) / _NoiseScale * 2), _NoiseExponent) * _NoiseAmplitude * tri2(lerp3) / 2;
const float noise4 = pow(triNoise3d((pos+fl * lerp4) / _NoiseScale * 2), _NoiseExponent) * _NoiseAmplitude * tri2(lerp4) / 2;
pos.y -= (noise3 + noise4);
return f(pos);
}
@ -182,12 +187,12 @@ float4 VolumeSampleColor(float3 pos)
{
float density = d(pos);
float clampedDensity = max(.01,density);
float2 uv = -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5);
float3 tint = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, 1 / pow(clampedDensity, _TintLodExponent)));
float2 uv = getUV(pos);
float3 tint = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, pow(clampedDensity, _TintLodExponent)));
//float2 tintGrad = tintGradient(pos, uv, 1 / pow(density, .25), tint);
//float3 tintNormal = normalize(float3(tintGrad.x, 0, tintGrad.y));
//tint *= abs(dot(normal, float3(0,-1,0)));
// pow(abs(1-density), _TintExponent)
const float albedo = smoothstep(0,-250,pos.y) * pow(1/clampedDensity, _TintExponent) * _NebulaLuminance;
const float albedo = smoothstep(0,-250,pos.y) * pow(clampedDensity, _TintExponent) * _NebulaLuminance;
return float4(albedo*tint, density);
}

BIN
GameData/PlayerSettings.msgpack (Stored with Git LFS)

Binary file not shown.