Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAnfractu0us

Posted 14 January 2013 - 01:56 PM

Had a big post about using the inverse modelview but it doesn't actually appear to affect my output.

 

EDIT: After some goofing, I removed anything that would screw with my texture matrix(including disabling texture coord pointers/arrays.) I would say that my values for the matrix make sense now, but all in all it still doesn't work. I have a proper depth map, valid fbo, and I'm assuming to be decent values for my texture matrix. I'm really at a loss as to why it wouldn't be working, perhaps besides drivers or something silly that I'm overlooking.

 

EDIT2: Got it! For some reason I was sending the texture ID, not the texture UNIT to the shader. :S

[attachment=13233:butts2.png]


#5Anfractu0us

Posted 08 January 2013 - 05:23 AM

Had a big post about using the inverse modelview but it doesn't actually appear to affect my output.

 

EDIT: After some goofing, I removed anything that would screw with my texture matrix(including disabling texture coord pointers/arrays.) I would say that my values for the matrix make sense now, but all in all it still doesn't work. I have a proper depth map, valid fbo, and I'm assuming to be decent values for my texture matrix. I'm really at a loss as to why it wouldn't be working, perhaps besides drivers or something silly that I'm overlooking.


#4Anfractu0us

Posted 08 January 2013 - 04:45 AM

Had a big post about using the inverse modelview but it doesn't actually appear to affect my output.

 

EDIT: After some goofing, I removed anything that would screw with my texture matrix. I would say that my values for the matrix make sense now, but all in all it still doesn't work. I have a proper depth map, valid fbo, and I'm assuming to be decent values for my texture matrix. I'm really at a loss as to why it wouldn't be working, perhaps besides drivers or something silly that I'm overlooking.


#3Anfractu0us

Posted 06 January 2013 - 01:47 PM

Had a big post about using the inverse modelview but it doesn't actually appear to affect my output.


#2Anfractu0us

Posted 06 January 2013 - 07:44 AM

Getting a little closer. I've eschewed the technique used in the tutorial I linked to; As it doesn't run the same when I compile it vs. the provided binary I figure it's time to move on. My texture matrix appears to have decent values, and my depth map makes sense and is readable from what I understand. After adding a modelview matrix inverse, this is what I get now:

 

[attachment=13106:progress.png]

 

Though this result is similar to when my texture matrix had bogus data before. Here is my revised texture matrix setup:

	static double modelView[16];
	static double invmodelView[16];
	static double projection[16];
	// This is matrix transform every coordinate x,y,z
	// x = x* 0.5 + 0.5 
	// y = y* 0.5 + 0.5 
	// z = z* 0.5 + 0.5 
	// Moving from unit cube [-1,1] to [0,1]  
	const GLdouble bias[16] = {	
		0.5, 0.0, 0.0, 0.0, 
		0.0, 0.5, 0.0, 0.0,
		0.0, 0.0, 0.5, 0.0,
	0.5, 0.5, 0.5, 1.0};
	
	// Grab modelview and transformation matrices
	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
	glGetDoublev(GL_PROJECTION_MATRIX, projection);
	gluInvertMatrix(modelView,invmodelView);

	glActiveTexture(GL_TEXTURE7);
	glMatrixMode(GL_TEXTURE);
	glLoadMatrixd(bias);
	// concatating all matrice into one.
	glMultMatrixd (projection);
	glMultMatrixd (modelView);
	glMultMatrixd (invmodelView);

	// Go back to normal matrix mode
	glMatrixMode(GL_MODELVIEW);	
	glActiveTexture(GL_TEXTURE0);

And I modified the vertex shader:

// Used for shadow lookup
varying vec4 ShadowCoord;

void main()
{
ShadowCoord= gl_TextureMatrix[7] *(gl_ModelViewMatrix*gl_Vertex);	
gl_Position = ftransform();	
gl_FrontColor = gl_Color;
}

I haven't altered the fragment shader from the original.


#1Anfractu0us

Posted 06 January 2013 - 07:43 AM

Getting a little closer. I've eschewed the technique used in the tutorial I linked to; As it doesn't run the same when I compile it vs. the provided binary I figure it's time to move on. My texture matrix appears to have decent values, and my depth map makes sense and is readable from what I understand. After adding a modelview matrix inverse, this is what I get now:

 

[attachment=13106:progress.png]

 

Though this result is similar to when my texture matrix had bogus data before. Here is my revised texture matrix setup:

	static double modelView[16];
	static double invmodelView[16];
	static double projection[16];
	// This is matrix transform every coordinate x,y,z
	// x = x* 0.5 + 0.5 
	// y = y* 0.5 + 0.5 
	// z = z* 0.5 + 0.5 
	// Moving from unit cube [-1,1] to [0,1]  
	const GLdouble bias[16] = {	
		0.5, 0.0, 0.0, 0.0, 
		0.0, 0.5, 0.0, 0.0,
		0.0, 0.0, 0.5, 0.0,
	0.5, 0.5, 0.5, 1.0};
	
	// Grab modelview and transformation matrices
	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
	glGetDoublev(GL_PROJECTION_MATRIX, projection);
	gluInvertMatrix(modelView,invmodelView);

	glActiveTexture(GL_TEXTURE7);
	glMatrixMode(GL_TEXTURE);
	glLoadMatrixd(bias);
	// concatating all matrice into one.
	glMultMatrixd (projection);
	glMultMatrixd (modelView);
	glMultMatrixd (invmodelView);

	// Go back to normal matrix mode
	glMatrixMode(GL_MODELVIEW);	
	glActiveTexture(GL_TEXTURE0);

And I modified the vertex shader:

// Used for shadow lookup
varying vec4 ShadowCoord;

void main()
{
ShadowCoord= gl_TextureMatrix[7] *(gl_Vertex);	
gl_Position = ftransform();	
gl_FrontColor = gl_Color;
}

I haven't altered the fragment shader from the original.


PARTNERS