Better transparency (v9)

By default Eyeshot has 


property set to false.

This allows to render transparent entities without the preprocessing step (viewportLayout.Entities.ProcessSemiTransparent()) required by the AccurateTransparency algorithm (that can take some time depending on the scene complexity).

With this property set to false, the transparent entities are just drawn in the order they appear in the viewportLayout.Entities list, simply enabling transparency.

This can cause visual problems because to correctly render transparent entities they must be drawn from the farthest one (from the viewer) to the nearest one.

See the image below, created with AccurateTransparency = false and this code:

            var sp1 = Mesh.CreateSphere(10, 10, 10);
            viewportLayout1.Entities.Add(sp1, 0, Color.FromArgb(127, Color.Red));

            var sp2 = Mesh.CreateSphere(10, 10, 10);
            sp2.Translate(0, 20, 0);
            viewportLayout1.Entities.Add(sp2, 0, Color.FromArgb(127, Color.Blue));

Since the red sphere is added first, it is usually drawn before the blue one.

This causes the issue on the left viewport where the blue sphere, which is farther from the viewer, should be drawn first instead.

To improve the rendering of transparent entities (without turning on viewportLayout.AccurateTransparency) you can derive the ViewportLayout like this:

        public class MyViewportLayout : ViewportLayout
             protected override void DrawViewport(DrawSceneParams myParams)
                 myParams.Entities = SortEntitiesForTransparency(myParams.Viewport);

The SortEntitiesForTransparency() method sorts the transparent entities from the farthest one to the nearest one so they are rendered in the correct order, no matter the view orientation.

See image below:

Of course this is just an improvement of the (less expensive) inaccurate transparency and works fine only with clearly separated entities like these ones.

More complex and self-intersecting transparent entities will still have issues. To correctly render them the viewportLayout.AccurateTransparency =  true is needed.

Note: for Eyeshot 10, please refer also to this document.

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



Please sign in to leave a comment.