VTK texture (Activiz 5.8.0) affecting opacity

When I try to display a scene containing a transparent object (50% transparency) and a textured opaque object, the transparent object becomes paler. If the textured object is hidden, the transparent object again receives the expected transparency.

I map the texture to the object with vtkTextureMapToSphere. Please note that boundsin the code below is the bounding box of the object _polydatato which I apply the texture.

vtkTextureMapToSphere textureMapper = vtkTextureMapToSphere.New();
textureMapper.SetInput(_polydata);
textureMapper.SetCenter(bounds.center[0], bounds.center[1], bounds.center[2]);
textureMapper.PreventSeamOn();

vtkTransformTextureCoords transformMap = vtkTransformTextureCoords.New();
double factorEnlarge = 4;
double scale = bounds.dimensions.Sum() / bounds.dimensions.Length / factorEnlarge;
transformMap.SetInputConnection(textureMapper.GetOutputPort());
transformMap.SetScale(scale, scale, scale);

vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(transformMap.GetOutputPort());

vtkActor actor = vtkActor.New();
actor.SetTexture(texture);
actor.GetProperty().SetColor((double)color.R / 255, (double)color.G / 255, (double)color.B / 255);
actor.GetProperty().SetOpacity(alpha);
actor.SetMapper(mapper);
actor.GetProperty().SetInterpolationToPhong();

renderer.AddActor(actor);

Transparent object and textured object. Transparent object with hidden texture object

EDIT

After disabling the PreventSeam parameter vtkTextureMapToSphere, the color difference disappeared. However, there is still a noticeable difference in shading, wherever you look at more than two mesh surfaces (for example, where there are cavities in the mesh).

PreventSeam    .  , PreventSeam    .></a></p></div></body></html>

+4
1

, . , , . , , . , Activiz, , XNA (DirectX) GraphicsDevice.BlendState, .

, , , .

0

Source: https://habr.com/ru/post/1675871/


All Articles