news 2026/4/7 12:57:59

OutlineGlowPass 实现发光轮廓的高亮效果

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
OutlineGlowPass 实现发光轮廓的高亮效果

一:主要的知识点

1、说明

本文只是教程内容的一小段,因博客字数限制,故进行拆分。主教程链接:vtk教程——逐行解析官网所有Python示例-CSDN博客

2、知识点纪要

本段代码主要涉及的有①通过交互选择actor并高亮显示


二:代码及注释

import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle from vtkmodules.vtkCommonColor import vtkNamedColors from vtkmodules.vtkRenderingCore import vtkActor, vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor, vtkPolyDataMapper from vtkmodules.vtkFiltersSources import vtkArrowSource from vtkmodules.vtkRenderingOpenGL2 import vtkOutlineGlowPass, vtkRenderStepsPass def main(): colors = vtkNamedColors() iren = vtkRenderWindowInteractor() renWin = vtkRenderWindow() renWin.SetMultiSamples(0) iren.SetRenderWindow(renWin) renderer = vtkRenderer() rendererOutline = vtkRenderer() rendererOutline.SetLayer(1) renWin.SetNumberOfLayers(2) renWin.AddRenderer(rendererOutline) renWin.AddRenderer(renderer) arrowSource = vtkArrowSource() arrowSource.Update() coneMapperMain = vtkPolyDataMapper() coneMapperMain.SetInputConnection(arrowSource.GetOutputPort()) coneActorMain = vtkActor() coneActorMain.SetMapper(coneMapperMain) coneActorMain.GetProperty().SetDiffuseColor(colors.GetColor3d("LimeGreen")) renderer.AddActor(coneActorMain) basecPasses = vtkRenderStepsPass() """ vtkOutlineGlowPass是一个后期渲染通道(vtkRenderPass 的子类), 用来在渲染场景的基础上添加 轮廓高亮发光效果 """ glowPass = vtkOutlineGlowPass() glowPass.SetDelegatePass(basecPasses) rendererOutline.SetPass(glowPass) coneMapperOutline = vtkPolyDataMapper() coneMapperOutline.SetInputConnection(arrowSource.GetOutputPort()) coneActorOutline = vtkActor() coneActorOutline.SetMapper(coneMapperOutline) coneActorOutline.GetProperty().SetColor(colors.GetColor3d("Magenta")) coneActorOutline.GetProperty().LightingOff() rendererOutline.AddActor(coneActorOutline) renWin.SetSize(600, 600) renderer.GradientBackgroundOn() renderer.SetBackground(colors.GetColor3d("DarkSlateGray")) renderer.SetBackground2(colors.GetColor3d("DarkSlateBlue")) renderer.ResetCamera() camera = renderer.GetActiveCamera() camera.Roll(45.0) camera.Azimuth(-30.0) camera.Elevation(-15.0) renderer.ResetCamera() # Now set the active camera for the outline rendererOutline.SetActiveCamera(camera) renWin.SetWindowName('OutlineGlowPass') renWin.Render() iren.Start() if __name__ == '__main__': main()
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/3 4:18:25

精通AutoHotkey正则表达式:8个实战技巧让文本处理效率翻倍

精通AutoHotkey正则表达式:8个实战技巧让文本处理效率翻倍 【免费下载链接】AutoHotkey 项目地址: https://gitcode.com/gh_mirrors/autohotke/AutoHotkey AutoHotkey作为Windows平台下功能强大的自动化脚本工具,其内置的正则表达式功能基于PCRE…

作者头像 李华
网站建设 2026/4/1 8:00:32

DiskInfo下载官网替代方案:监控TensorFlow镜像运行时磁盘性能

DiskInfo下载官网替代方案:监控TensorFlow镜像运行时磁盘性能 在深度学习项目日益复杂、数据规模持续膨胀的今天,一个常被忽视却影响巨大的问题浮出水面:为什么GPU利用率总是上不去? 很多团队遇到过这样的场景——昂贵的A100显卡…

作者头像 李华
网站建设 2026/3/31 5:45:13

快速掌握实分析:Walter Rudin经典教材终极学习指南

快速掌握实分析:Walter Rudin经典教材终极学习指南 【免费下载链接】实分析与复分析Walter.Rudin英文原版下载 探索数学分析的深邃世界,Walter Rudin的《实分析与复分析》英文原版为你打开知识的大门。这部经典教材以其严谨的结构和详实的内容&#xff0…

作者头像 李华