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.

Program Announcements / Octree Culling Plugin V1.0

Author
Message
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Jan 2008 13:31 Edited at: 26th Jan 2008 10:00
This plugin will allow you to have an (almost) limitless level, with as many rooms/areas as you need. It uses a special type of culling, where you create a tree of different elements in the scene.

UPDATED

Example:

Level (Portals to Hall through Door to House)
- Door to House
- House
-- Hall (Portal to Kitchen through Kitchen Door, and to Level through Door to House)
--- Vase
--- Cupboard
-- Kitchen Door
-- Kitchen (Portal to Hall through Kitchen Door)
--- Counter
--- Cooker

Once you have built this tree, the plugin will automatically hide and exclude the objects and limbs which are not visible, and show those which are visible.

Command list:


Section 0 is the root section.
Once you have created a section, you would normally add a number of objects and limbs, to be culled with that section, using 'OT_AddObject' and 'OT_AddLimb'.

I have fixed Math89's example, and altered it to work with the latest version:


HERE is the download. Put the .dll in your 'compilerplugins-user' folder, and the .ini in the 'editorkeywords' folder.

Attachments

Login to view attachments
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 20th Jan 2008 15:29 Edited at: 20th Jan 2008 15:35
Intersting dll, thank you .

I just have a little problem : I want the little room to be hidden when I'm not looking at the door of the house, is it possible ? I don't think so, because the room is inside bounding box of the house.



Edit :
-To see the correct result of OT_Visible(), you need to add a mask to the integer in order to get a byte : visible = OT_Visible(...) && 255
- What is the 'mode' parameter of the OT_Create commands ?
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Jan 2008 16:40 Edited at: 20th Jan 2008 16:41
Sorry about that, I didn't test portals between sections with different parents properly. I have fixed the problem, and will reupload it in a minute.

OT_Visible is not guaranteed to return 0 or 1. It returns true or false. Any non-zero value represents true.

The mode parameter can be either 1 or 2. 1 represents an area, or container, and not an actual solid object. This is the default. 2 represents a room, and is opaque. If you are inside a room, it automatically hides any objects outside the room, unless there is a visible portal between them For your example, you would use 2.

edit:
Uploaded

Reality Forgotten
FPSC Reloaded TGC Backer
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Wichita Falls TX
Posted: 20th Jan 2008 18:55
This may be a dumb question, Will this work for .x models or do you have to use the create object command?


Cheers,
Dave


Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Jan 2008 19:17
The culling has nothing to do with the shape of the object. You either create a virtual sphere or a virtual box in the culling engine to represent your object, limb, or group of objects and limbs.

Reality Forgotten
FPSC Reloaded TGC Backer
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Wichita Falls TX
Posted: 20th Jan 2008 19:28
Ok, thanks for answering my question.


Cheers,
Dave


Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Jan 2008 00:29
Awesome man, I'll test this when I get caught up. Thanks, this could save me alot of coding later on

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Jan 2008 17:56
@LiT
Thanks Your limb culling code was helpful when I was trying to calculate the frustum from the camera data

Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 22nd Jan 2008 21:37 Edited at: 22nd Jan 2008 21:38
Diggsey this plugin looks very promising! Just need to test if it works as expected. Thanks in advance. This is just great! It will improve rendering of our games greatly.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.6b
Sid Sinister
18
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 24th Jan 2008 06:09
How does an Octree culling system compare to a quadtree?

"If I have seen a little further it is by standing on the shoulders of Giants" -Isaac Newton
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 24th Jan 2008 07:17
Quote: "How does an Octree culling system compare to a quadtree?"


Octrees can be subdivided into 3D space, quadtrees cannot.


Also this is a very nice plugin, it will work very well with FPS games. Though your example could be much better :p, I had to edit Math89's example with your new extra flag to see what was happening.

