news 2026/6/25 17:28:05

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/6/23 14:08:01

ios底部按钮被挡住

大家开发小程序时,需要在底部固定一个按钮时,却发现有时候被ios的小横条 (Home Indicator) 遮挡内容,有时候触发不了事件。我们这边是用uniapp开发小程序可以设置一个全局样式类.ios_bottom {padding-bottom: 0;padding-bottom: constant(saf…

作者头像 李华
网站建设 2026/6/18 20:57:29

终极Bootstrap 3.4.1完整指南:如何快速构建响应式网站

终极Bootstrap 3.4.1完整指南:如何快速构建响应式网站 【免费下载链接】Bootstrap3.4.1资源下载 本资源库提供Bootstrap 3.4.1版本的压缩文件下载,包含前端框架的核心组件、CSS样式及JavaScript插件。Bootstrap以其强大的响应式布局能力著称,…

作者头像 李华
网站建设 2026/6/22 14:39:40

Julia数据可视化终极指南:10个快速掌握Plots.jl的实用技巧

Julia数据可视化终极指南:10个快速掌握Plots.jl的实用技巧 【免费下载链接】Plots.jl Powerful convenience for Julia visualizations and data analysis 项目地址: https://gitcode.com/gh_mirrors/pl/Plots.jl Plots.jl是Julia编程语言中最强大的数据可视…

作者头像 李华
网站建设 2026/6/23 22:07:20

LaTeX公式OCR识别新突破:基于Qwen3-VL模型的Lora微调实战指南

LaTeX公式OCR识别新突破:基于Qwen3-VL模型的Lora微调实战指南 【免费下载链接】self-llm 项目地址: https://gitcode.com/GitHub_Trending/se/self-llm 想要让AI模型准确识别复杂的数学公式吗?🤔 在科研和学术工作中,数学…

作者头像 李华