Jump to content

  • Log In with Google      Sign In   
  • Create Account

z buffer effect


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 09 September 2012 - 09:54 AM

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

Sponsor:

#2 quiSHADgho   Members   -  Reputation: 325

Like
0Likes
Like

Posted 09 September 2012 - 11:34 AM

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.

#3 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 09 September 2012 - 12:39 PM

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!

#4 swiftcoder   Senior Moderators   -  Reputation: 10450

Like
2Likes
Like

Posted 09 September 2012 - 12:45 PM

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 - Software Engineer @Amazon - [swiftcoding]


#5 Bacterius   Crossbones+   -  Reputation: 9306

Like
1Likes
Like

Posted 09 September 2012 - 03:32 PM

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.

Edited by Bacterius, 09 September 2012 - 06:03 PM.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#6 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 09 September 2012 - 07:10 PM

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

#7 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 09 September 2012 - 07:12 PM

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 :$

#8 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 10 September 2012 - 10:14 AM

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!

Attached Thumbnails

  • game.jpg


#9 quiSHADgho   Members   -  Reputation: 325

Like
0Likes
Like

Posted 10 September 2012 - 01:21 PM

You could add a scale matrix depending on the distance. Then applied to each vertex before multiplying with the viewprojection matrix makes it smaller.

Edited by quiSHADgho, 10 September 2012 - 01:21 PM.


#10 Locutusborg   Members   -  Reputation: 124

Like
0Likes
Like

Posted 10 September 2012 - 05:19 PM

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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS