|Topic was automatically imported from the old Question2Answer platform.
Do you talk about a 2D/CanvasItem shader or a 3D/Spatial shader? Your question would make less sense for a 3D Shader IMHO but who knows. In that case I’d try to get a 3D aabb of the meshinstance then transfer that via camera.unproject_position into screen coords and get the rect of the min/max of the 4 values (works for a cube, might be a bit too big for other shapes). Then pass the result via a uniform to the shader. But perhaps I’m thinking too complicated.
wombatstampede | 2019-10-18 09:17
Thank you very much, it helped me a lot. I am trying to implement a fixed-view 3D game demo, and it is an orthogonal camera. According to your method, I only need to get aabb once when the camera is at the origin; then in the fragment shader, calculate the final aabb by camera position.
ATom 1 | 2019-10-18 10:48