Greetings! I am about to start developing a game [and am quite serious about it =], and I figured the best way to have fast map rendering is a combination of "portals" and octree, since ogre octree would probably be slow with huge maps [no obstruction checking]. I have one or two questions about the "best" way for it to be done... 2nd paragraph is how i would like my game to work, 3rd++ are questions about how i would implement that. [note: maps would most likely be made in blender / exported to dotscene].
For my game, each map would have "rooms" and "portals"... Each room can have 1 or more portal, and each portal is in between exactly 2 rooms. A portal will be defined by the map creator as a plane, overlapping a relatively small area in the map [a door]. For each portal "plane", my program finds 4 points in the plane, which relate to the outermost polygons in that plane. The general idea with the portals is my program will calculate which portals are seen [and which portals are seen THROUGH other portals], and it will render the current room, and for each visible portal, the room behind it. This would be good for mostly indoor maps, but I would also like the possibility of outdoor maps as well. So, I was thinking the whole map [while still using "portals"], would be parsed to an octree... A map with a large outdoor area would have the outdoor area defined as one "room", and when it is about to be rendered, that room [and any others deemed to be seen through portals] would be parsed through the octree, removing any octree nodes that are not visible.
Now, I have thought of several ways that I could go about programming this with ogre... Do note that I would like to hopefully spare as much cpu as possible [so I dont mind if there is more than average overdraw] - the rest of my game will be somewhat cpu intensive... The first idea I had is to load the map with the octree scene manager... Each room would be a collection of meshes, and if a room was deemed to go from visible to non-visible by portals, that room's meshes would be turned invisible... That would be the easiest way for me, as I could use the octree S.M., and I would make the portal checking and just show/hide according meshes . Is this possible? Would it likely perform well? Is this not the best idea with ogre? Would I use entities / static mesh / world geometry?
The 2nd idea I had is to modify / reimplement the octree scene manager, to include these portals. This would probably be the "best" way for it to work, and it would be the most re-usable and modular, but it would be more difficult / take longer than the previous idea. I would only want to resort to this if the previous method would be too slow...
So, pretty much I'm looking for advice on if hiding meshes using my dumbed-down portals would work well with octrees [as in ogre's octree node parsing wouldnt account for meshes i've "hidden"]... I am thinking I will find portals in the current FOV, and find all visible rooms, hide any others, and then ogre would cull visible meshes [rooms] using octree... So, before I start code / learning more of ogre, I would very much appreciate any advice / suggestions for this. =]
Implementation of octree + portals question[s]
-
m2cengine
- Gnoblar
- Posts: 4
- Joined: Mon Jul 25, 2005 10:07 pm
- Chris Jones
- Lich
- Posts: 1742
- Joined: Tue Apr 05, 2005 1:11 pm
- Location: Gosport, South England
- x 1
i was doing a similar thing, and will be, after ive finished my game engine
the way i was doing it, was to try making my own scene manager, but trying to do so without breaking the interface was difficult, i ended up having to break the interface, altho im going to try again, a plugin would be much better
i think if you were going to go through every single mesh and make it visible or invisible, this would be slow. you could always just add functionality to the already existing scene manager. you could override the old function that finds the entities and adds them to the queue. that way you wont have it doing more work than it needs to.
i hope you manage to make this, will you release it so that everyone can use it?
the way i was doing it, was to try making my own scene manager, but trying to do so without breaking the interface was difficult, i ended up having to break the interface, altho im going to try again, a plugin would be much better
i think if you were going to go through every single mesh and make it visible or invisible, this would be slow. you could always just add functionality to the already existing scene manager. you could override the old function that finds the entities and adds them to the queue. that way you wont have it doing more work than it needs to.
i hope you manage to make this, will you release it so that everyone can use it?