• Create Account

### #Actualgeorge7378

Posted 27 January 2013 - 11:37 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture:
d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
//Draw water plane
d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere:
d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);

I am also defining these things when I set up Direct3D:

d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes)
d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-buffer
d3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scaling
d3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabled
d3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from texture
d3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value
d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode

This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

### #6george7378

Posted 27 January 2013 - 11:35 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture:
d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);//Draw water plane
d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere:
d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);

I am also defining these things when I set up Direct3D:

d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes)
d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-buffer
d3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scaling
d3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabled
d3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from texture
d3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode

This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

### #5george7378

Posted 27 January 2013 - 11:33 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
//Draw water plane
d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);
I am also defining these things when I set up Direct3D:

d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes)d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-bufferd3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scalingd3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabledd3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from textured3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode
This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

### #4george7378

Posted 27 January 2013 - 11:32 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
//Draw water plane
d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);
I am also defining these things when I set up Direct3D:

d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes)d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-bufferd3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scalingd3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabledd3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from textured3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode
This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

### #3george7378

Posted 27 January 2013 - 11:31 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);//Draw water plane
d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);

I am also defining these things when I set up Direct3D:

d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes)
d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-buffer
d3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scaling
d3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabled
d3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from texture
d3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode

This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

### #2george7378

Posted 27 January 2013 - 11:30 AM

At the moment, yes I do. For my semi-transparent water texture on the floor (which is drawn on a plane defined in the code rather than on a mesh) I also have to do this:

d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); //Set up alpha blending for the imported water texture: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);//Draw water planed3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); //Reset the aplha blending to be used differently elsewhere: d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ZERO);
I am also defining these things when I set up Direct3D:
d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Turn off culling (can see both sides of shapes) d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Activate the z-buffer d3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); //Handle normals in scaling d3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)10); //Render pixel with alpha greater then 10 (0 - 255) when alpha test enabled d3ddev->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); //Take alpha from texture d3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); //Set the aplha test mode to only draw if alpha >= specified value d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); //Turn on alpha test mode
This combination seems to work for me at the moment! Here it is with actual trees:

[attachment=13381:Direct3D first person camera 2013-01-27 17-29-11-66.png]

PARTNERS