🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

D3DIM - How to do Render Coronas correctely

Started by
-1 comments, last by Phillip Schuster 24 years, 8 months ago
Hi !!

Well, I am just working on my Conornas (Flares) for my 3D Engine. They are transformed to screen space (after the check if it is visible) and then rendered usind the D3DTLVERTEX-Structure. All that works fine. But I have some trouble with the Render/Texture-Stage States !! Normally flares are just added to the dest-colors, so that white points in the flare-texture-map always are white on the screen (if we have full alpha) even if the background is black !! But, with my states, the flare is rendered dependantely of the background. So, If I have a bright wall, the flare is bright, too. If the wall is shadowed, so black, the flare is just half bright !! That's shit !! Anyone knows what's wrong here ??


void CRenderer::RenderCorona(CCorona *corona)
{
pD3DDevice->SetTexture(0,corona->texture->pDDTexture);

pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE );
pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE );
pD3DDevice->SetRenderState( D3DRENDERSTATE_DITHERENABLE, FALSE );
pD3DDevice->SetRenderState( D3DRENDERSTATE_SPECULARENABLE, FALSE );
pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );

pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
long i = 0;
for (i=0;i<2;i++) {

D3DTLVERTEX vertices[3];

vertices[0].sx = corona->faces.vertices[0]->screen_pos.x;<BR> vertices[0].sy = corona->faces.vertices[0]->screen_pos.y;<BR> vertices[0].sz = 0.0001f;<BR> vertices[0].color = D3DRGB(1,1,1);<BR> vertices[0].specular = D3DRGB(0,0,0);<BR> vertices[0].tu = corona->faces.uvs[0].u[0];<BR> vertices[0].tv = corona->faces.uvs[0].v[0];<BR> vertices[0].rhw = 0.0001f;<P> vertices[1].sx = corona->faces.vertices[1]->screen_pos.x;<BR> vertices[1].sy = corona->faces.vertices[1]->screen_pos.y;<BR> vertices[1].sz = 0.0001f;<BR> vertices[1].color = D3DRGB(1,1,1);<BR> vertices[1].specular = D3DRGB(0,0,0);<BR> vertices[1].tu = corona->faces.uvs[1].u[0];<BR> vertices[1].tv = corona->faces.uvs[1].v[0];<BR> vertices[1].rhw = 0.0001f;<P> vertices[2].sx = corona->faces.vertices[2]->screen_pos.x;<BR> vertices[2].sy = corona->faces.vertices[2]->screen_pos.y;<BR> vertices[2].sz = 0.0001f;<BR> vertices[2].color = D3DRGB(1,1,1);<BR> vertices[2].specular = D3DRGB(0,0,0);<BR> vertices[2].tu = corona->faces.uvs[2].u[0];<BR> vertices[2].tv = corona->faces.uvs[2].v[0];<BR> vertices[2].rhw = 0.0001f;<P> pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, vertices, 3, NULL);<BR> }<BR> pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );<BR>}<P>Thanks

Phillip Schuster

This topic is closed to new replies.

Advertisement