Basic wobble Theory The process is similar to what we did in the Raging Sea Shading lessons. We calculate an elevation according to the vertex position and we move that vertex. For the Raging Sea, we could make the vertices go up and down using the y-axis. But in this case, it’s not that simple. We want to make… Continue reading Basic wobble
Author: Vishnu MR
Baking
Baking When you do a render in a 3D software like Blender, it usually looks better than the model you import into Three.js, no matter how hard you try to get the exact same lighting and colors. This is because of the technique used while making the render. Ray Tracing consists of casting multiple rays… Continue reading Baking
Displacement pass
Displacement pass Create a new shader named DisplacementShader, then a new pass named displacementPass from the ShaderPass and add it to effectComposer: const DisplacementShader = { uniforms: { tDiffuse: { value: null } }, vertexShader: ` varying vec2 vUv; void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); vUv = uv; } `, fragmentShader: ` uniform sampler2D tDiffuse; varying… Continue reading Displacement pass
Fixing the antialias
Fixing the antialias There’s another feature that seems to stop working.if you are using a screen with a pixel ratio above 1, you probably can’t see the problem. Be careful; if you only have the renderPass available, you won’t see the problem because the render is done in the canvas with antialias support. Enable at least one pass… Continue reading Fixing the antialias
Custom Blending Equation Constants
Custom Blending Equation Constants These work with all material types. First set the material’s blending mode to THREE.CustomBlending, then set the desired Blending Equation, Source Factor and Destination Factor. Code Example const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); material.blending = THREE.CustomBlending; material.blendEquation = THREE.AddEquation; //default material.blendSrc = THREE.SrcAlphaFactor; //default material.blendDst = THREE.OneMinusSrcAlphaFactor; //default Examples… Continue reading Custom Blending Equation Constants
Positional Audio
Positional Audio Create a positional audio object. This uses the Web Audio API. Code Example // create an AudioListener and add it to the camera const listener = new THREE.AudioListener(); camera.add( listener ); // create the PositionalAudio object (passing in the listener) const sound = new THREE.PositionalAudio( listener ); // load a sound and set it… Continue reading Positional Audio
Keyframe Track
KeyframeTrack A KeyframeTrack is a timed sequence of keyframes, which are composed of lists of times and related values, and which are used to animate a specific property of an object. For an overview of the different elements of the three.js animation system see the “Animation System” article in the “Next Steps” section of the manual.… Continue reading Keyframe Track
Animation Object Group
Animation Object Group A group of objects that receives a shared animation state. For an overview of the different elements of the three.js animation system see the “Animation System” article in the “Next Steps” section of the manual. Usage: Add objects you would otherwise pass as ‘root’ to the constructor or the clipAction method of AnimationMixer and instead pass… Continue reading Animation Object Group
MeshLine
MeshLine Mesh replacement for THREE.Line.Instead of using GL_LINE, it uses a strip of triangles billboarded. Include script after THREE is included <script src=”THREE.MeshLine.js”></script> or use npm to install it npm i three.meshline and include it in your code (don’t forget to require three.js) const THREE = require(‘three’); const MeshLine = require(‘three.meshline’).MeshLine; const MeshLineMaterial = require(‘three.meshline’).MeshLineMaterial; const… Continue reading MeshLine
Quarks
three.quarks three.quarks is a high-performance javascript particle system based visual effect library for threejs written in modern TypeScript. three.quarks computes most particle information on CPU, and it uses customized shader , instancing, batch techniques to render those particles with as few draw calls as possible. three.quarks supports one dimension piecewise Bézier curves for the customizable transform visual… Continue reading Quarks