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 / Can anyone help me make a portal renderer please : )

Author
Message
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 1st Oct 2003 01:05
Hi, im making a game which will use direct x models for maps, i've done the collision code but my levels are rather complex so they reduce FPS to 40/50. I need it to be at least 60/70 FPS so i need a portal rendering system to increase the frame rate.

The only problem is I have no idea how to do it

What I assume that I have to do is use the intersect object command and calculate if the intersect vectors in the FOV are touching polgons, if it is then show the polygons, else hide them.

Is this correct? If so how do I do this? (memblocks i suppose)

Thanks

Once you start down the Dark Path, forever will it dominate your destiny...
UberTuba
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 1st Oct 2003 01:17
bsp pvs compiler- included with dbpro
coverts your file to bsp, yout only chance

the artist formally known as darkfluff
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Oct 2003 02:16
Try looking at http://www.underwaredesign.com. I know that Kev was working on a portal system some time back.
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 1st Oct 2003 03:09
Yup, it's called Visible Worlds.
Direct link: http://vw.underwaredesign.com/

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 1st Oct 2003 05:12
Visible Worlds is very powerful. Recommended here

--Mouse: Famous (Avatarless) Fighting Furball
Read It: http://www.angryflower.com/itsits.gif
Learn It: http://www.angryflower.com/bobsqu.gif
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 2nd Oct 2003 19:24
Thanks, that seems good but i cant buy it shareit needs a non-free email account and paypal needs a credit card! thats damn annoyin.

It would be better if i make this render myself so can anyone give me any advise?



Once you start down the Dark Path, forever will it dominate your destiny...
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Oct 2003 17:00
Ok Inferno, put the kettle on...

I have an idea, but it'd take a looooooong time to calculate the visibility.

You firstly need to break your level model into smaller limbs. For example, each wall should be a limb, any part that is high poly should be cut up too - you have to think in segments, you could just base it on a grid, but once you know how it works you'll come up with a good system. It's important, but not important at the same time - because a badly cut up level will be slower, a nicely cut up level will be faster.

Now you need to load the model into DBPro and decide on a bounding box, the whole entire range that the camera can be - like a huge glass box around the level. You'll need an array to stores some variables for each limb in your model, basically the limb bounding sizes, and the visible state - if you were feeling flash you could hijack the system for triggers, limb specific effects like pixel shaders too, you'd simply have more arrays and build the functionality into your portal renderer.

Now for every limb, you need to calculate the visibility box so you can store the data in the array. I suggest being anal with the arrays and storing the XYZ coordinates of 2 opposite box corners - this is enough to get cracking.

This is perhaps the slowest thing ever, but what you do is you position the camera inside the level bounding box, in all possible locations - you can move in blocks, but your basically trying to eek out each limbs own bounding box by checking every possible location with the camera pointed at the limb the whole time.

So assuming your level is inside a 100x100x100 box, your code might look a little like (psuedo code of course):

global limbsinlevel
`Lets pretend theres 100 limbs in your level
limbsinlevel=100
dim limb_x(limbsinlevel,1)
dim limb_y(limbsinlevel,1)
dim limb_z(limbsinlevel,1)

For bx=0 to 100
For by=0 to 100
For bz=0 to 100
position camera bx,by,bz

for limb=1 to limbsinlevel
point camera limb position x(1,limb),limb position y(1,limb),limb position z(1,limb)

hide limb 1,limb
sync
`Grab colour in center of screen
col1=point(320,240)
show limb 1,limb
sync
col2=point(320,240)

`Check 2 colours for a difference (meaning the limb is visible)
if col1<>col2
` Stretch out the bounding box if the limb is visible
if bx<limb_x(limb,0) then limb_x(limb,0)=bx
if bx>limb_x(limb,1) then limb_x(limb,1)=bx
if by<limb_y(limb,0) then limb_y(limb,0)=bx
if by>limb_y(limb,1) then limb_y(limb,1)=bx
if bz<limb_z(limb,0) then limb_z(limb,0)=bx
if bz>limb_z(limb,1) then limb_z(limb,1)=bx

endif


next limb

next bz
bext by
next bx

Do
rotate camera mousey(),mousex(),0
if mouseclick()=1 then move camera 1
camx#=camera position x()
camy#=camera position y()
camz#=camera position z()

