Semitransparent Texture

To use a transparent texture you must have

singleViewportLayout1.AccurateTransparency = false,

and then you must assign an alpha value less than 255 to the entity material Diffuse component (of course the material must have a texture too).

The resulting transparency will be a combination of the material Diffuse alpha and the alpha of the texture pixels.

singleViewportLayout1.AccurateTransparency = false; 

Bitmap bmp = new Bitmap(imageFilePath); 

Material mat = new Material(bmp); // Assign a transparent alpha (<255) to the Material Diffuse component 
mat.Diffuse = Color.FromArgb(100, Color.White); 
singleViewportLayout1.Materials.Add("mat", mat); 

Mesh mesh = Mesh.CreatePlanar(new LinearPath(20, 20), 0.1, meshNatureType.Plain); 

mesh.ApplyMaterial("mat", textureMappingType.Plate, 1, 1); 
singleViewportLayout1.Entities.Add(mesh);  

 

Capture.PNG

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

1 comment
  • Nice feature! This will come in very useful for rendering see-through items!

Please sign in to leave a comment.