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 / How do you prevent objects being culled when they are off screen?

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2012 12:42
I'm sure I noticed a new flag on one of the object commands when I was browsing the Upgrade text files last week. I'm sure the flag allows you to turn off automatic culling (NOT the backface culling flag) so that objects which are off screen can be rendered (yes I have a reason for wanting to do that ).

I'm not 100% sure I'm correct as I was looking for something else at the time and didn't make a note or try it out. Now I can't find a reference to any such thing of course.

Can anyone help?
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Apr 2012 13:16
Not sure if I've heard of that command, but you could hack it. Objects are culled based on their bounding box. So if you performed some sort of vertex based operation which temporarily made the object huge, so it was on screen, then calculated object bounds, before return it to normal, the object would then forever be "on screen" and therefore never culled.

Might be worth a try.

Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Apr 2012 13:29
Quote: "Can anyone help? "

SET OBJECT RADIUS obj_number, 0

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2012 13:36 Edited at: 20th Apr 2012 13:50
@Brendy Boy

Thanks. That rings a bell - I'll see if I can dig out the relevant documentation now that I know what to look for. No mention of that option in the Help file of course.

Edit

I guess you mean this:

Quote: "Upgrade 6.3
===========

Basic3D
-------

* SET FRAME recalc bounds now requires mode 2 to recalculate ALL the frames bounds (slow)
* SET OBJECT RADIUS when given a radius of -1.0 will cause the object not to be visually culled
* Added new param: LOAD EFFECT XXX , DoNotGenerateExtraData (1-dont generate tangents)

Camera
------

* When a new camera is created it is internally sorted by index (rather than instance order)
* Fixed SYNC MASK bug which caused secondary cameras to wipe out cameras masked out
* Removed the power of two limit on the SET CAMERA TO IMAGE command, supporting newer cards"


I can do some testing now. Thanks.
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Apr 2012 14:46
Quote: "I guess you mean this:"

yes

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Apr 2012 15:28
Sounds like the best solution to me!

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2012 15:35
Now to see if I can use it with my shadow mapping demo.

[At the moment I seem to be getting in a muddle with the camera view matrices. ]
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Apr 2012 15:38
Quote: "matrices"


That's your problem right there. Matrix maths. Not a fan.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2012 21:03 Edited at: 20th Apr 2012 21:05
Got my muddle sorted out.

Quote: "Matrix maths. Not a fan."


Matrices simplify many 3D calculations - if you don't make silly mistakes.

First tests suggest that the no culling method enables me to calculate the combined shadow map in one render using a two pass shader. The downside is the loss of performance due to the absence of culling, e.g. the uncapped fps drops from about 150 to 50. I'll know the net result when I've put everything together. I suspect I'll have to wait for the cube mapping command to be fixed after all.

The one thing I need to know now is how to reinstate the culling quickly - i.e. how to undo the effects of using set object radius objID, -1.0.

@Brendy Boy Just realised that I'd actually used set object radius objID, 0.0 by mistake. It seems that 0.0 and 1.0 work equally well. Life seems to be full of such mysteries.

Aside
For those wondering what I'm on about, I'm referring to the shadow mapping options discussed here:

shadow mapping for two lights
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Apr 2012 21:45
It's annoying when you go down an avenue to try out a new technique and then another limitation/bug halts you. Good luck finding your solution.

Interestingly, I'm playing around with Evolved's shadow mapping shader right now. It's been a bit of a mission. I have a shadow being cast now, but it's strangely duplicated 4 times, and part of the spotlight image is faded out when unobstructed. Something aint right! All part of the fun ...

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Apr 2012 01:21
I'm having problems getting my shadows working too. The idea of combining the shadow maps seems to be working - but one set of shadows are in the wrong place and I just can't see why. They worked fine when I used separate maps. I also seem to have a z testing problem with my second render pass.

Quote: "Something aint right! All part of the fun ..."


Quite - and just another excuse for a beer I suppose.
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 21st Apr 2012 06:14
I think this thread is relevant. I don't seem to manage with the ODE engine since the latest DBpro update. am i right?
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 21st Apr 2012 10:24 Edited at: 21st Apr 2012 10:25
Quote: "Quite - and just another excuse for a beer I suppose."


Beer halts all progress for me. I've found I end up putting my chair into the recline position and productivity vanished. You knock yourself out though. Expand your conciousness!

Btw, you know you've been working too hard when you wake up thinking about the problems you were working on the day before. Yesterday all the data went in, then it must've been processing it while I was asleep, because I woke up thinking about it and this whole light mapping/depth/light project matrices thing made more sense. It was like my brain was performing an over night render or batch job.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Apr 2012 13:32
Got it working.

But it runs much slower than my original two light shadow demo. It looks as if I'll need to wait for the built-in cube mapping to be fixed. I haven't finished optimising it yet though - I was more concerned with getting the basic technique working. I'll try to find time to revisit it later today.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 21st Apr 2012 13:52
@Fallout -
Quote: "Btw, you know you've been working too hard when you wake up thinking about the problems you were working on the day before."
So very true... happens a lot...

I've been following this thread with great interest because as soon as all the light-mapping, shadows, and other updates are fixed I'm planning on writing another DBP level editor. I really cannot do anything at the moment as some of the major features are broke. And since my last one, I've taught myself a lot more to make something better.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-04-19 10:09:38
Your offset time is: 2024-04-19 10:09:38