# 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.

## 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 on other sites
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 on other sites
yea ! thast a realy cool idea, worth give it a try :D thanx

[Edited by - afraidofdark on July 9, 2010 6:02:01 AM]

##### 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 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)?

1. 1
2. 2
JoeJ
17
3. 3
4. 4
5. 5
frob
11

• 13
• 16
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632181
• Total Posts
3004624

×