View Full Version : clipping plane equation

JanHH

12-16-2003, 11:12 AM

Hello,

I need an additional clipping plane in my 3D scene which is parralel to the x axis, parallel to the z axis and has an y coordinate of 5, and everything with an y coordinate >5 should be drawn, and everything with y<5 should be clipped.

I have no idea how to set up the clipping plane equation, I do not understand what a plane equation is at all.

Can anybody help?

Thanks

Jan

(mostly copypasted from an online tut)

>>>>>>>>>>>>>>>>

The four coefs of the plane equation :

Nx, Ny, Nz, D

Formula :

Nx*x + Ny*y + Nz*z + D = 0

where Nx,Ny and Nz are the 3 components of the normal to the plane. The x, y and z in the quation are the co ordinates of any point on the plane. The variable D is the distance of the plane from the origin. A point that is being tested can give three results based on where it is with respect to the plane.

1. The point is in front of the plane - In this case, the result obtained will be positive. The value obtained is the distance of the point from the plane being tested.

2. The point is behind the plane - In this case, the result will be negative. The value obtained is the distance of the point from the plane being tested.

3. The point is on the plane - The result will, quite obviously, be zero.

<<<<<<<<<<<<<<<<<<<

So, in your case, the normal to the plane is pointing downwards, and the offset D is 5.0 :

double equ[] ={ 0.0 , -1.0 , 0.0 , 5.0 };

should work but untested.

Beware, some people write the plane equation this way :

Nx*x + Ny*y + Nz*z = D

So you may have to negate D, ie :

double equ[] ={ 0.0 , -1.0 , 0.0 , -5.0 };

Just a guess, are trying to do your terrain reflections ? http://www.opengl.org/discussion_boards/ubb/smile.gif

JanHH

12-16-2003, 03:29 PM

thx http://www.opengl.org/discussion_boards/ubb/smile.gif

Yes I am adding terrain reflection, at the moment "only" the water.. already works, looks quite good, I will post a link soon.

Jan

JanHH

12-17-2003, 03:05 AM

screenshots (although I already posted them in the other thread, but noone seems to look http://www.opengl.org/discussion_boards/ubb/wink.gif ):

http://de.geocities.com/westphj2003/refl.html

Jan

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.