#### Archived

This topic is now archived and is closed to further replies.

# Hey, Spellbound, (or anyone who can answer:))

This topic is 6774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im using the same way of setting up Clipping Planes as they do in the ClipMirror Example in the DX7 SDK. Well, They have a helper function that takes 3 points to a triangle, I beleive, and creates a plane from the Triangle, and gives it to SetClipPlane(). Now, Because it Clips in 3D(right?), if I put the ClipPlanes on the sides of the portal(How exactly do I do that?), Would it look ok?. Thanks a lot for your Help. PS: Just for anyone who couldnt tell, Im trying to make a portal Engine

##### Share on other sites
Well, how could I possibly ignore this question.

To use clipplanes to clip to the edges of the portal, you should use the camera position and the edge vertices on the portal to compute the plane.

To compute the plane do this:

VECTOR C; // Camera position
VECTOR E1; // Edge vertex 1
VECTOR E2; // Edge vertex 2

VECTOR N; // Plane normal
float d; // Planes distance from origo

N = Normalize(CrossProduct(E1-C, E2-C));
d = -DotProduct(C,N);

float Plane[4] = {N.x, N.y, N.z, d};
pD3DDev->SetClipPlane(PlaneIndex, Plane);

Remember that the plane normal should point into the visible frustum so you may need to swap the arguments to CrossProduct depending on the ordering of the vertices on you portal.

I hope you haven't forgotten my suggestion to let DirectX clip with the viewport edges instead of with clipplanes. The advantage of this is that the clipping equations are much easier, hence faster, and there are always only four clipplanes.

The are drawbacks with clipplanes; you can only have a maximum of 32 planes and they are slow. So you should try to minimize the amount of clipping performed during the rendering. My suggestion is that you only use clipplanes for the surfaces of mirrors and clipping portals (like those in Quake 3).

Edited by - Spellbound on 4/6/00 5:42:35 AM

##### Share on other sites
Spellbound knows everything... he is a fountain of knowledge...

Programming::~Fredric(const Annoy_Ance)

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632992
• Total Posts
3009755
• ### Who's Online (See full list)

There are no registered users currently online

×