PORTALs!!

Started by
34 comments, last by Esap1 24 years ago
Do any of you know of any portal Tutorials that deal with Hardware Acceleration, or Direct3D. Does anyone have any tips. I understand how to do it if I were writing a software engine, but Im not. Could someone breifly explain to me the steps to do it in using Hardware+Z-Buffer. Or just the steps you might use in DirectX. Thanks in Advance!
Advertisement
I don't quite understand what it is that you're asking. You say that you know how to do it if you're making a software engine, well the only thing OpenGL or DirectX does for you is rendering the triangles and recently DX has also added the ability to clip them for you.

The Z-buffer is just a simple way of sorting the triangles so that the closest ones are visible instead of the others. You can use this to releave the cpu of some of the work of clipping the triangles as you no longer need to clip exactly to the form of the portal.

You should be able to use the knowledge you already have and exchanging the rendering part for their counterpart in DX.

I believe FlipCode has a tutorial on making portalengines but I haven't read it so I cannot say if it will help you or not.

Edited by - Spellbound on 3/21/00 5:26:05 PM
In a portal engine you check to see if any portals are visible, then draw the cell that that portal connects and clip it to that portal. What Im asking is if you can tell DirectX to clip to a Polygon(get it?). And is there a way for DirectX to tell me if a poly is visible, or will I have to do that myself?
figure it out yourself. The way I did it is I just divided my world into a 2d grid and rendered the poly''s in the players position. I have my triangles. I have an array of indicies in a seperate variable. I have a function that gets which sector you are in and converts it into an index of the SectorIndicies array. Then I loop through all of the SectorIndicies and check which poly is to be rendered. Note: I don''t compile my primitives.
I think I get it, but how do you find if a portal is visible? And do you render all the polys in a cell behind a portal?, is there a better way?
You need to check if the portal is visible yourself. You can let DX do a check for visibility, but I think it involves checking each pixel against the z-buffer, which in my mind is not that effective.

DX, and OGL for that matter, can only add planes that polygons are clipped to. I''m not how many of these planes that can be added. You need to figure out their position yourself by looking at the position of the camera relative the polygon.

Because clipping can be a bit slow I would recommend that you only clip the cells behind a portal to a bounding box (only 4 clipplanes that are axis aligned) instead of clipping to the edges of the portal. The z-buffer will keep the polygons in the right order.
I THINK I FINALLY UNDERSTAND WHAT YOU ARE SAYING!!!
Are the 4 Clip Planes Cliping 2D XY Corridinates on a bounding box around the portal?(I HOPE I GOT IT!)
yes
If what esap1 is saying is how to do portals, then I''ve already done it in my game! Nifty.

BTW: I think the moderator modified my gamedev=non y2k compliant thing. I''d like to know why. Oh well, it was funny anyway.
So... To implement it in DX, add 4 clip-planes that originate at the viewpoint, and go through each of the 4 edges of the portal. At least that''s how I did it.

This topic is closed to new replies.

Advertisement