Jump to content
  • Advertisement
Sign in to follow this  
afraidofdark

fixed object size in perspective projection

This topic is 2964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, I am trying to implement a move tool manipulator like the one in max or maya, those manipulators newer change their size no matter how far or close we are to them, they always occupie same size at the view port, in order to simulate the stuation, I took the distance from camera to object and generate a scale factor for manipulator but that doesn't work well enought, maya & max and other programs are using a better approach to achive this effect, a formula or something like it, any suggestion for this stuation would be nice, thanx

Share this post


Link to post
Share on other sites
Advertisement
I bet they simply draw it in a fixed distance from the camera.
Calculate the distance of the gizmo from the camera, normalize it, then multiply it with the fixed distance.
direction = world_gizmo_center-camera_position;
direction = FIXED_DISTANCE * normalize(direction);
displayed_gizmo_center = camera_position + direction;
This depends on your implementation, but I think you get the idea.

This should be fine, since gizmos don't have to be depth tested.

If you do want objects to be depth tested, then scaling the object seems to be a better idea: but scale it proportional to the square of the distance. (I'm not sure about this one, but you can give it a try).

Share this post


Link to post
Share on other sites
I tried it, but I have to draw it exactly where the object's pivot is (it is implemented in that way) so I only need a scale factor, it also seems to me that max & maya use this method, putting manip at a fixed distance away from camera may show manipulator and object distinct in some conditions

Share this post


Link to post
Share on other sites
Um... Would you post some code?
I don't understand why the constant distance thing isn't working.

Did you try scaling with the square of the distance (multiplied with a constant)?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!