Shop integration
This commit is contained in:
20
product-scroll-poc/vertexShader.glsl
Normal file
20
product-scroll-poc/vertexShader.glsl
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
varying vec2 vUv;
|
||||
varying float vDisplacement;
|
||||
|
||||
uniform sampler2D tDepth;
|
||||
uniform float uDepthScale;
|
||||
|
||||
void main() {
|
||||
vUv = uv;
|
||||
|
||||
// Read depth from texture
|
||||
float depth = texture2D(tDepth, uv).r;
|
||||
vDisplacement = depth;
|
||||
|
||||
// Displace z position based on depth
|
||||
vec3 newPosition = position;
|
||||
newPosition.z += depth * uDepthScale;
|
||||
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user