admin管理员组文章数量:1334327
I'm trying to modify the positions of the points of a plane object in p5.js. The coordinates are modified in a vertex-shader.
The sketch.js part :
shader(postShader);
postShader.setUniform('time', millis());
background(200);
noStroke();
fill(255);
sphere(100,100);
plane(300,300,100,100);
The shader part :
uniform mat4 uModelViewMatrix;
uniform mat4 uProjectionMatrix;
attribute vec3 aPosition;
attribute vec3 aNormal;
attribute vec2 aTexCoord;
varying vec2 vTexCoord;
varying vec3 v_normal;
void main() {
vec3 newPosition = aPosition;
float offsetZ = .3 * sin( aPosition.x * 20.0);
newPosition.z += offsetZ;
gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(newPosition, 1.0);
v_normal = aNormal;
v_normal.z += offsetZ;
vTexCoord = aTexCoord;
}
The view I get : .png
As you can see, the transformation is applied to the sphere but not to the plane.
How do I fix this?
本文标签: 3dProblem modifying the Ycoordinate of a plane in p5jsStack Overflow
版权声明:本文标题:3d - Problem modifying the Y-coordinate of a plane in p5.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742369042a2461862.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论