init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
30
gamedata/shaders/d3d11/fluid_confinement.ps.hlsl
Normal file
30
gamedata/shaders/d3d11/fluid_confinement.ps.hlsl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "fluid_common.hlsli"
|
||||
|
||||
// Pixel
|
||||
float3 main(p_fluidsim input) : SV_Target
|
||||
{
|
||||
// Texture_tempvector contains the vorticity computed by PS_VORTICITY
|
||||
float4 omega = Texture_tempvector.SampleLevel(samPointClamp, input.texcoords, 0);
|
||||
|
||||
// Potential optimization: don't find length multiple times - do once for the entire texture
|
||||
float omegaL = length(Texture_tempvector.SampleLevel(samPointClamp, LEFTCELL, 0));
|
||||
float omegaR = length(Texture_tempvector.SampleLevel(samPointClamp, RIGHTCELL, 0));
|
||||
float omegaB = length(Texture_tempvector.SampleLevel(samPointClamp, BOTTOMCELL, 0));
|
||||
float omegaT = length(Texture_tempvector.SampleLevel(samPointClamp, TOPCELL, 0));
|
||||
float omegaD = length(Texture_tempvector.SampleLevel(samPointClamp, DOWNCELL, 0));
|
||||
float omegaU = length(Texture_tempvector.SampleLevel(samPointClamp, UPCELL, 0));
|
||||
|
||||
float3 eta = 0.5 * float3(omegaR - omegaL,
|
||||
omegaT - omegaB,
|
||||
omegaU - omegaD);
|
||||
|
||||
eta = normalize(eta + float3(0.001, 0.001, 0.001));
|
||||
|
||||
float3 force = timestep * epsilon * float3(eta.y * omega.z - eta.z * omega.y,
|
||||
eta.z * omega.x - eta.x * omega.z,
|
||||
eta.x * omega.y - eta.y * omega.x);
|
||||
|
||||
// Note: the result is added to the current velocity at each cell using "additive blending"
|
||||
return force;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue