bool set_stage_for_env_mapped(){
if(current_render_state == ENV)return true;
if(SPECMAP < 0){
// Error(LOCATION, "trying to set stage when there is no specmap");
return false;
}
// D3DXMATRIX world;
D3DXMATRIX world(
Eye_matrix.vec.rvec.xyz.x, Eye_matrix.vec.rvec.xyz.y, Eye_matrix.vec.rvec.xyz.z, 0,
Eye_matrix.vec.uvec.xyz.x, Eye_matrix.vec.uvec.xyz.y, Eye_matrix.vec.uvec.xyz.z, 0,
Eye_matrix.vec.fvec.xyz.x, Eye_matrix.vec.fvec.xyz.y, Eye_matrix.vec.fvec.xyz.z, 0,
0, 0, 0, 1);
GlobalD3DVars::lpD3DDevice->SetTransform(D3DTS_TEXTURE1, &world);
d3d_SetTextureStageState( 2, D3DTSS_RESULTARG, D3DTA_CURRENT);
d3d_SetTextureStageState( 1, D3DTSS_RESULTARG, D3DTA_CURRENT);
d3d_SetTextureStageState( 0, D3DTSS_RESULTARG, D3DTA_CURRENT);
// d3d_SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_SPECULAR);
d3d_SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d3d_SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
// d3d_SetTexture(0, SPECMAP);
d3d_SetTexture(1, cube_map);
d3d_SetTextureStageState( 1, D3DTSS_RESULTARG, D3DTA_CURRENT);
d3d_SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
d3d_SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_CURRENT);
d3d_SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_TEXTURE);
d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
// d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_PREMODULATE);
d3d_SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE);
d3d_SetTextureStageState( 3, D3DTSS_COLOROP, D3DTOP_DISABLE);
//D3DTOP_BLENDTEXTUREALPHA
current_render_state = ENV;
return true;
}
stage 0 has a spec map that has just been used in a multipass specular lighting thingy, stage 1 has a cube map, currently it''s modulateing the cube map with the color of the spec map , and I want to use the alpha of the spec map instead (also if there is a way to use the specmap''s color * it''s alpha to modulate the cube map I''d like to know that as well)
Bobboau, bringing you products that work... in theory
useing alpha as a color
I want to use the alpha chanel in a spec map as a modulator for an environment map. how shal this be done?
this is what I have currently
Take a look at D3DTA_ALPHAREPLICATE - it''s a texture argument modifier flag that copies what''s in the ALPHA channel into the R,G and B channels of COLOR.
Alternatively, when you have hardware support, there are operations such as D3DTOP_MODULATEALPHA_ADDCOLOR
Simon O''Connor
Game Programmer &
Microsoft DirectX MVP
Alternatively, when you have hardware support, there are operations such as D3DTOP_MODULATEALPHA_ADDCOLOR
Simon O''Connor
Game Programmer &
Microsoft DirectX MVP
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement