• Advertisement
Sign in to follow this  

Alpha blending and Effects combined

This topic is 4360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I´m trying to draw a cheap disc with controlled color values, by using a texture containing a circle (also in the alpha channel), alpha blending using the texture alpha channel and a shader to write a color value that differ from that of the texture. I imagine this would be a cheap way of drawing a disc in space, with color values that differ from the texture, since om using two triangles and dont have to edit the texture. However it does not alpha blend properly when the effect is added to the mix. Does anyone know why this is so ? And possibly how this can be done ? A snip of the c# code looks like this, where "MeshColor" is the color I would like to write on a disc in space. (Sorry for the straight paste of the code, dont know the syntax.. will look into it :D ) ------------------------------------------------------------------------ device.RenderState.AlphaBlendEnable = true; device.RenderState.SourceBlend = Blend.SourceAlpha; device.RenderState.Lighting = false; device.VertexFormat = CustomVertex.PositionTextured.Format; device.SetTexture(0,circle); device.SetStreamSource(0, disc_vb, 0); device.Indices = disc_ib; effect_meshcolor.SetValue("MeshColor",new Vector4(pdist/100,radius,0,1.0f)); int passes = effect_meshcolor.Begin(0); for (int pass = 0; pass < passes; pass++) { effect_meshcolor.BeginPass(pass); effect_meshcolor.CommitChanges(); device.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,4,0,2); effect_meshcolor.EndPass(); } effect_meshcolor.End(); ------------------------------------------------------------------------

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement