Graphics Reference
In-Depth Information
In this example, we once again change the position of individual vertices, but this
time, we use THREE.SphereGeometry as the source and combine it with a perlin
noise generator.
How to do it...
To create a custom vertex shader, you need to follow these steps:
1. As we just want to write a vertex shader, we'll use a standard fragment
shader, which is the one also used by THREE.MeshBasicMaterial from
Three.js. You can get a reference to this shader by selecting the correct one
from THREE.ShaderLib :
var basicShader =
THREE.ShaderLib['basic'];
2. The next step is to define the Uniforms object. Uniforms are parameters
that are passed into the shaders as arguments:
Var uniforms = {}
uniforms =
THREE.UniformsUtils.merge([basicShader.uniforms]);
var texture =
THREE.ImageUtils.loadTexture('../assets/
textures/debug.png');
uniforms['map'].value = texture;
uniforms.delta = {type: 'f', value:
0.0};
Search WWH ::




Custom Search