Help with transparency in DX9 please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I'm writing a program that draws 3D fractal trees (using recursive
functions) on a fractal landscape which you can fly around in etc. The
program has been a success until it came to drawing the leaves. For
simplicity I decided to place them at the ends of each branch. Having stored
each leaf position in an array, the vertices were then calculated as
trianglelists and scaled/rotated/transformed into position and then put into
the vertex buffer. I was using the Customvertex.PositionNormalTextured vertex
format for these vertices. I then added a material and texture from a file
for these vertices and applied it before the appropriate
d3ddevice.drawprimitives(...) call. The world is also lit using directional
lighting with specular effects. The texture was set with a colorkey of
magenta as it was created in photoshop. Now, instead of becoming transparent,
it simply turns the areas that should be transparent to black! I have set the
renderstate alphablending variables as follows:

.RenderState.AlphaSourceBlend = Blend.SourceAlpha
.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha

everything else was left as default. All I need is a little specific
explanation of how to do this transparency thing properly and specifically in
my case. Code samples and tutorials just don't seem to be helping!

Thank you for your time.
 
* "=?Utf-8?B?UGF1bCBOYXRoYW4=?= said:
Hello, I'm writing a program that draws 3D fractal trees (using recursive
functions) on a fractal landscape which you can fly around in etc. The

Notice that there are separate groups for DirectX available:

microsoft.public.win32.programmer.directx.managed
microsoft.public.win32.programmer.directx.sdk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top