z buffer effect

Started by
8 comments, last by Locutusborg 11 years, 7 months ago
Hello All

I've got a space sim game more or less running, but i'm finding an issue with the z-buffer.
Z-buffer is working (close objects are in front of far objects), but the effect of things getting smaller in the distance is not so strong. example:
my ships have a diameter of 1 approx. they become "close to invisible, abt 1-2 pixel) at a distance of 150 (DirectX units)
The planets have a diameter of about 50, and even at a distance of 1500 (the other end of the level) they are not much smaller

Is there any way to increase this effect so that the planets (and ships) will be more smaller in the distance? Only option i can think of is scaling objects down, or distances up, but this will cost me a lot of work. If anyone knows a programmatic option I'd love to know!
Thanks
Advertisement
This is not a question of scale it depends on your projection matrix. If your using a perspective projection the "scaling" will ne done automatically but I guess your using an orthographic matrix.
Thanks for your reply!

Unfortunately, it is not the solution. I'm already using a perspective projection (D3DXMatrixPerspectiveFovLH)
It's also working, because there is "scaling" happening, it's just not strong enough. It has to be smaller at a closer distance. I've tried changing the far clipping plane to see if te far/near ratio has influence, but it makes no difference.

Any other idea's?

Thanks!

Unfortunately, it is not the solution. I'm already using a perspective projection (D3DXMatrixPerspectiveFovLH)
It's also working, because there is "scaling" happening, it's just not strong enough. It has to be smaller at a closer distance. I've tried changing the far clipping plane to see if te far/near ratio has influence, but it makes no difference.

Have you tried changing the Field of View angle (fovy)? The larger you set the field of view, the smaller distant objects will appear (although too large an angle will result in a fisheye effect).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


Have you tried changing the Field of View angle (fovy)? The larger you set the field of view, the smaller distant objects will appear (although too large an angle will result in a fisheye effect).

And too low a field of view angle will result in an orthographic projection approximation (you lose any sense of depth). 50 to 70 is usually ideal, but it also depends on the effect you want your game to achieve (if you need peripheral vision, you'll want a bigger FOV such as 80, but it tends to make people dizzy because of the extreme edge distortion)

EDIT: those are degree angles, obviously.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

I'm using PI/4 as FOV, 45 degree angle. tried some other settings as suggested, but I did get the desired effect. I'll try uploading a screenshot later (not at my own pc now) see if it helps

I'm using PI/4 as FOV, 45 degree angle. tried some other settings as suggested, but I did get the desired effect. I'll try uploading a screenshot later (not at my own pc now) see if it helps

edit: I didn't get to the effect I wanted, sorry typing too fast :$
Here's the screenshot. both planets are the same size. the left one is at a distance of 1300 units. is there any way of making it appear at half the size without putting it at double distance?
I'm afraid it doesn't look like it...

Thanks for all idea's so far, it's appreciated!
You could add a scale matrix depending on the distance. Then applied to each vertex before multiplying with the viewprojection matrix makes it smaller.
Thanks,

Think i'll give it a shot with the scale matrix. entering all data again would be a hell of a job!

Thanks for all replies!

This topic is closed to new replies.

Advertisement