网站优化推广教程做app的模板下载网站
2026/3/2 11:29:12 网站建设 项目流程
网站优化推广教程,做app的模板下载网站,网站的静态资源服务器怎么做,和网站合作有哪些活动可以做一#xff1a;主要的知识点 1、说明 本文只是教程内容的一小段#xff0c;因博客字数限制#xff0c;故进行拆分。主教程链接#xff1a;vtk教程——逐行解析官网所有Python示例-CSDN博客 2、知识点纪要 本段代码主要涉及的有①vtkRenderStepsPass的使用 二#xff1a…一主要的知识点1、说明本文只是教程内容的一小段因博客字数限制故进行拆分。主教程链接vtk教程——逐行解析官网所有Python示例-CSDN博客2、知识点纪要本段代码主要涉及的有①vtkRenderStepsPass的使用二代码及注释import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle from vtkmodules.vtkCommonColor import vtkNamedColors from vtkmodules.vtkRenderingCore import vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor, vtkPolyDataMapper, vtkActor from vtkmodules.vtkIOPLY import vtkPLYReader from vtkmodules.vtkRenderingOpenGL2 import vtkRenderStepsPass, vtkSimpleMotionBlurPass def main(): fileName Data/Armadillo.ply colors vtkNamedColors() colors.SetColor(A1Diff, [255, 204, 77, 255]) colors.SetColor(A2Amb, [51, 51, 255, 255]) colors.SetColor(A2Diff, [51, 255, 204, 255]) colors.SetColor(A3Amb, [128, 166, 255, 255]) colors.SetColor(Bkg, [77, 102, 153, 255]) renderer vtkRenderer() renderer.SetBackground(colors.GetColor3d(Bkg)) renderWindow vtkRenderWindow() renderWindow.SetSize(500, 500) renderWindow.SetWindowName(MotionBlur) renderWindow.AddRenderer(renderer) iren vtkRenderWindowInteractor() iren.SetRenderWindow(renderWindow) reader vtkPLYReader() reader.SetFileName(fileName) reader.Update() mapper vtkPolyDataMapper() mapper.SetInputConnection(reader.GetOutputPort()) # 创建3个模型 actor vtkActor() actor.SetMapper(mapper) actor.GetProperty().SetAmbientColor(colors.GetColor3d(Red)) actor.GetProperty().SetDiffuseColor(colors.GetColor3d(A1Diff)) actor.GetProperty().SetSpecular(0.0) actor.GetProperty().SetDiffuse(0.5) actor.GetProperty().SetAmbient(0.3) actor.SetPosition(-0.1, 0.0, -0.1) renderer.AddActor(actor) actor vtkActor() actor.SetMapper(mapper) actor.GetProperty().SetAmbientColor(colors.GetColor3d(A2Amb)) actor.GetProperty().SetDiffuseColor(colors.GetColor3d(A2Diff)) actor.GetProperty().SetSpecularColor(colors.GetColor3d(Black)) actor.GetProperty().SetSpecular(0.2) actor.GetProperty().SetDiffuse(0.9) actor.GetProperty().SetAmbient(0.1) actor.GetProperty().SetSpecularPower(10.0) renderer.AddActor(actor) actor vtkActor() actor.SetMapper(mapper) actor.GetProperty().SetDiffuseColor(colors.GetColor3d(A3Amb)) actor.GetProperty().SetSpecularColor(colors.GetColor3d(White)) actor.GetProperty().SetSpecular(0.7) actor.GetProperty().SetDiffuse(0.4) actor.GetProperty().SetSpecularPower(60.0) actor.SetPosition(0.1, 0.0, 0.1) renderer.AddActor(actor) SetMultiSamples(0) 禁用多重采样抗锯齿 SetMultiSamples 设置为大于1的值时例如 4 或 8 图形卡会为每个像素在多个位置采样颜色和深度信息然后将这些样本混合起来 从而产生平滑的边缘。 renderWindow.SetMultiSamples(0) vtkRenderStepsPass 属于VTK的渲染管线的高级部分它是一个渲染步骤通道(Render Pass)类用于调试和分阶段执行渲染过程 在现代VTK中(尤其是8.X以后的版本)渲染过程被模块化为一系列 渲染步骤比如 绘制几何体geometry pass 绘制阴影shadow pass 绘制透明度translucent pass 绘制体数据volume pass 绘制后期处理post-processing pass 这些步骤可以由一个Pass管线按顺序执行 其主要作用是封装并依次执行 VTK 的标准渲染步骤用于调试或自定义渲染流程 vtkRenderStepPass 内部通常会依次执行以下pass 顺序 渲染阶段Pass 说明 1 vtkSequencePass 渲染步骤序列管理器内部容器 2 vtkLightsPass 设置光照 3 vtkCameraPass 应用相机变换 4 vtkOpaquePass 绘制不透明物体 5 vtkTranslucentPass 绘制透明物体 6 vtkVolumetricPass 绘制体渲染对象volume 7 vtkOverlayPass 绘制叠加层文本、UI basicPasses vtkRenderStepsPass() vtkSimpleMotionBlurPass 是一个 图像后期处理post-processing渲染 pass,用于在渲染结果中实现运动模糊(Motion Blur)效果 它在渲染完成后对场景的多帧进行时间平均从而模拟 相机快门导致的运动模糊效果 工作原理“渲染多帧场景 → 累积图像 → 平均 → 产生模糊感” 渲染结构的关系 vtkSimpleMotionBlurPass并不自己绘制几何体它是一个包裹pass,必须包裹一个基础渲染pass。 例如 vtkCameraPass └── vtkSimpleMotionBlurPass └── vtkRenderStepsPass 整个链条会按层次执行 vtkRenderStepsPass → 绘制正常场景 vtkSimpleMotionBlurPass → 对渲染结果做累积与平均 vtkCameraPass → 管理相机和最终合成 motion vtkSimpleMotionBlurPass() SetDelegatePass 指定内部真正负责绘制场景的渲染pass vtkSimpleMotionBlurPass的其余方法 SetNumberOfFrames(number)设置渲染并累积的帧数数值越大模糊越平滑但性能越低 GetNumberOfFrames()获取帧数 Render()执行渲染与混合操作 ReleaseGraphicsResources()释放显存和缓冲区资源 motion.SetDelegatePass(basicPasses) SetPass: vtk中渲染器(vtkRenderer)有两种工作模式 1、默认渲染模式 使用VTK内部默认流程绘制几何体、光照、透明、叠加层等 2、自定义Render Pass模式 通过 renderer.SetPass() 手动设置一条自定义渲染管线由你控制渲染的每个步骤 当调用 renderer.SetPass(some_pass) 时 就告诉 VTK“别用你默认的渲染方式用我指定的渲染 pass 管线来绘制场景。” renderer.SetPass(motion) numRenders 30 renderer.GetActiveCamera().SetPosition(0, 0, -1) renderer.GetActiveCamera().SetFocalPoint(0, 0, 0) renderer.GetActiveCamera().SetViewUp(0, 1, 0) renderer.ResetCamera() renderer.GetActiveCamera().Azimuth(15.0) renderer.GetActiveCamera().Zoom(1.2) renderWindow.Render() for i in range(0, numRenders): renderer.GetActiveCamera().Azimuth(10.0 / numRenders) renderer.GetActiveCamera().Elevation(10.0 / numRenders) renderWindow.Render() iren.Start() if __name__ __main__: main()

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询