Best trick to keep a sphere of the same size

Hi All,

What is the best trick to keep a sphere diameter always of 100 pixel on screen during scene zoom/rotate operations?

Thanks in advance,

Alberto

Don’t make it part of the transform hierarchy you zoom and rotate but put it under its own independent transform which renders in screenspace?

Mmmm… I don’t think this would work as I want.

I am trying instead of projecting two screen points like 0,0 and 0,100 and get the 3D world distance. This way I can change the sphere size every frame.

What do you think?

Thanks.

Alberto

Doing it in screen-space might not be good if the spheres are lit, and the lighting changes a lot. Also, if there are overlapping objects both in front of and behind the sphere, it might be tricky to get the occlusion right.

Instead, one might consider projecting the radius of the sphere as a line into screen-space, and modifying according to the current projection. This may not always give the exact same radius measured in pixels, but it will probably be close.

I think you should explain what the sphere is used for and how it should look like.
The next trivial thing would be to use an own viewport and projection for that sphere, but you didn’t say what it is meant for.
Is it inside the scene, is it moving around, lit, shaded textured, depth buffered, whatever…?
I was thinking “manipulator icon”.

Yes, it is a manipulator icon, I am quaite satisfied about the solution exaplined in my last post and probably is fast as defining its own viewport and projection.

Thanks.

Alberto