PDA

View Full Version : Better way to do detail mapping than this?



TheGecko
03-26-2002, 10:39 AM
Hey again people. In my application I'm trying to tile a detail map using multitexturing with the following setup:




glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
m_pTextureArray[iBase].Use();

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
m_pTextureArray[iDetail].Use();


And the detail map looks like this:
http://www.biosphereent.com/projects/terraimages/terra7.jpg

I'm not too happy with the way it looks and was wondering if there is another way to do it without nVidia only extensions and without bumpmapping.

Serious Sam 2 does an excellent job using detail mapping on all the walls and stuff and I was wondering how to do that as well. (unless Serious Sam uses bumpmapping, in which case nevermind http://www.opengl.org/discussion_boards/ubb/smile.gif )

If you have to try out the application, you can grab it at http://www.biosphereent.com/projects/terra.html

Any help would be appreciated.Thanx!


[This message has been edited by TheGecko (edited 03-26-2002).]

Nutty
03-26-2002, 12:38 PM
Try GL_ADD_SIGNED_EXT in EXT_texture_env_combine.

Nutty

JasonM [ATI]
03-26-2002, 05:29 PM
I would suggest that the problem is the art being used as a detail texture rather than the math you're doing in the pixel pipeline. Take the detail texture you have and run an emboss filter on it in PhotoShop. This gives a much better look, IMO. Additionally, you should have a look at the histogram of the resulting detail map and make sure it is centered around mid-gray (128) with a fairly tight distribution.

-JasonM

TheGecko
03-26-2002, 07:21 PM
Thanx for the suggestions!

JasonM [ATI]: I just tried that.It looks really cool now! It's just that when you get too close to it that it really starts to look terrible http://www.opengl.org/discussion_boards/ubb/tongue.gif Oh well, can't do much about it I guess.

Nutty: I'm still a little confused as to how to use those parameters you posted.Is there any way you can show me where in my code I should do the modifications and what the exact glTexEnvf() parameters are? And which line in my code I should delete? Thanx!

I'm still open to any more suggestions though.I'm trying out as many as I can to see which best suits me http://www.opengl.org/discussion_boards/ubb/smile.gif

Bob
03-27-2002, 12:02 AM
This should go in the second texture unit.



glTexEnfi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnfi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_SIGNED_ADD);


Have a look in the spec (http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_env_combine.txt) for the extension for more information.

DFrey
03-27-2002, 05:56 AM
TheGecko, I tried your beta demo of the Terraformer3D, and anytime I tried to display terrain it would crash with a 0xC0000005 exception at 0x4061d0. I have a GF2 MX, and Win98 BTW in case that helps you narrow down the problem.

TheGecko
03-27-2002, 12:12 PM
Did you import the texture pak first?
(File>Import>Texture PAK then select the textures.pak file in the data directory)

Maybe I should start forcing users to load this file at startup http://www.opengl.org/discussion_boards/ubb/tongue.gif

DFrey
03-27-2002, 02:02 PM
Yes, and it makes no difference still crashes. Well, it does make a small difference, it just crashes at 0x404f63 with the same type of exception. http://www.opengl.org/discussion_boards/ubb/tongue.gif