Dynamic Cube Map error

Started by
4 comments, last by duhroach 20 years, 11 months ago
Howdy all I've got dynamic cube map creation up and going, but i'm getting an error when trying to map it. It seems that no matter how i translate my camera, I always get the same reflection happening in the sphere. Do i need to render my dynamic cube map in relation to the global camera position? or atleast map the cube in relation to the camera position? what's wrong? image ~Main [edited by - duhroach on May 4, 2003 5:26:46 PM]
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
Advertisement
try the render state D3DRS_LOCALVIEWER
The cubemap itself looks OK, at least from your image. But you don''t seem to get the right reflection vectors, when rendering the little reflective sphere. Are you sure you''re using the right texgen mode, such as REFLECTION_MAP(_ARB) ?
well, i'm using GL_REFLECTION_MAP_EXT on the first pass, for specular, then using GL_NORMAL_MAP_EXT on the 2nd pass for the (Diffuse*ambient) term.

I'm not sure where the error is that I'm running into, it seems as though i am supposed to somehow orient the cube map calculation based upon the movemnt in the camera? I didn't think it works that way, but according to what my demo is doing, i need to. What am i doing wrong here?

just for S&G here's how i'm doing it

      inline void OBJECT::IBLRender(int worldID){	glColor4f(1.f,1.f,1.f,0.f);	glEnable(GL_TEXTURE_GEN_S); 	glEnable(GL_TEXTURE_GEN_T); 	glEnable(GL_TEXTURE_GEN_R);		glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); 	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); 	glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT); 	//tex0 is our WORLD	glActiveTextureARB(GL_TEXTURE0_ARB);	glEnable(GL_TEXTURE_CUBE_MAP_ARB);	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, worldID);	glEnable(GL_REGISTER_COMBINERS_NV);	SetupBlurCombiner(specular);			glBegin(GL_TRIANGLES);			for( int i=0;i<numpolies;i++)	{			for(int a=0;a<3;a++)		{			glNormal3f(polies[i].VertexList[a].n.x,polies[i].VertexList[a].n.y,polies[i].VertexList[a].n.z);			glTexCoord2f(polies[i].VertexList[a].u,polies[i].VertexList[a].v);			glVertex3f(polies[i].VertexList[a].x,polies[i].VertexList[a].y,polies[i].VertexList[a].z);		}	}		glEnd();		glDisable(GL_TEXTURE_CUBE_MAP_ARB);	glDisable(GL_REGISTER_COMBINERS_NV);	glEnable(GL_BLEND);	glBlendFunc(GL_ONE,GL_SRC_COLOR);//(GL_SRC_COLOR,GL_DST_ALPHA);	//Pass2 	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); 	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); 	glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); 	//tex0 is our WORLD	glActiveTextureARB(GL_TEXTURE0_ARB);	glEnable(GL_TEXTURE_CUBE_MAP_ARB);	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, worldID);//tex1 is our DECAL	glActiveTextureARB(GL_TEXTURE1_ARB);	glEnable(GL_TEXTURE_2D);	glBindTexture(GL_TEXTURE_2D, texID);	SetupIBLCombiner(transparency);	glEnable(GL_REGISTER_COMBINERS_NV);	glBegin(GL_TRIANGLES);			for(  i=0;i<numpolies;i++)	{			for(int a=0;a<3;a++)		{			glNormal3f(polies[i].VertexList[a].n.x,polies[i].VertexList[a].n.y,polies[i].VertexList[a].n.z);			glTexCoord2f(polies[i].VertexList[a].u,polies[i].VertexList[a].v);			glVertex3f(polies[i].VertexList[a].x,polies[i].VertexList[a].y,polies[i].VertexList[a].z);		}	}		glEnd();		glDisable(GL_REGISTER_COMBINERS_NV);	glActiveTextureARB(GL_TEXTURE1_ARB);	glDisable(GL_TEXTURE_2D);	glActiveTextureARB(GL_TEXTURE0_ARB);	glDisable(GL_TEXTURE_CUBE_MAP_ARB);		glDisable(GL_TEXTURE_GEN_S);	glDisable(GL_TEXTURE_GEN_T);	glDisable(GL_TEXTURE_GEN_R);	glDisable(GL_TEXTURE_GEN_Q);	glDisable(GL_BLEND);}      

~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave

[edited by - duhroach on May 4, 2003 5:46:57 PM]

[edited by - duhroach on May 4, 2003 8:49:09 PM]
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
According to this paper I shouldn''t be getting the problem with the view dependent reflection with cube mapping. Only if i was using sphere maping.

So why am i getting this problem? Do i need to, infact, adjust the cube mapping reflection based upon my camera orientation?

~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
@YANNL:

can you suggest a few books which i could read to do all this shadowmapping, enviroment mapping, reflections ...?

a book that discusses reatime rendering in detail and probably makes use of OpenGl

thx in advance
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement