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 / Weird camera clipping issues

Author
Message
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 18th Oct 2011 02:49
So I've been fiddling around with this for quite some time.
I load in a model and depending on the camera angle / distance it will get clipped from rendering far before it should (it isn't outside the camera view). I've been trying to alter the camera range (which seems to have an effect, however doesn't seem able to fix it), altering the fov, which also had an effect on the issue but in the end seemed unable to solve it. I've turned off culling and even tried different objects in case it had something to do with backfacing normals, all to no avail.

This problem has turned up for me to and fro for over a year, but I haven't been doing anything serious enough to care that much about it. It seems to happen on various systems as well, so it is probably software related. Therefore I'm kind of surprised that I couldn't find a thread about this already.
Do anybody know anything about this that could help in dispelling the issue?
It was annoying when trees would suddenly clip off as you passed under them, but now I can only see my main character from certain extreme angles...


I'd post a screenshot, but it wouldn't really do any good - in one frame the object is properly rendered, in the next it's gone.


"Why do programmers get Halloween and Christmas mixed up?"
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 18th Oct 2011 05:42
can you write the code so we know what's happening.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 18th Oct 2011 11:47
I Think I've found the problem.
Seems like the object is clipped as though having its original size when it is in fact rescaled.
Maybe this could be considered a bug; for static things like a player it's easy enough to resize the object before exporting it, but assume having a number of trees or other vegetation laid out with random scaling?

The following code replicates the problem on my desktop at least:



"Why do programmers get Halloween and Christmas mixed up?"
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 18th Oct 2011 14:14 Edited at: 18th Oct 2011 14:15
Quote: "scale object player, 5, 5, 5 // Outcomment this line and it will work as expected"


5 is a bit small for a size 5000 landscape.

5 represents 5% of 300, which is 15 units. Is it your aim for the player to be this size?

or is it 5 times bigger; which is 500%.

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 18th Oct 2011 22:09
Umm... I was just replicating my code above using a sphere as an "any" object to prove my point. The actual player model I'm using is 2400-something in height.


"Why do programmers get Halloween and Christmas mixed up?"
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 18th Oct 2011 23:12
You could try calculate object bounds.
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 19th Oct 2011 01:52
Here's a strange thing, if you comment out the "offset limb" command used on the sphere, then the sphere doesn't get clipped.

Don't know what this means but I thought I'd mention it.
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 19th Oct 2011 03:43
Quote: " Here's a strange thing, if you comment out the "offset limb" command used on the sphere, then the sphere doesn't get clipped.

Don't know what this means but I thought I'd mention it. "

that's because when you offset limb only limb gets offseted and not it's bounds.

Quote: "You could try calculate object bounds. "

or set object radius obj_num,0

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th Oct 2011 12:28
Thanks for the suggestions.

Calculate object bounds didn't seem to do much good, but set object radius actually did
It makes all the get object size functions return zero though, but that's easy enough to work around.

Not offsetting the object also works, but I kind of have to do that since its pivot point is in its centre (or you could add half its height to the y position at all times of course).


Well, thanks guys; maybe I can get this working now


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2026-07-11 14:37:42
Your offset time is: 2026-07-11 14:37:42