Leadwerks engine portal system

Community Forums/Showcase/Leadwerks engine portal system

JoshK(Posted 2006) [#1]
Here's what I have been working on.

This demo presents the engine's portal occlusion system:
http://www.leadwerks.com/ccount/click.php?id=27 (41.3 mb)

Patch for faster loading:
www.leadwerks.com/files/enginepatch1.zip

HOW TO RUN IT
Use a .bat file to launch any map in the engine. If you get a virus warning, disable your anti-virus program. This is a known error with Avast.

WHAT TO LOOK FOR
Use wireframe mode to see how the portal system works.

Set your 3D World Studio textures, mesh, and map paths to the engine directories. Open "simple_portals.3dw" in the editor. The map is split into two portalzones. Everything within the portalzone is clipped and treated as one "chunk". The portal brush connects them, and only has one face that isn't deleted. When the camera is in one portalzone, the adjacent portalzone is only visible if the connecting portal is in the camera frustum. Models in the adjacent portalzone are only visible if they can be seen through the connecting portal.

If you want to make an indoor/outdoor map, add a portal brush that only touches one portalzone. The outside world is treated as one big default portalzone, and any one-sided portal will connected to the outside.

CONTROLS
W - toggle wireframe
S - toggle stats
space - toggle materials
L - toggle lights
C - toggle colors
B - show hidden geometry
P - toggle portal culling
F - toggle frustum culling

KNOWN BUGS
Memory leak

Leadwerks forum topic:
http://www.leadwerks.com/forums/viewtopic.php?p=7221#7221




fredborg(Posted 2006) [#2]
Hi,

It seems nice! I get some terrain popping and a fence going transparent, but apart from that it seems to work fine.

It opens a bit weird, not in full screen but in the top left corner of my desktop...

Transparent fence:



WedgeBob(Posted 2006) [#3]
Ah, okay, when I saw this thread at first, I thought you were trying to do like what Prey and HL2: Ep 2 with portal technology similar to theirs. Thanks for the clarification. If it were me, I'd try those gravity tracks next, those'd be awesome...


maximo(Posted 2006) [#4]
anazubg granisc :)


jfk EO-11110(Posted 2006) [#5]
Congrats - I hate this stuff :) Especially because (as I already mentioned) if I once made my Occlusion work, hiding and showing things was still slower than simply leave them clustered and let Blitz occlude them as good as it gets.


JoshK(Posted 2006) [#6]
This is BlitzMax and OpenGL by the way, not Blitz3D.


IPete2(Posted 2006) [#7]
Nice... :)

IPete2.


Naughty Alien(Posted 2006) [#8]
Complex not working, previous Simple_portal , working fine but not fullscreen but left upper corner of screen..


JoshK(Posted 2006) [#9]
Don't worry about the window placement. That is just so I can do other things while it is loading.

The complex map just takes a long time to load.


t3K|Mac(Posted 2006) [#10]
complex not working here too. just popping up the engine's window and closing again. thats it.


nrasool(Posted 2006) [#11]
complex portal is not working for me, just seems to stay on the black screen saying "Loading", even thou it been sitting there for 6 mins with no HDD activity :(


JoshK(Posted 2006) [#12]
It seems that the longest step when loading is processing lights on all models the first time. This takes more than one minute on my machine.

The engine lights models a bit differently than the editor. In the editor, I calculated lighting for each vertex. In the engine I am just doing a single visibility check between the center of the model and the light position, and using hardware lights on the entire model. This gives slightly less accurate lighting than coloring each vertex, but the upside is that static and dyanmic lighting are just the same, for models. It also means that the mesh color array can be used for bumpmaps. HL2 uses this same exact method. You'll notice their models are either lit completely by any given light, or are unaffected.

A good solution would be for the engine to process the lighting once, then save the results to a file that goes along with the .3dw file. You will only have to do the slow light processing once any time you change the map. After that, the editor will detect and load the associated light info file.


JoshK(Posted 2006) [#13]
This patch will make it so lighting only has to be processed the first time you load a map. The data is saved to a .lit file, associated with the .3dw map. If the number of entities or lights in the file changes, lights will be reprocessed. You can also just delete the .lit file to reset lighting.

I included the two .lit files for you, so the maps will load much faster:
http://www.leadwerks.com/files/enginepatch1.zip


puki(Posted 2006) [#14]
I'm going to have a go on this tomorrow.


Red Ocktober(Posted 2006) [#15]
complex worked ok here... GeForce6100... took a lil while to load, but showed performance effect of portals when inside and outside of the buildings...

verrry decent stuff... looks great... and useful for a fps type environment...

question... portals and moving interiors... will it work if i have and interior that rotates...

what about if an interior moves along the x, y, and z?

--Mike


JoshK(Posted 2006) [#16]
I haven't thought about moving portal systems, but I suppose it would work. What would be the application?


Red Ocktober(Posted 2006) [#17]
a ship or large vessel moving... like an aircraft carrier...

if it's not already implemented, don't get distracted with it now... not important as it can be circumvented...

how's the engine coming?


--Mike


JoshK(Posted 2006) [#18]



JoshK(Posted 2006) [#19]
www.leadwerks.com/files/EnginePatch2.zip



Added cubemap reflections, corona, env_cubemap entities.

Some info on here:
www.leadwerks.com/developer/

Go to entities>corona and env_cubemap.

Don't have time to type everything but, but it will grow.

Let the good times roll!


t3K|Mac(Posted 2006) [#20]
complex not working. just opens window, says "loading..." and the same moment it closes again. thats it. no error message no demo no nothing.


Drey(Posted 2006) [#21]
Is this your openGL project or is this Blitz3d?


Regular K(Posted 2006) [#22]
Is this your openGL project or is this Blitz3d?
->
This is BlitzMax and OpenGL by the way, not Blitz3D.



Drey(Posted 2006) [#23]
I'm lil curious why this is running at 15 fps sometimes on my x1900xt?(yes latest drivers) Portals only slow things down on my system too. But i figure that's just because the power of the card outweights the performance of the CPU checking for visible objects.


JoshK(Posted 2006) [#24]
Well I sped it up to 50-60 FPS. Keep in mind this scene was supposed to be demanding, and is likely to run slowly.