Hallo,
I am a new Irrlicht user.
Since I needed a material with both UV texture mapping and
a small amount of reflection, I modified the source code (in CVideoDirectX8.cpp) to add a new material:
case EMT_SOLID_AND_REFLECTION:
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
pID3DDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_COLORVALUE(0.25, 0.25, 0.25, 0.25) );
pID3DDevice->SetTransform( D3DTS_TEXTURE0, &UnitMatrix );
pID3DDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
pID3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0);
pID3DDevice->SetTextureStageState (0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pID3DDevice->SetTextureStageState (0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_LERP );
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
pID3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG0, D3DTA_TFACTOR );
pID3DDevice->SetTransform( D3DTS_TEXTURE1, &SphereMapMatrix );
pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
break;
This creates a small amount of reflection, like polished
surfaces on new cars.
It uses texture0 (as uv mapping, say, for car labels) and
texture1 (the environment mapping for reflection).
See the effect of this material on a plane with UV camouflage
and reflection environment map:
Well, I hope that future versions of Irrlicht may consider
new material effects, like this one (which is just a test, and
reflection is fixed in 0.25, see tha code above). Note: works
only on DirectX.
bye!