当我尝试渲染包含透明对象(50%透明度)和纹理不透明对象的场景时,透明对象变得更加褪色.如果隐藏了纹理对象,则透明对象将再次获得其预期的透明度.
我使用vtkTextureMapToSphere将纹理映射到对象.请注意,下面代码中的边界表示我应用纹理的_polydata对象的边界框.
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);
编辑
关闭vtkTextureMapToSphere的PreventSeam选项后,颜色的差异消失了.但是,无论您通过网格的两个以上表面查看(例如网格中有空洞的位置),在着色中仍然存在明显的差异.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。