# back projections - clipping planes

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

## Recommended Posts

how do i extract planes for plane clipping for my projective textures in OGL? i guess glClipPlane is in world space?

##### Share on other sites
okay, here's the new problem:

http://mathewstwins.customer.netspace.net.au/temp/leftPlane.JPG

the red line show where the left clip plane should be, as you can see the left plane is bent out left more.

i used the plane extraction from here:
http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf

i double checked these values, so im wondering if its my lights transform is screwey possibly?

just to show you (the right clip plane is correct):
	// the following are plane extractions from matrices	// http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf	void ExtractLeft(Matrix4& transform)	{		p[0] = transform[3] + transform[0];		p[1] = transform[7] + transform[4];		p[2] = transform[11] + transform[8];		p[3] = transform[15] + transform[12];	}	void ExtractRight(Matrix4& transform)	{		p[0] = transform[3] - transform[0];		p[1] = transform[7] - transform[4];		p[2] = transform[11] - transform[8];		p[3] = transform[15] - transform[12];	}

and this is how i setup my projective texture:
void ShadowLight::SetTextureProjection(){	Camera& camera = *Engine::GetInstance()->GetRenderMgr()->GetActiveCamera();	Matrix4 mBias(0.5, 0.0, 0.0, 0.0,				0.0, 0.5, 0.0, 0.0,				0.0, 0.0, 0.494, 0.0, //offset bias so we dont need polygonfill offset				0.5, 0.5, 0.5, 1.0);	glMatrixMode(GL_TEXTURE);	mBias.Set();		gluPerspective(45.0f, 1.0f, 1.0f, 6.0f);	Matrix4 trans = GetTransform();	trans.SetM();	Matrix4 temp;	temp.LoadCurrent(GL_TEXTURE_MATRIX);	SetClipPlanes(temp);	Matrix4 cam = camera.GetTransform();	//cam.Inverse(); //Transpose();	cam[12] = 0;	cam[13] = 0;	cam[14] = 0;	cam.Transpose();	glTranslatef(camera.GetPosition()[0], camera.GetPosition()[1], camera.GetPosition()[2]);	cam.SetM();	glMatrixMode(GL_MODELVIEW);}void ShadowLight::SetClipPlanes(Matrix4& transform){	// http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf	Plane left, right, top, bottom, farp, nearp;	left.ExtractLeft(transform);	right.ExtractRight(transform);	top.ExtractTop(transform);	bottom.ExtractBottom(transform);	farp.ExtractFar(transform);	nearp.ExtractNear(transform);	left.Normalize();	right.Normalize();	top.Normalize();	bottom.Normalize();	farp.Normalize();	nearp.Normalize();	left.BindClipPlane(1);	right.BindClipPlane(0);	top.BindClipPlane(2);	bottom.BindClipPlane(3);	farp.BindClipPlane(4);	nearp.BindClipPlane(5);}

• 21
• 15
• 9
• 17
• 13