Search code examples
wpfxamlvisual-studio-2015opacityhelix-3d-toolkit

Opacity bug in VS 2015 using Helix Toolkit


I've been trying to create a method to change the opacity of an object when I select it in a combo box so that I can see another object behind it. This is done prior to changing the camera position/direction to follow the 2nd object from the 1st object's position. This is done by cloning the object's default material with

this.DefaultMaterial = this.DefaultMaterial.Clone();

and then calling the

MaterialHelper.ChangeOpacity(DefaultMaterial,0.1);

method as I've written it out there.

The opacity seems to work properly for the most part, but for some of the objects in the view port, I can't see them through my initial opaque object. For instance, when I turn the camera to the particular object in question (the buggy one), instead of being able to see it behind my initial object I see through my initial object and past the second one(the buggy one) as if the buggy one wasn't even there. I just see what's behind it.

I have no idea why this is happening.

Does anyone know what could be causing this? Or if maybe there is a different way of making something transparent rather than setting its Opacity?

I saw some people referencing a TRANSPARENCY property, but wasn't sure if that applies to a FileModelVisual3D object, which is what the initial object is.

The buggy object is a UIElement3D, the opaque one is a FileModelVisual3D, there are other objects of the Point3DCollection class which also have the bug, as the UIElement3D does.


Solution

  • Because of the RenderOrder and depth buffer. You have to move your transparent object to the end of the rendering. It's not a bug, it's how rendering works.

    Or change to use Helix-toolkit sharpdx, and use transparent rendering pass.