Scenelight + GPU Volume Rendering - incorrect & inconsistent lighting

Hi,

I’m trying to set up volume rendering with Scene Lights rather than using the default Head Light. This is part of a larger project, where I am using vtk external rendering. I was getting significantly different rendering results in my application compared to e.g. paraview - I am using Scenelights in my application rather than Headlights. So I modified the VTK GPURenderDemo.cxx to try and recreate my problems, and find a solution. I’m not at the bottom yet, but even within an entirely VTK environment…

…the volume renders produced with a scenelight differs significantly from the volume renders produced with a headlight with the same parameters when the camera position is the same in both instances.

For instance

  • Scenelight renders may have a much darker diffuse render (but they may not be)
  • Scenelight renders may have no specular highlights (but the diffuse render looks OK)
  • Scenelight ‘shadows’ may noticably differ from those produced by a headlight
  • Scenelight appears to light the volume from completely the wrong direction

NB - I am using GPU rendering, Windows 10, Visual Studio.

The data I have used in this example may be downloaded from:

http://www.pcir.org/researchers/54879843_20060101.html

My modification of the GPURenderDemo code, uploaded to PasteBin:

PasteBin of modified GPURenderDemo source code.

These images were taken using VTK 8.2.0 (clean on today!)

Here…

  • Light is a scenelight at (0, 0, -400) looking at (0, 0, 0), default parameters
  • Camera is at (0, 0, -400) looking at (0, 0, 0)
  • Model is at (0, 0, 0) and its rotation is (0, 0, 0)

Bit dark, but doesn’t look too bad.

But if i rotate the skull, it all goes a wrong…

  • Light is a scenelight at (0, 0, -400) looking at (0, 0, 0), default parameters
  • Camera is at (0, 0, -400) looking at (0, 0, 0)
  • Model is at (0, 0, 0) and its rotation is (0, 90, -90)

The lighting should light up the side of the skull I am looking at - but instead lights up the front an back of the skull.

If I switch to CPU rendering the lighting looks correct (even though the skull has lines through it) The birghtness is also much better.

Light, camera, model is as above.

Now switching back to GPU Rendering, but changing the light to a headlight (in the same place as the scenelight)

  • Light is a Headlight at (0, 0, -400) looking at (0, 0, 0), default parameters
  • Camera is at (0, 0, -400) looking at (0, 0, 0)
  • Model is at (0, 0, 0) and its rotation is (0, 90, -90)

A couple of final points, if I move the camera for the CPU render with the scenelight, the skull is nicely shadowed on the dark side…

[I cannot upload the image because of stupid discourse]

But the moving the camera in the GPU render with the scenelight it is clear that both sides of the skull are lit (and from the wrong direction)

[I cannot upload the image because of stupid discourse]

So…

  • What lighting does and doesn’t work in GPU rendering?
    ** Do scenelights work at all? (These are the ones I most want to use)
    ** Is the headlight the only light I can use? (This seems to be the case, which is quite limiting)
  • If scenelights + GPU will work - how do I get them to work?
  • If scenelights + GPU won’t work - why not? And what plans are there to fix them?

I have the debug output of the camera, volume and lighting settings to show that they are the same, if anyone is interested I can upload them.

Many thanks for your help - this has taken some digging into.

Gavin