1

Practice: Shader + Three.js Rev1

 1 year ago
source link: https://codepen.io/YusukeNakaya/pen/rNJeNdP
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Shader + Three.js Rev1

0 unsaved changes
xxxxxxxxxx
<script id="vs" type="x-shader/x-vertex">
// TODO: Why ERROR ?!
// attribute vec3 uv;
varying vec2 vUv;
uniform float time2;
void main () {
  // TODO: Why can use 'uv' ?!
  vUv = uv;
  vec3 newPosition = position;
  newPosition.y = ( newPosition.y * 0.8 ) + sin( newPosition.x * 2.0 + time2 ) * 10.0;
  gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
}
</script>
<script id="fs" type="x-shader/x-fragment">
precision mediump float;
uniform vec2 uMouse;
uniform float time;
varying vec2 vUv;

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK