bump mapping problems

Started by
4 comments, last by QuadMV 17 years, 8 months ago
Hey everyone, I took the below code right out of the MS docs, to use as a starting point for adding bumpmapping to my engine. I don't think the results are right, and was looking for guidance. If you look at the following screen shots you'll see it looks more like blending than a bumpmap: http://samples2.3dmuve.com:8080/photoalbum_preview.cgi?screenshots/011_bumpmapping_test I didn't think bumpmapping was just a fancy term for texture blending? It's not supposed to be a light map or shade map, is it? I thought it was actually supposed to affect the way HW lighting works? Now what also threw me was the environment map. The MS sample requires an environ map and a bump map along with the base texture. In this example it's brick, and brick wont really reflect it's suroundings. If I use an all white or all black texture it looks like I'm not doing anything at all. I chose the ground texture which demonstrates a nice blend, but still not the bump affect I was hoping for. Does anyone have any suggestions on whay I'm doing wrong, or another way to approach this? Thanks

// Set the color operations and arguments to prepare for
//   bump mapping.

// Stage 0: The base texture
d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); 
d3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 1 );

// Stage 1: The bump map - Use luminance for this example.
d3dDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 );
d3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_BUMPENVMAPLUMINANCE);
d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );

// Stage 2: A specular environment map
d3dDevice->SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, 0 );
d3dDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_ADD );
d3dDevice->SetTextureStageState( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState( 2, D3DTSS_COLORARG2, D3DTA_CURRENT );

When the blending operations and arguments are set, the following code example sets the 2x2 bump mapping matrix to the identity matrix by setting the D3DTSS_BUMPENVMAPMAT00 and the D3DTSS_BUMPENVMAPMAT11 members of D3DTEXTURESTAGESTATETYPE to 1.0. Setting the matrix to the identity causes the system to use the delta values in the bump map unmodified, but this is not a requirement.

// Set the bump mapping matrix.
//
// Note  These calls rely on the following inline shortcut function:
//   inline DWORD F2DW( FLOAT f ) { return *((DWORD*)&f); }
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVMAT00, F2DW(1.0f) );
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVMAT01, F2DW(0.0f) );
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVMAT10, F2DW(0.0f) );
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVMAT11, F2DW(1.0f) );

// Set luminance controls. This is only needed when using
// a bump map that contains luminance, and when the 
// D3DTOP_BUMPENVMAPLUMINANCE texture blending operation is
// being used.
//
// Note  These calls rely on the following inline shortcut function:
//   inline DWORD F2DW( FLOAT f ) { return *((DWORD*)&f); }
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVLSCALE, F2DW(0.5f) );
d3dDevice->SetTextureStageState( 1, D3DTSS_BUMPENVLOFFSET, F2DW(0.0f) );



3DMUVE is an amateur game development team, and the designer and developer of a new gaming technology “MUVE” for the gaming industry.
Advertisement
Is my issue the format of the bumpmap itself? Do I need to convert it? It's currently a grey scale image, but maybe that's a mistake?

Thanks
3DMUVE is an amateur game development team, and the designer and developer of a new gaming technology “MUVE” for the gaming industry.
i don't actually know but try playing with it for a while until someone reply's :) atleast worth a try :).
and did u make the renderer yourself ?
im getting pretty interested in your engine maybe cause im now learning how to build a particle system if my particle system is good (i want it to look next gen) we can work together on it cause after i learned particle system im gonna learn building a renderer (wich im gonna make next gen looking aswell) im a amateur but it will be a great learning experience.
Havok1989, I have played with it a bit, and if I'm doing something wrong (which I'm sure I am) I'm just not sure what it is.

The entire engine is all me, but I'm taking a very different approach I believe from what others do. For one, I'm not concerned with the engine looking perfect as much as I want it to look reasonable so it's not overlooked, but I believe it's the game play that will differenciate things. Unfortunately, I may never get to the game play because I always seem to go back and enhance things more and more :-)

Also, I have no levels. My vision is for a seamless, auto expanding (paging) universe, so as you travel things just load. Not only on a single planet, traveling accross oceans, but to also have giant indoor environments that the player can seamlessly enter without delay. I want to exit the planet to space and from space to another planet without delay. I want to be able to construct a large facitility in game and have it just appear without delay, interior and all. Just a completly virtual and seamless universe. It sounds simple enough but no one does it. My engine does :-)

I'm actually almost done, everything I mentioned above is in place, I'm just tweaking some things (bump mapping, shadows), and then will start to build my game world.


3DMUVE is an amateur game development team, and the designer and developer of a new gaming technology “MUVE” for the gaming industry.
Do you have a download of this?
I hope to release a test environment sometime soon, but nothing yet. The only thing I have for now are some simple videos and screen shots. http://www.3dmuve.com

However, I don't want to forget the original post. If anyone has any suggestions on my bump mapping woes, I'd appreciate it.

3DMUVE is an amateur game development team, and the designer and developer of a new gaming technology “MUVE” for the gaming industry.

This topic is closed to new replies.

Advertisement