I’m sure when my engine will be done everyone will be using NV50 and 5Ghz cpu
Right now some Ati and 3dfx voodoo 3000 and below don’t use stencil buffers but all newer cards do, even my old permedia2 has a one bit/one plane stencil buffer.
So the question right now borders on efficiency. It can be argued that using a stencil buffer would be slower than the actual splitting and I don’t know about that because I haven’t coded it yet. You can also argue that splitting walls leads to inefficient design and creates too many triangles.
I think the real question here is “Does the use of the stencil buffer lead to cracks between the portals?” I will soon know since I’m coding it right now. I just wanted to know if anyone has done this before and can share his experiences with me.
But just because you break up a wall of Room A doesn’t mean you have to split the room into several smaller sectors. One way to do it is to have a variable, IsBroken or whatever, for each face of each room. If a face is broken up, IsBroken = true, and you have a list of triangles that you render instead of that one whole face. So, the wall you described would be rendered using 8 triangles instead of two, but Room A is still just one sector.
Again, I don’t think people understand me so I will explain once more
I “DO NOT” WANT TO SPLIT THE FACE THAT WILL SHARE PORTAL OF THE ADJACENT ROOM IN ANY WAY IN ANY SHAPE OR FORM.
Now the question comes to mind how will you be able to look into the next room when in fact all the faces in the current room are opaque? Easy, use the wall of the adjacent room as a portal poly and make a stencil mask out of it then render the wall of room A that shares the portal with room B using this mask so when done the entire wall will be drawn except for that masked off section which will now allow you to see into the next room.
Have you heard of using the stencil buffer to do CSG? It’s almost the same thing except I keep the cell/room polys as one sector and using portal technigue I will eventually use the frustum culling to limit the processing/drawing of adjacent cells by clipping the future portals with the frustum making the portals smaller and smaller. Each portal will have adjacency graph with the cells that are adjacent with this portal.
Sure I could use a leafy bsp tree to store the cell polygons and perhaps be lucky coming up with an algo that allows me to cut only one wall instead of all the walls in the cell but still this is cutting thus creating many extra polygons that wouldn’t needed to be created in the first place if I used the stencil buffer.
If I had a leafy bsp this is how I would proceed:
1)Take one face of room B and use it to cut room A into two 3D cubes.
2)Take the next face of room B create a plane out of it like in step 1 and cut only ONE of the two cubes of room A that were created in step 1. Now we have three 3D cubes of room A. (Please see Genesis3D if you don’t understand how this is done.)
3)Take the third face of room B and again cut up the only ONE cube of room A and again and again until we have four cubes of room A leaving a hole in the adjacent wall of room A with room B.
Do you see that this process is lengthy and leads to many cuts. I could also limit this to only cutting of the adjacent wall of room A and not the whole room but I havent’ evaluated the algo yet for its stability. So the best we can do is cut up one wall of room A into four pieces(convex) i.e. 8 triangles. Why go through all this when we can mask off only a small portion of the wall i.e. the portal poly and draw the entire wall even not bother to change the texture coordinates at all. You see the advantage? Whew What do you guys think?