However to make it work perfectly with FPS games and such you should add some feature to find the visibility for any given point or point with a radius(a temporary one so you don't have to make/delete a sector), this would speed up certain visibility checks for bullet holes for instance. However such a feature will likely need to automatically detect which section of the world you're in.

Also instead of having to feed in the position and size values all the time having an optional command where you merely supply the parent, object ID and mode then the DLL automatically reads the position and size would be beneficial for most games(of course there are times when the current method is more beneficial).

Furthermore I haven't tested it but judging by the commands all sectors are assumed to be static? The ability to move objects (i.e. physics objects) would be beneficial, and with some moving objects whose positions cannot be easily constrained you may need an optional flag to allow the item to hop parents automatically.

Lastly the ability to construct a single sector using multiple primitives would help for complex scenes(so it gets treated as one sector), as well as a way to automatically insert portal sectors and have the plugin detect which sectors it's intersecting and set them up as a portal. Because in its current state it's a bit too complicated for most people, plus you'd need a pretty good level editor to setup some scenes I'd imagine.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th Jan 2008 18:12
@dark coder
Many of those suggestions I had already planned for the next version, but there are two that I'm not sure about.

Since you can add an individual limb to a sector, I don't see the need for multiple shapes per sector. If you have a very complicated shape, it is wise to divide it up into limbs, otherwise if you can see any part of it, it shows all of it. Also, multiple shapes for just one mesh is not a particularly efficient way of culling. I will think about it, but I will not add this yet.

How can it auto-detect portals? A portal could be anything that you can see through, such as a door or window. I don't think the current method is that complicated, but if you suggest a good way to do it, I may add it later on.

All the others will be added, in addition to a way to disable/enable portals to make it easy to open/close a door, and a few more commands to get/set information about things.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 24th Jan 2008 18:44
Quote: "How can it auto-detect portals?"


If I have two opaque rooms next to each other and add a container which I know will be a portal between them, it intersects both of these rooms and I know this new container will act as a portal between the two and set it up as so. This would make it much easier for people's map editors as the current method essentially requires the mapper to either specify both rooms for each door/window or do the same intersection check manually.

Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 24th Jan 2008 22:19
Interesting discussion and obviously a very useful plugin. As soon as I'll return to 3D-games I will most likely use it.. I always looked for such an easy way of culling. But I probably won't start anything in 3D within the next few months... so there's enough time for you to add new features and polish everything.
Good work, like always!

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Jan 2008 01:11 Edited at: 25th Jan 2008 01:13
UPDATE

The command count has more than doubled, and a serious bug with how it handles the heirachy with portals has been fixed You must always remember, that if you create a house (for example) a portal into the house should connect to the hall, or whatever room is on the other side of the door, rather than the house itself.

Changes:
Most of the above suggestions
Lots of new set/get commands
Portals have their own IDs

I have fixed Math89's example, and altered it to work with the latest version:


I will update the first post shortly...
Done

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jan 2008 00:14
Does anybody have any more ideas for future improvements?

Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 28th Jan 2008 18:20
Yes I have, it's about culling the portals. In a lot of cases a portal is rendered because it's in the camera view, but behind a wall. I would like the portals beeing processed only if they are in the same room as the camera or if they can be seen through an other portal.
It may be rather hard to do (or maybe just too slow), but it could be a big improvement.

And thanks again for this plugin .

Attachments

Login to view attachments
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 11th Feb 2008 10:38
Diggsey, Hey man,
Great work, are you going to port it to GDK?! Would be great mate
Quote: "Does anybody have any more ideas for future improvements?"

GDK version would be cool
Cheers,
-Try
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 11th Feb 2008 12:17
Diggsey,

Awesome Plugin!!! Totally solved my optimization delima --> BSP

For those interested in automating the Tree Building process, I'll share my technique I plan to implement. Build the entire scene (structures and props) in a single file using a 3D Animation Editor (ie Cinema 4D). The editor is used to draw both visible (walls, furniture, etc) and non visible geometry (collision and cull boxes). Structures and props are limbs within the single file.

Objects are catagorized and labeled using a special prefix, used by the engine organize and manage them differently. The engine calculates the position and size of the limbs, creating a OT_Box for rooms & props etc and OT_Portals for doorways & windows.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Feb 2008 12:31
@Try
I will do that, it's not too hard

@TechLord
I'm glad it is useful for you, but make sure that you create the octree correctly. Portals will only provide a speed increase if it is connected to at least one 'room' area. 'room' areas are created when you use 1 as the last parameter. If you create a room area, you should only assign an object or limb to it if that is the interior wall to the room. Everything inside the room should have its own area and be a child of the room area. It's difficult to explain, but if you are unsure, you can email me the code and I will let you know if you are using it correctly

Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 11th Feb 2008 21:12
Quote: "I will do that, it's not too hard"

Wow, good to hear it

Cheeeers,
-Try
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 15th Feb 2008 07:11
Diggsey,

My intention is to implement the Octree Culling in my MORG/FPS. The game will feature both indoor and outdoor areas. I have a fairly good idea on how to implement the OctCull system for indoor areas, however, outdoor implementation posses a challenge. Any suggestions would appreciated.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Feb 2008 10:40
@TechLord
You just create a normal area around each house/object/group of objects. If it is a house, then each interior room of the house would be a child of that house. Each object in each room would be a child of the room. When you create the front door portal, make sure you create it so that it links between the outside, and one of the interior rooms, NOT the house itself.

TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 18th Feb 2008 18:24 Edited at: 1st May 2008 18:28
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 1st May 2008 18:29
Hi Diggsey,

I don't know if you're taking request. I'm wondering if its possible to dynamically add and remove objects to/from the scene. In my experiments, I added the big and little boxes to the room after I constructed the rooms + portals and was updating the Frustum, but, the boxes failed to render.

My reason for this feature would be to optimize rendering by culling particles, character meshes, etc not visible to the camera. I have ideas for homebrewed solution using camera-vs-zone collision, but would prefer to utilize this high performance culling system.

Login to post a reply

Server time is: 2024-04-18 22:32:38
Your offset time is: 2024-04-18 22:32:38