@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
34 lines • 1.16 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
const name = "fluidRenderingParticleDepthPixelShader";
const shader = `uniform mat4 projection;varying vec2 uv;varying vec3 viewPos;varying float sphereRadius;
varying float velocityNorm;
void main(void) {vec3 normal;normal.xy=uv*2.0-1.0;float r2=dot(normal.xy,normal.xy);if (r2>1.0) discard;normal.z=sqrt(1.0-r2);
normal.z=-normal.z;
vec4 realViewPos=vec4(viewPos+normal*sphereRadius,1.0);vec4 clipSpacePos=projection*realViewPos;
gl_FragDepth=clipSpacePos.z/clipSpacePos.w;
gl_FragDepth=(clipSpacePos.z/clipSpacePos.w)*0.5+0.5;
realViewPos.z=-realViewPos.z;
glFragColor=vec4(realViewPos.z,velocityNorm,0.,1.);
glFragColor=vec4(realViewPos.z,0.,0.,1.);
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
/** @internal */
export const fluidRenderingParticleDepthPixelShader = { name, shader };
//# sourceMappingURL=fluidRenderingParticleDepth.fragment.js.map