Sky Glow + More Nebula Tweaking

This commit is contained in:
Reinier Vens 2022-07-13 01:53:59 +01:00
commit e585a8c3b1
16 changed files with 38 additions and 37 deletions

View file

@ -57,7 +57,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Constant: -5
- _Constant: 0
- _Cutoff: 0.5
- _Depth: 10
- _DetailNormalMapScale: 1

View file

@ -57,7 +57,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Constant: -30
- _Constant: -1
- _Cutoff: 0.5
- _Depth: 10
- _DetailNormalMapScale: 1

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 1
- _Depth: 0.01
- _Depth: 0.025
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832
@ -78,6 +78,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.85, g: 0.92980295, b: 1, a: 1}
- _Color: {r: 0.496, g: 0.5813884, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

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

View file

@ -343,16 +343,8 @@ Shader "Yangrc/CloudShader"
half4 mcol = tex2D(_MainTex,i.uv);
float4 currSample = tex2D(_CloudTex, i.uv);
// float distance;
// float density;
// unpack(currSample.a, distance, density);
// float packed = pack(1,1);
// unpack(packed, distance, density);
float4 result;
result = currSample;
return half4(mcol.rgb * (1 - result.a) + result.rgb, 1);
return half4(mcol.rgb * (1 - currSample.a) + currSample.rgb, 1);
}
ENDCG
}

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

Binary file not shown.

View file

@ -16181,13 +16181,13 @@ MonoBehaviour:
TargetCamera: {fileID: 2115559089}
ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3}
ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2}
Span: 128
Speed: -0.15
Span: 256
Speed: -0.5
MinimumSize: 0
MaximumSize: 0.75
MaximumSize: 0.5
Spacing: 6
Ceiling: -300
Floor: -20
Ceiling: -250
Floor: -25
HeightExponent: 100000
NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
NebulaPatchHeight: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2}
@ -30715,7 +30715,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
configuration: {fileID: 11400000, guid: a15886e93ac3e7847861da392782f13d, type: 2}
downSample: 0
quality: 0
quality: 2
allowCloudFrontObject: 1
useApSystem: 0
useHierarchicalHeightMap: 0

Binary file not shown.

Binary file not shown.

View file

@ -1354,7 +1354,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
configuration: {fileID: 11400000, guid: a15886e93ac3e7847861da392782f13d, type: 2}
downSample: 0
quality: 0
quality: 2
allowCloudFrontObject: 1
useApSystem: 0
useHierarchicalHeightMap: 0

View file

@ -19,6 +19,8 @@ public class NebulaSettings
{
[JsonProperty("fillDensity"), Key(0)] public float FillDensity;
[JsonProperty("fillDistance"), Key(1)] public float FillDistance;
[JsonProperty("fillExponent"), Key(11)] public float FillExponent;
[JsonProperty("fillOffset"), Key(12)] public float FillOffset;
[JsonProperty("fogDensity"), Key(2)] public float FloorDensity;
[JsonProperty("cloudDensity"), Key(3)] public float PatchDensity;
[JsonProperty("fogOffset"), Key(4)] public float FloorOffset;

View file

@ -88,6 +88,9 @@ public class VolumeSampling : MonoBehaviour
Shader.SetGlobalTexture("_NebulaTint", NebulaTint);
Shader.SetGlobalFloat("_NebulaFillDensity", Settings.DefaultEnvironment.Nebula.FillDensity);
Shader.SetGlobalFloat("_NebulaFillDistance", Settings.DefaultEnvironment.Nebula.FillDistance);
Shader.SetGlobalFloat("_NebulaFillExponent", Settings.DefaultEnvironment.Nebula.FillExponent);
Shader.SetGlobalFloat("_NebulaFillOffset", Settings.DefaultEnvironment.Nebula.FillOffset);
Shader.SetGlobalFloat("_NebulaFloorDensity", Settings.DefaultEnvironment.Nebula.FloorDensity);
Shader.SetGlobalFloat("_NebulaPatchDensity", Settings.DefaultEnvironment.Nebula.PatchDensity);
Shader.SetGlobalFloat("_NebulaFloorOffset", Settings.DefaultEnvironment.Nebula.FloorOffset);

View file

@ -135,7 +135,7 @@ void UpdateParticles(uint3 id : SV_DispatchThreadID, int3 groupID : SV_GroupThre
float noise;
const float3 flowDir = flow(particles[id.x].position, noise);
particles[id.x].position += flowDir * (lifetime * noise);
const float d = pow(density(particles[id.x].position) + .01, 0.15);
particles[id.x].size = lerp(minimumSize, maximumSize, saturate(RandomValue() * d)) * parabola(lifetime, 2);
const float d = pow(density(particles[id.x].position) + .01, 0.1);
particles[id.x].size = lerp(minimumSize, maximumSize, saturate(RandomValue())) * parabola(lifetime, 2);
particles[id.x].color = HueTexture.SampleLevel(samplerHueTexture, float2(RandomValue(), 0.0f), 0.0f).rgb * d;
}

View file

@ -60,10 +60,10 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DistanceIntensityExponent: 3.5
- _DistanceSizeExponent: 0.5
- _DistanceIntensityExponent: 1
- _DistanceSizeExponent: 0.33
- _DstBlend: 0
- _EmissionGain: 0.268
- _EmissionGain: 0.496
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1

View file

@ -46,6 +46,9 @@ float4 _NebulaTint_TexelSize;
uniform float3 _GridTransform;
uniform half _NebulaFillDensity,
_NebulaFillDistance,
_NebulaFillExponent,
_NebulaFillOffset,
_NebulaFloorDensity,
_NebulaPatchDensity,
_NebulaFloorOffset,
@ -125,7 +128,8 @@ float density(float3 pos)
float2 uv = getUV(pos);
const float surfaceDisp = tex2Dlod(_NebulaSurfaceHeight, half4(uv, 0, 0)).r;
const float dist = pos.y + surfaceDisp;
float d = pow((dist+20)/300,-2) * _NebulaFillDensity;
float d = pow(abs(dist+_NebulaFillOffset)/_NebulaFillDistance,-_NebulaFillExponent) * _NebulaFillDensity;
//d += pow(abs(dist+_NebulaFillOffset)/(_NebulaFillDistance*10),1/_NebulaFillExponent) * _NebulaFillDensity/4;
if(dist < _SafetyDistance)
{
const float heightFade = smoothstep(_SafetyDistance,_SafetyDistance*.75,dist);
@ -138,8 +142,8 @@ float density(float3 pos)
pos.y += (noise1 + noise2) * heightFade;
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 * 4), _NoiseExponent) * _NoiseAmplitude * tri2(lerp3) / 2;
const float noise4 = pow(triNoise3d((pos+fl * lerp4) / _NoiseScale * 4), _NoiseExponent) * _NoiseAmplitude * tri2(lerp4) / 2;
const float noise3 = pow(triNoise3d((pos+fl * lerp3) / _NoiseScale * 8), _NoiseExponent) * _NoiseAmplitude * tri2(lerp3) / 2;
const float noise4 = pow(triNoise3d((pos+fl * lerp4) / _NoiseScale * 8), _NoiseExponent) * _NoiseAmplitude * tri2(lerp4) / 2;
pos.y -= (noise3 + noise4) * heightFade;
d += cloudDensity(pos, surfaceDisp);
}

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

Binary file not shown.