Sign in to follow this  
Fluxtah

How far does something have to be till it becomes a point?

Recommended Posts

I am quite rubbish at Math so I need a little help at solving this problem. Can someone help me understand or show me some examples of how I could use this to help me determine how far a certain object (say a sphere) should be from the camera when it is at a point, maybe I am overlooking a lot of things like the camera FOV and possibly some other things, like I say I am so bad at math but I can grasp stuff if I read it over and over again. I was looking into angular size as described on this page http://www.ifa.hawaii.edu/faculty/barnes/ast110/homework/hw3.html it says that a = L/d Where a is the angle, L is the linear size and d is the distance. What I don't understand is L, the linear size. The explanation on that page shows it as the projection onto the back card, but how does L relate to real size? Thanks! :)

Share this post


Link to post
Share on other sites
L is the amount of separation between the cards.

Quote:
Next, cut a piece of thread a bit longer than your arm. Take one end of the thread and tape it along the edge of one card. Take the other end and tape it along the edge of the other card. Measure the length of the thread left between the cards, and call that length `L'. The thread enables you to hold the two cards a fixed distance apart.

Share this post


Link to post
Share on other sites
Its true that homework/schoolwork isn't within forum rules described at Forum FAQ. However, this topic is of general interest in graphics and game development. Also, I'm going to give Fluxtah the benefit of the doubt that this is not his/her homework since the page referenced is in Hawaii, US while the Fluxtah is in the UK.

Therefore, the topic can remain open.

I think you have it backwards. The referenced web page calls L a length and d a diameter. In computer graphics terms, assuming the camera is looking straight at the object, then L is the distance from the camera to the center of the object and d would be a representative diameter of the object as measured perpendicular to the camera view axis. Think of d as the diameter of a bounding sphere of the object.

The image plane exists at the front clip plane of the camera, and has a certain number of pixels, the window size such as 800 x 600 pixels. Using linear interpolation and the camera perspective projection information (e.g., the view frustum), you can determine how many pixels an object at distance L with diameter d will take up in the image plane.

One intuitive choice is to decide that the object becomes a point when its distance is such that its bounding sphere only takes up one pixel on the image plane. Of course, you could decide that it becomes a point when it takes up 5 pixels or whatever else makes sense!

Share this post


Link to post
Share on other sites
The simpliest answer I think is similar triangles. If you scale a side of a triangle by c then all the rest of the sides have to scale by c as well to keep from changing the interior angles of the triangle. So say dx is the horizontal distance between adjacent pixels in the z=nz plane. Then the horizontal distance between adjacent pixels in the z=oz plane is dx*oz/nz. That is assuming the camera is at the origin pointing down the z axis.

Share this post


Link to post
Share on other sites
If you want to get technical (I know you don't but I will anyway), since a point has 0 extents (ie no size, only location) then a finite object will become a visible point when it is an infinite distance from the viewer.

Or you could use one of the considerably more helpful posts above. [wink]

Share this post


Link to post
Share on other sites
Are you trying to do something practical with this information? Could probably get some more details if you want to explain that. In game development, a point is limited in scale to a pixel. Once it becomes smaller than that, average 3D graphics representation will begin blinking the point in and out as the view is adjusted or as distance increases. It's actually pretty annoying.

Share this post


Link to post
Share on other sites
Thanks for the response guys, because I have limited knowledge of perspective projection I have had to take a step back and study my 3D Math book, however I am still very confused to how perspective projection actaully works.

The book describes the pin hole camera where the pin hole is the centre of projection and the projection plane is the back of the box that the pinhole projects onto.

What I don't understand is where is the projection plane in practice? I have my perspective matrix in direct3d but it does not contain this information, or maybe I don't know where which rows/cols I need to look for it.

It shows that a point P in world space can be projected onto the projection plane at P1 with the following formula, calculating for the y component of P1

P1y = -d*Py
-----
z


It says that -d is the distance from the centre of projection to the projection plane, it describes for practicality we can move the projection plane in front of the centre of projection so we can remove the negative sign on d.

If I can't find the projection plane I won't know the distance d :(

I need to understand this before I can move on to the above suggestions, anyone help a dummie? :)

Kest: I think my question was one of those things passing by in my mind, it's something I just wanted to know.

Thanks for the help again guys.

Share this post


Link to post
Share on other sites
The camera is at the origin pointing down the negative z axis and the plane of projection is z=-nz. That's in camera relative coordinates. That's definitely after the model transform, but I'm not familar enough with DirectX to say if it is before or after the world transform. If the world transform is normally a projection then it is before, otherwise after in all likelyhood.

Share this post


Link to post
Share on other sites
Hi, I have another related problem.

I made a small app so I can visualise matrices, I have a triangle with all sides being 20 units.

I wanted to calculate how far back the triangle would have to be from the camera in order for it to just fit in the window and got some strange results.

I used the formula:


triangle height * distance to projection plane
distance = ------------------------------------------------
desired height


the width and height of my viewport is 640x480

so I went with


distance = 20*distance to projection plane
-------------------------------
480


but that ended up making the triangle much smaller than the viewport

so I instead of using the height of the view I decided to use the width


distance = 20*distance to projection plane
-------------------------------
640


which worked

here is an image

I am a bit confused to why I had to use the width as I am trying to fit the triangle based on its height, I must be quite not understanding something, can someone help me and explain what I am missing?

regards

Fluxtah

Share this post


Link to post
Share on other sites
I think that the formula you are using assumes that the triangle is oriented point up. In that case the height should be 18.2 instead of 20. However, because the triangle is on its side, a height of 20 would seem appropriate, but it throws off the fit. Because you then use the width, it kind of cancels out. It's a square fit, so it works out in the end. Try using the proper triangle height (sqrt(300)) and the window height, and see if it does what you expected.

Share this post


Link to post
Share on other sites
Thanks for the reply, I realise now that I was calculating the distance to the projection plane wrong, in DirectX it seems they use the vertical FOV rather than the horizontal.

cheers

Fluxtah

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this