View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015392VTK(No Category)public2015-03-24 01:142016-08-12 09:55
ReporterB3nni 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version6.0.0 
Target VersionFixed in Version 
Summary0015392: Weird render bug with depth peeling and background texture
DescriptionI have a very weird problem with the render window. It only occurs if:

 - vtkRenderer was set to display a background texture at least once since program start
 - The background texture has a transformation (e.g., scaling for repeat)
 - Depth peeling is enabled
 - At least one transparent actor is displayed.

I attached a minimal working example below. You can use any png file for texture.png. I used a 2x2 pixel PNG with (0,0) and (1,1) black and the other two white (checker board).

I have uploaded the output of the code: http://imgur.com/a/olUW2 [^]

 - The first image is the "expected" outcome, which I retrieved by disabling depth peeling ("renderer->SetUseDepthPeeling(1);" is commeted out)
 - The second image is the outcome after running the example below unchanged
 - The third image shows what happens if zooming is done. Basically, the scene is restricted to the left lower part.

It seems like the transformation of the texture is somehow also applied to the render window?

Any insights on this? (Im running vtk 6 on Windows 8.1. The problem also shows up on two other machines, both Macs with Parallels.


8<--------------------------- Minimal example -----------------------------------------
#include <vtkActor.h>
#include <vtkConeSource.h>
#include <vtkNew.h>
#include <vtkPNGReader.h>
#include <vtkProperty.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSTLReader.h>
#include <vtkTexture.h>
#include <vtkTransform.h>

int main(int argc, char** argv)
{
  // Any texture will work. I use a 2 by 2 pixel checkerboard pattern
  vtkNew<vtkPNGReader> pngReader;
  pngReader->SetFileName("texture.png");
  pngReader->Update();

  // Setting up the texture
  // IMPORTANT: Without a transformation on the texture, the bug will not occur.
  // (You can turn of texture repeating, but I transform to have a repeating texture)
  vtkNew<vtkTexture> texture;
  texture->SetInputConnection(pngReader->GetOutputPort());
  texture->SetRepeat(true);

  vtkNew<vtkTransform> trans;
  trans->Scale(2.0, 3.0, 1.0);
  texture->SetTransform(trans.Get());

  // Adding a transparent cone. Any geometry will work.
  // IMPORTANT: If the geometry is not transparent, the bug will not occur
  vtkNew<vtkConeSource> coneSrc;
  vtkNew<vtkPolyDataMapper> coneMapper;
  coneMapper->SetInputConnection(coneSrc->GetOutputPort());
  vtkNew<vtkActor> coneActor;
  coneActor->SetMapper(coneMapper.Get());
  coneActor->GetProperty()->SetOpacity(0.5);

  // Create the renderer
  // IMPORTANT: If depth peeling is not enabled, the bug will not occur.
  vtkNew<vtkRenderer> renderer;
  renderer->SetUseDepthPeeling(1);
  renderer->TexturedBackgroundOn();
  renderer->SetBackgroundTexture(texture.Get());
  renderer->AddActor(coneActor.Get());

  // Create the render window
  // IMPORTANT: If AlphaBitPlanes is off, the bug will not occur. (But no depth peeling either).
  vtkNew<vtkRenderWindow> renderWindow;
  renderWindow->AlphaBitPlanesOn();
  renderWindow->AddRenderer(renderer.Get());

  // Create the interactor and start up
  vtkNew<vtkRenderWindowInteractor> renderInteract;
  renderInteract->SetRenderWindow(renderWindow.Get());
  renderWindow->Render();
  renderInteract->Start();

  return 0;
}
TagsVTK
ProjectTBD
Typeincorrect functionality
Attached Files

 Relationships

  Notes
(0034991)
T.J. Corona (developer)
2015-08-13 11:40

This issue does not occur on OS X.
(0034995)
B3nni (reporter)
2015-08-14 07:19

I tried again on Windows 10 with both vtk6.2 and vtk6.3RC1. The bug is still there for me. Windows related?
(0037377)
Kitware Robot (administrator)
2016-08-12 09:55

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-03-24 01:14 B3nni New Issue
2015-03-24 01:16 B3nni Tag Attached: VTK
2015-08-13 11:40 T.J. Corona Note Added: 0034991
2015-08-14 07:19 B3nni Note Added: 0034995
2016-08-12 09:55 Kitware Robot Note Added: 0037377
2016-08-12 09:55 Kitware Robot Status backlog => closed
2016-08-12 09:55 Kitware Robot Resolution open => moved
2016-08-12 09:55 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team