In Polygonjs, you create 3D scenes by connecting nodes together. Some nodes help you generate geometries, others create materials, add behaviors to the scene objects, or handle user inputs. Each node does one thing and does it well. This allows you to create your scene in a non destructive workflow, where you can try ideas without impacting the rest of your… Continue reading Node-Based Workflow
Author: Vishnu MR
glTF Transform
glTF Transform supports reading, editing, and writing 3D models in glTF 2.0 format. Unlike 3D modeling tools — which are ideal for artistic changes to geometry, materials, and animation — glTF Transform provides fast, reproducible, and lossless control of the low-level details in a 3D model. The API automatically manages array indices and byte offsets, which… Continue reading glTF Transform
MatCaps
MatCap (Material Capture, also known as LitSphere) are complete materials, including lighting and reflections, so you can add it to an object and not have any need for, well, lighting and reflections. MatCaps allows you to create a surface material and lighting environment simply by painting an object so that it looks like how you want your… Continue reading MatCaps
Fluid Engine
The general Architecture of the engine is as follows: it has a Fluid Simulator class, which you need to properly initialize before use, and deintialize before you switch out of the scene or close the game, and Fluid GPU Resrouce class, where you need to do the same. Once you have the initialization behind you, you can build a… Continue reading Fluid Engine
LightProbe
Light probes are an alternative way of adding light to a 3D scene. Unlike classical light sources (e.g. directional, point or spot lights), light probes do not emit light. Instead they store information about light passing through 3D space. During rendering, the light that hits a 3D object is approximated by using the data from… Continue reading LightProbe
Color management in three.js
Definitions Linear-sRGB / THREE.LinearEncoding: Linear transfer functions, Rec. 709 primaries, D65 white point. sRGB / THREE.sRGBEncoding: sRGB transfer functions, Rec. 709 primaries, D65 white point. Best practices Textures with color data (.map, .emissiveMap, …) should be configured with .encoding = sRGBEncoding. Non-color textures use LinearEncoding. Exceptions exist for some formats (like OpenEXR), which typically use LinearEncoding for color data. Vertex colors should… Continue reading Color management in three.js
Earcut
An implementation of the earcut polygon triangulation algorithm. The code is a port of mapbox/earcut. Methods .triangulate ( data, holeIndices, dim ) : Array data — A flat array of vertex coordinates. holeIndices — An array of hole indices if any. dim — The number of coordinates per vertex in the input array. Triangulates the given shape definition… Continue reading Earcut
PolarGridHelper
The PolarGridHelper is an object to define polar grids. Grids are two-dimensional arrays of lines. Code Example const radius = 10; const sectors = 16; const rings = 8; const divisions = 64; const helper = new THREE.PolarGridHelper( radius, sectors, rings, divisions ); scene.add( helper ); Constructor PolarGridHelper( radius : Number, sectors : Number, rings : Number, divisions… Continue reading PolarGridHelper
sharing geometry and transforms between BatchedMesh
Add a “BatchedBufferGeometry” object that BatchedMesh references and stores all the geometry, draw ranges, etc. The BatchedMesh would still bookkeep the multidraw buffers, etc: const mesh1 = new BatchedMesh( maxGeometryCount, maxVertexCount, maxIndexCount, material1 ); const index = mesh1.geometry.addGeometry( … ); mesh1.setMatrixAt( … ); const mesh2 = new BatchedMesh( mesh1.geometry, material2 ); mesh1.setVisibilityAt( 0, false );… Continue reading sharing geometry and transforms between BatchedMesh
Allow controlling traverse flow
Make traverse and the rest of the family respect special return values. The most important (in my opinion) would be the ability to ignore the children. For example: // Somewhere in Three.js code. Could be replaced with an enum-style definition const IGNORE_CHILDREN = new Symbol(‘ignore_children’); const HALT_TRAVERSE = new Symbol(‘halt_traverse’); // I didn’t check this… Continue reading Allow controlling traverse flow