meetar
meetar

Reputation: 7611

What shaders are in the three.js ShaderLib?

I see in various demos that you can use a shader like so:

shader = THREE.ShaderLib[ "normalmap" ];

What other shaders are in ShaderLib, and where is ShaderLib documented? It doesn't even seem to show up in the github repo.

Upvotes: 3

Views: 5047

Answers (1)

meetar
meetar

Reputation: 7611

As of r.59, the three.js shaders available through ShaderLib are:

  • basic
  • lambert
  • phong
  • particle_basic
  • dashed
  • depth
  • normal
  • normalmap
  • cube
  • depthRGBA

The shaders in ShaderLib are listed and defined here: https://github.com/mrdoob/three.js/blob/r59/src/renderers/WebGLShaders.js#L1936 – This includes their linked uniforms, as well as included shader shunks, and in a few cases, fragment and vertex shader definitions.

They are so far unmentioned in the documentation, and for some reason a search in the repo for ShaderLib turns up empty, apparently because of unexplained deficiencies with github search.

Upvotes: 4

Related Questions