How to I implement occlusion in a B3D game?

Blitz3D Forums/Blitz3D Beginners Area/How to I implement occlusion in a B3D game?

WarpZone(Posted 2004) [#1]
I've seen some great blitz demos featuring pretty graphics and working FPS physics, but these seem to draw ALL of the polygons in the world.

I have heard certian tools can be used to create indoor maps with BSP-like culling and occusion. Is that data included within the B3D format, or would I need to use a different file format, like .x or .3DS? Or is the culling/occlusion data stored in an external file of some sort?

I'm pretty much asking the usual, here. How do I do it, what tools will I need, how many competing tools are availible for me to choose from, etc.

Ideally, I would like to be able to use good old Milkshape to model everything, from my characters to my indoor environments, export them to B3D, polish them up in B3DTweak and render them as-is. If this is not possible, then I'd like to know how to get from Milkshape to optimized 3D worlds with as few extra steps as possible, and while buying as few extra tools as possible.


Beaker(Posted 2004) [#2]
http://www.blitzbasic.com/Community/posts.php?topic=34893

The only map making tool that offers any form of built in occlusion is quill3d. If you want to buy it and are in the UK you can buy mine cheap. :D

The BSP file format offers occlusion, but has many limitations, the main one being the licensing issues.

My recommended tool path is:
1. Milkshape
2. gile[s] for lightmapping and setup
3. portalpal for occlusion (I am biased)

Good luck in your search.


jhocking(Posted 2004) [#3]
MasterBeaker, is portalpal the occlusion tool you are working on? How long before it's done?

Right now the best way to do occlusion culling is by hiding/showing entire chunks of your level based on where the player is, with occlusion zones setup manually or perhaps a fast visibility check. Don't worry about overdraw; with modern graphics cards the key is to quickly chop the scene down into a reasonable number of polygons for the video hardware, as opposed to wasting a lot of time and effort nitpicking exactly which polygons can and cannot be seen.


Beaker(Posted 2004) [#4]
It was finished when I posted the demos. But, due to lack of time (and partly lack of interest, and some hostility about selling stuff, from other blitzers) I've not had chance to setup a website etc.

I'm also considering adding an auto-slice feature. I personally don't think it needs it, but I suspect I would come under much criticism without it.

Time will tell.


WarpZone(Posted 2004) [#5]
Okay... so the PortalPal source was lost in a hard drive crash, and Blitz's linepicks turned out to be so slow that the optimized app ran slower than the original version anyway?

If I'm understanding you right, I should just make my world out of discreet rooms that can't see each other and code it into my app?

How do I do a "fast visibility check?"


jhocking(Posted 2004) [#6]
You don't have to be as anal as rooms that can't see into each other, just descrete rooms which you turn on/off based on which can be seen. As for "fast visibility check," there are a number of possible tricks which could be useful depending on your game/level. For example, Project Plasma was doing something with color coding the rooms and seeing what color pixels are rendered during a first render pass. You might also find the LineOfSight3D function from the code archives useful.


WarpZone(Posted 2004) [#7]
Hmmm... so it would be kinda like Sectors in Serious Sam... they auto-occlude each other if you can't see from one sector into the next, so it's kind of up to the mapper to to seperate sectors inteligently.

If each big chunk of level is a seperate model or entity, or something, would it be possible to simply return if they are visible or not using LineOfSight3D?

I'm trying to think of a way to make it happen, and so far the best thing I can think of would be to create a list of all the rooms(models) on level startup and then turn them off if they are NOT in LOS, and include some kind of entity in the background beyond even the skybox, and re-display all the room/models again and then cull the ones that weren't drawn.

I haven't the foggiest idea how to actually do that, though. :P I need to learn the programming side of Blitz more befoire I start trying to do something like that.


jfk EO-11110(Posted 2004) [#8]
>>and some hostility about selling stuff, from other blitzers<<

Cmon - you are free to do what ever you want. I thought it would be nice to see some freeware tools from time to time.

Personally I would deal with occlusion in a manual way:

Create a tool that displays your entire huge super map. Then you can open boxes with the mouse (ala Maplet) and cover zones with such boxes. You don't need to make every room a zone, think of 5 to 10 thousand polys per zone. Use overlapping boxes and cover the whole map. Then the app can parse all boxes and check if one of the 3 Vertices of a Trianlge is inside a box. It will then create a mesh for each box, containing all neccessary Triangles. In the Game you will only have to ask if the player is inside the xyzwhd of one of the boxes and show that box and hide all the other ones.

This is the easiest way IMHO and considering that you spent maybe a week or more to create the Map Mesh, you shouldn't worry about 5 Minutes of Zone Boxes definitions.