OpenGL and messed up detail map

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

OpenGL and messed up detail map

Post by eric »

... trying to find a solution for my latest problem with OPENGL, I noticed that the issue was brought up already in march 2006 by etcaptor:

http://irrlicht.sourceforge.net/phpBB2/ ... detail+map
(the page includes a picture of what is going on here).

it is mainly about the fact that using a quake3map and a terrain with detail map together, shows the detail map to be completely messed up. setting the LIGHTING to true for the bsp eliminates the problem for the detail map, but this way you cannot really use the bsps' lightmaps.

so far I did not manage to find any answers. I wonder if the problem has been solved in the meantime and I just missed that particular solution page in the forum.

any help? any ideas ?

eric, GY
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I thought that these things were already fixed with 1.2, but in latest SVN a combination of terrain scene node and Quake mesh with light maps does work. Which version of Irrlicht do you use?
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post by eric »

I'm using Ver 1.2 and can definitely confirm that the problem is not fixed in 1.2. I downloaded the SVN, but so far I didn't have a chance to see if this particular problem maybe is already fixed. I was too busy trying to adapt some nice forum features like CloudScene and WaterReflection, realizing that they do no longer work with the latest SVN because of some major changes in the matrix4 and in the setPixelShaderConstant concept etc. But I will run my app, using the newly compiled SVN Dll to see if the bsp-detail problem is solved.

thanks for the reply

regards, eric GY
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post by eric »

I used the SVN Dll on my app. I cannot confirm that the problem is solved. the detail map in combination with the bsp still appears messed up, when using OPENGL. I hate to say: even worse, now if you apply only one texture on the terrain, the one texture is messed up in the same way the detail map usually shows messed up. that at least was not a problem under 1.2. by the way: the terrain collision seemingly doesn't work properly (or may differently?) with the SVN version ...

eric, BY
eric
Posts: 17
Joined: Thu Mar 08, 2007 7:26 am
Location: Berlin, GY

Post by eric »

ok, just in case someone is running into the same problem and looking for a solution. I just did, what etcaptor suggested: I took

// lightmap ---------------------------------------------------------------
Driver->extGlActiveTextureARB(GL_TEXTURE1_ARB);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);

glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE );
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );

if (material.MaterialType == EMT_LIGHTMAP_ADD)
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
else
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);

glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);

glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);

if (material.MaterialType == EMT_LIGHTMAP_M4)
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 4.0f);
else
if (material.MaterialType == EMT_LIGHTMAP_M2)
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
else
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.0f);

------------------------------------------------------------

pasted it into class COpenGLMaterialRenderer_DETAIL_MAP, right between diffuse map and detail map, recompiled the DLL and it worked. The problem is solved (at least for me).

thank you etcaptor.

regards, eric GY
Post Reply