Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Objects ignoring depth

Author
Message
Ben_UK78
16
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 29th May 2011 11:43
Hi All,

For some reason the simplest of code is entirely ignoring depth. Objects that are behind are being drawn on top.

I would appreciate any help on this as I am momentarily flumoxed. I am running U1.076

Most of the last part was just added to control the camera to let me see what is going on, so it doesn't matter too much. The code will do the same if I just set up the camera, add 2 objects and position them.

I have not seen this before. All my other programs are still working and I haven't done anything much to my computer to affect driver etc.


Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 29th May 2011 12:33
Change

to

and it will work fine
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th May 2011 12:43
Hi, try changing

this:


to this


I remember having trouble with the camera range set to 0 to some number.

A clever person solves a problem, a wise person avoids it - Albert Einstein
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th May 2011 21:47
Rule of thumb:
- The near range of the camera should be as large as possible, but obviously within your requirements.
- The far range of the camera should be as small as possible, but again, within your requirements.

Doing that will give you the best depth accuracy when rendering, and as you've seen, some camera ranges just won't do well at all.

Ben_UK78
16
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 29th May 2011 22:02
Thank you all, I knew it would be blindingly simple. I've checked my other projects and they we're using 1 for the near range - looks like I've been using a value of 1 for years and not appreciating it, or why (saved by my copy and paste strategy for the first 10 lines no doubt).

Also, thanks IanM - not just for this tip, but all the many many others elsewhere. You've saved my code from frustration scrapyard on many an occasion.

The camera range was set so high to test if the object ever disappeared. Setting it to 5000 and placing the object at 50000 still drew it ontop of the closer object - a good clue that something bonkers was going on. Such a simple answer.....

Login to post a reply

Server time is: 2026-07-10 23:14:00
Your offset time is: 2026-07-10 23:14:00