portal(camx#,camy#,camz#)

Sync
Loop


function portal(x#,y#,z#)

for limb=1 to limbsinlevel

hide limb 1,limb

if x#>bx(limb,0) and x#<bx(limb,1)
if y#>by(limb,0) and y#<by(limb,1)
if z#>bz(limb,0) and z#<bz(limb,1)
show limb 1,limb
endif
endif
endif

next limb

endfunction


Hope this sheds a little light.


Van-B

My cats breath smells of cat food.
anseyder
22
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 9th Oct 2003 08:08
Can't you just use "object in screen" and the load commands to only load objects when they are needed and kill them when they are not. Eg, when you move indoors unload the out door scene and simply block the view outside with a door or something. Or maybe the hide object command eg:

when the camera/player is in object 1, hide object 3 and 4 etc etc.

Also use fog and draw distance, if you dynamically change the draw distance to match the max actual visible distance (quite low inside) then you can speed things up too...

buy the PS2 Game Firewarrior (I worked on it as a level artist)
las6
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 9th Oct 2003 09:15
Hmm, Van-B's idea sounds good, although slow.

How about you divide the map into blocks. So splice the .x file and use several of those per level. First of all, DBpro will hide the ones not in view... I think. Secondly, you can use simple calculations to determine how many other tiles are visible from each tiles. This will hide the tiles that are in your screen, but further away/blocked. This info would be tile based, so it wouldn't be that dead accurate, but depending on your levels, it might just give you enough speed boost. Plus it's really easy to do.

orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 9th Oct 2003 16:50
hey, taking this a bit farther:

on the current project im working on, im dividing areas of the map into groups. Im using a UDT array which defines that if you enter group x, unhide groups y & z, and hide groups a & b. I will have a 2 dimensional array where one way is the group and the other way is an array element for all the objects in the group.

When the player enters a group area, it checks the UDT array to see what to turn on and off, goes to the OTHER array and loops through all the object numbers and hides or shows the objects in their respective groups.

I play on having invisible plains which the user will pass through triggering a collision, which signifies entering a group.
I hope this is all making sense!

as far as a view port (if i understand this right), why not use the

SET CAMERA VIEW Camera Number, Left, Top, Right, Bottom

???

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card.
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2003 00:16
Thanks but i think these methods would be too slow, splitting up the level and such would cos the polycount to go very high (making the loading time very long). I'll try and browse through a few forums and see if i can find a method to do it, then i'll make the engine and release it for all to use (if i manage to do it )

cheers

Once you start down the Dark Path, forever will it dominate your destiny...
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Oct 2003 15:48
How would splitting the level up increase the polycount? - you'd simply cut it into manageable chunks, no need to add detail or anything. Basically, Memblocks won't do it, the only other way apart from splitting your level up is to use BSP's - which is like splitting your model up, only automatically.


Van-B

Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2003 22:10
Oh OK then, i'll try that method

Cheers

Once you start down the Dark Path, forever will it dominate your destiny...
Ravey
Retired TGC Developer
23
Years of Service
User Offline
Joined: 2nd Nov 2002
Location: Southern TGC Nerve Centre
Posted: 10th Oct 2003 23:26 Edited at: 10th Oct 2003 23:28
I used a portal system for my last game.
Basically split your level into rooms. GFX cards these days can push more polys so this method is very fast, BSP is good but check out Doom3 - they are only showing and hiding whole rooms at a time. BSP is a bit overkill these days and will likely end up slower than the portal method due to cards being able to handle more (and drawing one bigger mesh at once is going to be faster than drawing lots of smaller meshes).

Once you have the rooms you can build up a list of rooms that are visiable from each room (best way is to write an editor - even if it is one that lets you manually select which rooms are visible from each one.

Once you have a file with the visability data in you can just check each frame which room bounding box you are in, if its the same as before then you can leave the visability data as it is, if you have changed area then hide every room currently shown and show the rooms that can be seen from the current room.

Regards,
Dave Milton
Check out my games: Diode, Root, Binman & Skateboard Crazy
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 11th Oct 2003 01:11
Doom 3 uses a modified bsp format 4 maps, its based on the quake3 engine. bsp is far more efficient than portal rendering in some cases (at least i think it is )

I would use bsp but its very buggy, you cant do much with it either, a intersect bsp command would be very useful

Once you start down the Dark Path, forever will it dominate your destiny...
Ravey
Retired TGC Developer
23
Years of Service
User Offline
Joined: 2nd Nov 2002
Location: Southern TGC Nerve Centre
Posted: 11th Oct 2003 13:19
The modified format is using portals that are on a per room basis.

We were shown a couple of corking BSP demo's at the DB Convention. Have you tried messing around with different types of BSP - as in, Quake3, Halflife etc.?

Regards,
Dave Milton
Check out my games: Diode, Root, Binman & Skateboard Crazy
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 11th Oct 2003 14:37
I only use q3 bsps cos i dont like hl bsps very much, it takes a lot of messing about to get hl maps to work.

Dont get me wrong, BSP in dbpro is alright but you cant do anything with it cos you can only have 16 objects or cameras with collision enabled (If I put more than one object in a collision index collision cancels out and doesnt work anymore). And it lacks commands (like intersect bsp) so you can do bullet holes on walls, blood splatter etc.

Once you start down the Dark Path, forever will it dominate your destiny...

Login to post a reply

Server time is: 2026-07-26 05:02:38
Your offset time is: 2026-07-26 05:02:38