Sign in to follow this  
Razor89

Direct3D Frustum and/or Portal Culling

Recommended Posts

Razor89    134
Hello! I am looking for some working examples of Frustum and Portal Culling in DotNet (Managed Direct3D), I however have not been able to construct the code on my own (never works for some reason) thus I have come to the conclusion I need some code some elses thats working (C# or VB.NET in paticular), I have looked through the Axiom3D code but no luck, the code seems to be too large and complex to learn out of. My ultimate goal is to build a Tomb Raider (The original series, 1-5) like engine which heavily relies on rooms linked together by portals. If somebody could please point me in the right direction, I will be eternally grateful :D (Remember: Managed code, I might be doing it wrong but code from other langagues doesn't seem to work, perhaps Managed DirectX handles things differently?) Thanks a bunch!

Share this post


Link to post
Share on other sites
Illco    928
First of all, frustum culling has little to do with the underlying API you are using. It is (currently) part of the software application you write and you will, to my knowledge, have to do it by hand.

This site offers some good information, though at the time of writing it is offline. For portal culling, I'd suggest you first seek out frustum culling. This is the process of defining a view frustum by six planes and rendering only objects that are in the frustum. Portal culling extends upon this, by rendering each cell with an adjusted 'frustum'. The current cell is rendered using the normal frustum; subsequent cells use a frustum that is clipped by the portal the cell is viewed through.

Greetz,

Illco

Share this post


Link to post
Share on other sites
Razor89    134
So I have to compute a view frustum for every portal polygon and repeat the process???

And as for portal culling, I can compute the view frustum in Direct3D from using
OpenGL code as reference? (Although I've heard Direct3D and OpenGL handle coordinates differently)

Share this post


Link to post
Share on other sites
Saruman    4339
Quote:
Original post by Razor89
(Although I've heard Direct3D and OpenGL handle coordinates differently)

RH vs. LH coords so the winding is backwards but the logic is the same.

Share this post


Link to post
Share on other sites
Razor89    134
Quote:
Original post by Saruman
RH vs. LH coords so the winding is backwards but the logic is the same.


So -1.0 becomes 1.0 and 1.0 becomes -1.0 for example?



Share this post


Link to post
Share on other sites
Saruman    4339
No the winding order for culling changes between CCW and CW.

So in DirectX if you are rendering a triangle by giving the points in the order of: tA, tB, tC than in OpenGL you would order them tC, tB, tA.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this