news 2026/5/1 9:59:56

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/5/1 8:03:10

5分钟快速掌握vendor-reset:解决硬件重置难题的终极指南

5分钟快速掌握vendor-reset:解决硬件重置难题的终极指南 【免费下载链接】vendor-reset Linux kernel vendor specific hardware reset module for sequences that are too complex/complicated to land in pci_quirks.c 项目地址: https://gitcode.com/gh_mirror…

作者头像 李华
网站建设 2026/4/30 23:29:51

使用HTML前端展示TensorFlow 2.9训练结果的三种方式

使用HTML前端展示TensorFlow 2.9训练结果的三种方式 在深度学习项目中,模型跑完之后最让人期待的不是准确率数字本身,而是“它到底学到了什么”。命令行里一行行打印出的loss值虽然精确,却难以传递训练过程中的动态变化和潜在问题。一个抖动…

作者头像 李华
网站建设 2026/4/30 21:25:19

7天快速掌握Power BI商业智能的完整指南

7天快速掌握Power BI商业智能的完整指南 【免费下载链接】PowerBI官方中文教程完整版分享 Power BI 官方中文教程完整版欢迎使用Power BI官方中文教程完整版!本教程专为寻求深入理解Microsoft Power BI的企业智能和数据分析爱好者设计 项目地址: https://gitcode.…

作者头像 李华
网站建设 2026/4/28 3:49:48

275种CAD字库完全指南:从零基础到专业应用

275种CAD字库完全指南:从零基础到专业应用 【免费下载链接】CAD常用字库275种字库 本仓库提供了一个包含275种常用CAD字库的资源文件,适用于AutoCAD和其他CAD软件。这些字库涵盖了多种字体类型,包括常规字体、复杂字体、手写字体、符号字体等…

作者头像 李华
网站建设 2026/4/30 19:08:00

Remotion Lambda完全指南:AWS云端视频生成技术深度解析

Remotion Lambda完全指南:AWS云端视频生成技术深度解析 【免费下载链接】remotion 🎥 Make videos programmatically with React 项目地址: https://gitcode.com/gh_mirrors/re/remotion Remotion Lambda是一个基于AWS Lambda的云端视频生成解决方…

作者头像 李华
网站建设 2026/4/30 14:28:27

用LabVIEW直接控制伺服电机:跳过PLC的省钱之道

LabVIEW通过modbus控制台达伺服电机,不需要经过PLC,电脑通过RS485通讯直接控制伺服电机,在一些只是运动控制的项目中,可以省下买PLC的在自动化控制领域,我们常常为了实现运动控制而花费不少预算在PLC上。但你知道吗&am…

作者头像 李华