How to use the UniformsLib function from three

Find comprehensive JavaScript three.UniformsLib code examples handpicked from public code repositorys.

24
25
26
27
28
29
30
31
32
};

lineShaders = {

        uniforms: THREE.UniformsUtils.merge( [
                THREE.UniformsLib.common,
                THREE.UniformsLib.fog,
                lineUniforms
        ] ),
fork icon185
star icon867
watch icon40

+ 23 other calls in file

54
55
56
57
58
59
60
61
62
63
var geometry = new THREE.BufferGeometry();
geometry.addAttribute( 'position', new THREE.BufferAttribute( position, 3 ));

var material = new THREE.ShaderMaterial({
    uniforms: THREE.UniformsUtils.merge([
        THREE.UniformsLib.shadowmap,
        {
            texturePosition: { type: 't', value: undef },
            color1: { type: 'c', value: undef },
            color2: { type: 'c', value: undef }
fork icon160
star icon993
watch icon36

+ 3 other calls in file

135
136
137
138
139
140
141
142
143
144
};

const material = new THREE.ShaderMaterial({
    uniforms: _.merge(
        uniforms,
        THREE.UniformsLib.lights,
    ),
    defines: {
        USE_SPECULAR: 1,
        USE_MASK: (maskEnabled ? 1 : 0),
fork icon115
star icon803
watch icon0

84
85
86
87
88
89
90
91
92
93
}

const material = new THREE.ShaderMaterial({
    uniforms: THREE.UniformsUtils.merge([
        THREE.UniformsLib.lights,
        THREE.UniformsLib.points,
        uniforms,
    ]),
    defines: {
        USE_SPECULAR: (shader === '3dSpecular' ? 1 : 0),
fork icon115
star icon803
watch icon0

+ 3 other calls in file

491
492
493
494
495
496
497
498
499
500

class MeshLineMaterial extends THREE.ShaderMaterial {
  constructor(parameters)
  {
    super({
      uniforms: Object.assign({}, THREE.UniformsLib.fog, {
        lineWidth: { value: 1 },
        map: { value: null },
        useMap: { value: 0 },
        alphaMap: { value: null },
fork icon0
star icon1
watch icon1

230
231
232
233
234
235
236
237
238
239
if (this._simulation.isUsingLightSources()) {
    // TODO(ian): Follow recommendation for defining ShaderMaterials here:
    // https://discourse.threejs.org/t/cant-get-a-sampler2d-uniform-to-work-from-datatexture/6366/14?u=ianw
    var uniforms = THREE.UniformsUtils.merge([
        // TODO(ian): These failed due to type check. Remove?
        // THREE.UniformsLib.ambient,
        THREE.UniformsLib.lights,
        // THREE.UniformsLib.shadowmap,
        {
            ringTexture: { value: null },
fork icon0
star icon0
watch icon1

+ 38 other calls in file

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)