# Object Position in 3D Space and Scaling

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

## Recommended Posts

Hi, I have a little Problem and hope anyone of you can help me with this. I have 2 identical transparent objects in 3D space. From the Camera object one (lets call it A) is behind the other one (lets call this one B). Obviously A looks smaller as it is further away. And on screen it looks as if they are centered around the same point, which of course they aren't in 3D space but only because of the conversion to 2D and the current camera position. My problem now is that I need to increase the scale of object A so that the they match each other on screen. In 3D space object A would be much bigger than object B but because B is closer they would look the same. Kind of complicated but I can't really figure the math out as to how to scale object A based on its distance to B. I would really appreciate some help with this. Thanks in advance.

##### Share on other sites
I have to make some assumptions about what you know about your objects. Assume you know the radii of object A and object B and you know the distances from the camera to each object. From your description, it sounds like you want to know how to scale the radius of Object A such that it appears to be the same size as object B from the camera's point of view.

Assume:
float A = radius of Object A
float B = radius of Object B
float C = distance to Object A from the camera
float D = distance to Object B from the camera

Calculate float E = B * C/D;
scale S = E/A;

That is, the new radius of object A when scaled = A*S = E.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
JoeJ
13

• 9
• 14
• 10
• 25
• 9
• ### Forum Statistics

• Total Topics
632645
• Total Posts
3007629
• ### Who's Online (See full list)

There are no registered users currently online

×