How to use the ShaderLib function from three
Find comprehensive JavaScript three.ShaderLib code examples handpicked from public code repositorys.
24 25 26 27 28 29 30 31 32 33const opacities = (config.opacities && config.opacities.data && config.opacities.data.length === positions.length / 3) ? config.opacities.data : null; const sizes = (config.point_sizes && config.point_sizes.data && config.point_sizes.data.length === positions.length / 3) ? config.point_sizes.data : null; const {colorsToFloat32Array} = buffer; const phongShader = THREE.ShaderLib.phong; let i; const boundingBoxGeometry = new THREE.BufferGeometry(); const geometry = new THREE.IcosahedronBufferGeometry(config.point_size * 0.5, meshDetail); const colorMap = (config.color_map && config.color_map.data) || null;
GitHub: avin/generative

56 57 58 59 60 61 62 63 64 65side: THREE.DoubleSide, }); } function createSnowMaterial() { const shaderPoint = THREE.ShaderLib.points; const uniforms = { ...shaderPoint.uniforms, iTime: { value: 0 }, pSize: { value: 10 },
+ 5 other calls in file
14 15 16 17 18 19 20 21 22 23constructor(parameters) { parameters = parameters || {}; parameters.uniforms = three.UniformsUtils.merge([ three.ShaderLib.normal.uniforms, { linearize_depth: { value: parameters.linearize_depth ?? true } } ]); parameters.vertexShader = 'varying mat4 vProjectionMatrix;' + '\n' + three.ShaderLib.normal.vertexShader.replace(
+ 39 other calls in file
GitHub: captDaylight/sugar

161 162 163 164 165 166 167 168 169 170// ADD SKYBOX TO SCENE WITH MATERIAL //////////////////// var shader = THREE.ShaderLib.cube; shader.uniforms.tCube.value = skyMaterials[currentBackground]['textureCube']; var material = new THREE.ShaderMaterial( { fragmentShader: shader.fragmentShader,
GitHub: captDaylight/sugar

15 16 17 18 19 20 21 22 23} module.exports = function (scene) { textureCube = THREE.ImageUtils.loadTextureCube( ['images/skyboxes/bigCube/smaller.jpg','images/skyboxes/bigCube/smaller.jpg','images/skyboxes/bigCube/smaller.jpg','images/skyboxes/bigCube/smaller.jpg','images/skyboxes/bigCube/smaller.jpg','images/skyboxes/bigCube/smaller.jpg'], new THREE.CubeRefractionMapping()); shader = THREE.ShaderLib.cube; shader.uniforms.tCube.value = textureCube; material = new THREE.ShaderMaterial( {
three.Vector3 is the most popular function in three (22341 examples)