I’m trying to do some displacement in the vertex shader by sampling a perlin noise texture.
However it seems like the value of the sampled texture is always (0,0,0,1).
Vertex Shader Excerpt:
// ...
uniform sampler2D uPerlinNoise;
// ...
void main(void)
{
// ...
float noise = texture(uPerlinNoise, aUv0).r * 2.0 - 1.0;
vPosition += vec3(noise, 0.0, 0.0) * k * uDisplacementStrength;
// ...
}
Project:
https://playcanvas.com/project/1222888/overview/shell-texturing
What am I doing wrong? Or is it not possible to sample a texture in the vertex shader?
Desired outcome would be a bend of the grass, which I can achieve by setting noise directly to 0.5 instead of sampling the texture.