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.
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.