How to get camera position in shader?

precision lowp float;

attribute vec3 position;
attribute vec3 normal;
attribute vec2 uv; 

attribute vec3 cameraPosition // Or should I pass the parameters through the shader material

.......

If you’re using a Shader Material, you can pass it through a uniform like so : O

2 Likes

Thanks a lot!

1 Like

yw! you can also get it from the view matrix ^^

edit: Edited the PG, forgot to take inverse earlier lol