Where are built-in GLSL variables documented?


three.js includes predefined GLSL variables such as cameraPosition but can’t find an official document.

Where is it?

Right here:



Oh, don’t know why I was missing… Thanks anyway

I think you were missing it because you can write shaders and use them wi ShaderMaterial but never even be aware of this class. ShaderMaterial might be a better place to document that.


Yes, it might be and can be reason why I was missing, but I was searching in three.js document page. In three.js document page, it uses simple search box that looks up just titles of pages. So when I search “cameraPosition” which is one of keywords in the page content but never appear in titles, I got no result found.

If you search on Google, you can find it though.