This topic is now archived and is closed to further replies.


Rendering fire with faded edges

Recommended Posts

Goodlife    122
Hi all-- this is an update of a post down below. I tried to just edit it, but it won''t let me access it for some reason. Here''s my issue. I have a flame bitmap. It is golden in the ''middle'' of the flame, and red at the edges. When I render it on screen, I want the golden center to be fully opaque. Near the edges, I want it to fade away to complete transparency. I have read up on Direct3d texture formats, and even got some source code up and running. By running, I mean, "does not return any error codes." The texture simply does not appear. I even set all the alpha bits (and all other bits, in desperation) to 1, which should have given me a white square. My other textures, which do not attempt to use the 4444 texture format work fine. I know the card is capable, because I downloaded an exe file that does it. Alas, no source. What I''m asking for is some source code, or a link to source code, that will show me how to accomplish this. I think I''m too thick for mere ''suggestions'' to get through to me, because I''ve been coding from suggestions for a few days now. I need to see it in action! Can anyone help? Surely someone has written a function to load a bitmap and an alpha bitmap onto a texture surface, to be rendered with transparency???? -- Goodlife ----------------------------- Those whom the gods would destroy, they first drive mad. --DirectX design team official motto

Share this post

Link to post
Share on other sites
Lars W.    122
Are you realy shure this Programm uses 16 Bit 4444 Format, it could be an 32 Bit 8888 Format (Texture Resolution is independent from rendering Resolution).

Another Problem could be the wrong blending Mode. I am using the D3DBLEND_SRCALPHA as SrcBlend, and then (for the Effect i need) different Alpha Ops and Destination Blendings


Share this post

Link to post
Share on other sites
Eric    138
What is your vertex format? If it includes a diffuse color, make sure you are setting this (probably to white) for all vertices, or just switch to a format w/out a diffuse color.

Here''s my rendering code for an alpha billboard (not optimized yet, but it works):

if( FAILED( hr = m_pd3dDevice->SetTexture( 0, (GetTexture( STATSTEXTURE_FILENAME ))->m_pddsSurface ) ) ){
MyAlert(&hr, "DisplayStats() > SetTexture() failed" );
return E_FAIL;


// Draw a textured square
vRect[0] = D3DTLVERTEX( D3DVECTOR( 0, 0, 0.0f ),1.0f,0xFFFFFFFF,0,0,0 );
vRect[1] = D3DTLVERTEX( D3DVECTOR( 0, 256, 0.0f ),1.0f,0xFFFFFFFF,0,0,1 );
vRect[2] = D3DTLVERTEX( D3DVECTOR( 256, 0, 0.0f ),1.0f,0xFFFFFFFF,0,1,0 );
vRect[3] = D3DTLVERTEX( D3DVECTOR( 256, 256, 0.0f ),1.0f,0xFFFFFFFF,0,1,1 );
if( FAILED( hr = m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX,
vRect, 4, NULL ) ) ){
MyAlert( &hr, "DisplayStats() > DrawPrimitive() failed" );
return hr;

Share this post

Link to post
Share on other sites