How to get the built-in uniforms like threejs

Hello I’m putting my shader to babylonjs from threejs

and I found I can’t find the built-in uniforms like ‘modelMatrix’, ‘modelViewMatrix’, ‘projectionMatrix’, ‘viewMatrix’, ‘normalMatrix’, ‘cameraPosition’

I only find the ‘worldViewProjection’ from babylon’s shader

how can I find the other uniforms?

Are you creating a shader material? Shader Material | Babylon.js Documentation

When you say you can’t find, does it mean - in the shader, or how to define it? Certain things are provided for you (like projection, which is projection matrix, view, which is the view matrix, etc’), and some things (like the camera position) can be set by you. You need to define the uniforms you want to use when creating the material. I have a feeling this might be outdated, but this is the list of built-ins you can use in shader code (after adding them to the unforms list) - Introduction to Shaders | Babylon.js Documentation

3 Likes

Hi @RaananW

Is vEyePosition also a build in uniform?

But it is not mentioned in Introduction to Shaders | Babylon.js Documentation

It is not, part of it but you could use the helper function to bind it on your side

2 Likes