Tweak Stardust Placement
Quick commit before I break everything by upgrading Unity Modified vertical placement code for stardust particles
This commit is contained in:
parent
c3329cecc4
commit
ae79a152e9
9 changed files with 26 additions and 19 deletions
|
|
@ -16,7 +16,7 @@ float DeltaTime;
|
|||
|
||||
// Adjustment
|
||||
int2 Delta;
|
||||
float Fade;
|
||||
float Damping;
|
||||
|
||||
// External force
|
||||
float2 ForceOrigin;
|
||||
|
|
@ -73,7 +73,7 @@ void Adjust(uint2 tid : SV_DispatchThreadID)
|
|||
|
||||
if(any(prevUV<0)||any(prevUV>1))
|
||||
W_out[tid] = f.xz;
|
||||
else W_out[tid] = lerp(U_in.SampleLevel(samplerU_in, prevUV, 0), f.xz, Fade);
|
||||
else W_out[tid] = lerp(U_in.SampleLevel(samplerU_in, prevUV, 0), f.xz, Damping);
|
||||
}
|
||||
|
||||
// Advect step
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace StableFluids
|
|||
|
||||
[SerializeField] int _resolution = 512;
|
||||
[SerializeField] float _viscosity = 1e-6f;
|
||||
[SerializeField] float _damping = .05f;
|
||||
[SerializeField] float _range = 512;
|
||||
[SerializeField] Transform _camera;
|
||||
|
||||
|
|
@ -49,6 +50,7 @@ namespace StableFluids
|
|||
public const int PFinish = 3;
|
||||
public const int Jacobi1 = 4;
|
||||
public const int Jacobi2 = 5;
|
||||
public const int Adjust = 6;
|
||||
}
|
||||
|
||||
int ThreadCount { get { return (_resolution + 7) / 8; } }
|
||||
|
|
@ -132,13 +134,18 @@ namespace StableFluids
|
|||
Shader.SetGlobalVector("_FluidTransform", new Vector4(cameraPosition.x, cameraPosition.y, _range));
|
||||
|
||||
var delta = (float2)(cameraIntPosition - _previousCameraIntPosition) / Resolution;
|
||||
_compute.SetVector("Delta", new Vector4(delta.x,delta.y));
|
||||
_compute.SetFloat("Damping", _damping);
|
||||
_compute.SetTexture(Kernels.Adjust, "U_in", VFB.V1);
|
||||
_compute.SetTexture(Kernels.Adjust, "W_out", VFB.V3);
|
||||
_compute.Dispatch(Kernels.Adjust, ThreadCount, ThreadCount, 1);
|
||||
|
||||
// Common variables
|
||||
_compute.SetFloat("Time", Time.time);
|
||||
_compute.SetFloat("DeltaTime", dt);
|
||||
|
||||
// Advection
|
||||
_compute.SetTexture(Kernels.Advect, "U_in", VFB.V1);
|
||||
_compute.SetTexture(Kernels.Advect, "U_in", VFB.V3);
|
||||
_compute.SetTexture(Kernels.Advect, "W_out", VFB.V2);
|
||||
_compute.Dispatch(Kernels.Advect, ThreadCount, ThreadCount, 1);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue