As I understand it - TransformedCentre should be in clip space, so I would expect adding offset to consistently add the same amount of screen no matter the z position of the billboard, but the circles I’m getting recede into the distance as you can see here:
hi @iamalexf
Cann’t say that I understand your code, so this will sort of be from the hip: Keep the projection out of the equation and stick to a clean view-matrix. Add the offset and use the projection on the output.
If you construct the view-matrix from a camera-consept, I’ve found that
viewMatrix = scale(-1,1,-1) x camera-rotate-matrix x inverse(camera_pos_matrix)
correlates well with the glm::projection() … it produces the same matrix as glm::lookAt()
What I was missing was a proper understanding of what the w component does here - which I have now bothered to find out. Thanks for setting me on the path…
A sprite which is used in place of a 3D object. Typically they’re used to improve performance, as a billboard is just a single quad (two triangles) regardless of the complexity of the object rendered on it. But normally you want billboards to scale with distance, so that probably isn’t the correct term here.
The usual situation where you want the position to be in 3D but the object size to be fixed is for “markers”, icons which are placed at a specific 3D location.