Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
VTK
VTK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 162
    • Merge Requests 162
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #16049

Closed
Open
Opened Mar 28, 2016 by Kitware Robot@kwrobotOwner

Incorrect rendering of Axes when rendering to an image file

This issue was created automatically from an original Mantis Issue. Further discussion may take place here.


The following code does not render the axes when magnification is not 1.

import sys
import vtk
print vtk.vtkVersion().GetVTKVersion()

#.SetSolidTypeToIcosahedron();
cs = vtk.vtkConeSource()
cs.SetResolution(36)
cs.SetRadius(1.0)
m = vtk.vtkPolyDataMapper()
m.SetInputData(cs.GetOutput())
p = vtk.vtkProperty()
p.SetRepresentationToWireframe()
a = vtk.vtkActor()
a.SetMapper(m)
a.SetProperty(p)
p.SetColor(0.8, .1, .9)

ren = vtk.vtkRenderer()
ren.SetBackground(0.7, 0.7, 0.7)
ren.AddViewProp(a)
ren.viewport = (0, 0, 0.5, 1.0)

axes = vtk.vtkCubeAxesActor2D()
axes.SetInputData(cs.GetOutput())
axes.SetCamera(ren.GetActiveCamera())
ren.AddViewProp(axes)

ren.GetActiveCamera().SetPosition(0.0, 2.0, 0.0)
ren.GetActiveCamera().SetFocalPoint(0.0, 0.0, 0.0)
ren.GetActiveCamera().SetParallelProjection(True)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
cs.Update()

iren.SetRenderWindow(renWin)

ren.ResetCamera()
iren.Initialize()

w2if = vtk.vtkWindowToImageFilter()
w2if.SetMagnification(int(sys.argv[1]))
w2if.SetInput(renWin)
ex = vtk.vtkPNGWriter()
ex.SetFileName('bar.png')
ex.SetInputConnection(w2if.GetOutputPort())
cs.Update()
renWin.Render()
ex.Update()
ex.Write()

iren.Start()

You can see more detail about the issue at

https://github.com/enthought/mayavi/issues/314

but the gist of the issue is, as far as I could gather, that the tiling disrupts the Ortho transformation, producing an incorrect vtkRenderer::WorldToView transformation.

I might keep digging into the issue, but not being familiar with the internals, I don't know if this is intended behavior that is supposed to be offset somewhere else.

Edited Oct 23, 2018 by Ben Boeckel
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: vtk/vtk#16049