EDIT: found a partial solution, working on it now.
So I’ve been working on adding support for physically-based rendering into some of my work and have had reasonable success using the new functions present in VTK 9.0, following the Python PBR example found here.
I’m completely satisfied with how PBR handles flat textures however I’m struggling to find a cogent example for the handling of displacement textures within VTK.
Displacement textures modify Polydata by extruding along the normals of a surface to produce a new profile, I’ve attached screenshots of a displacement map being used with the vtkFitToHeightMapFilter() class which gives beautiful results when combined with a tuned SSAO pass.
vtkFitToHeightMapFilter() seems like it’s more suited for the generation of topographic maps as the z-position of the Polydata appears to get overridden and the deformation only occurs in the z-direction. When using a 3D surface (such as vtkParametricBoy) as the input connection this filter will effectively flatten the data along z and then apply the displacement map which makes all of the surfaces co-planar.
I was wondering if there was a filter that deforms Polydata along the normals of the Polydata surface that can use a texture as an input and uses the same transform that is used to map the other PBR textures. Presumably there would have to be some sort of probe filter to do the sampling too.
Here I’ve applied the height map as the albedo texture, what I’d like is for the Polydata to deform so that the darker regions move inwards and the lighter regions outwards along their respective surface normals.
After some research it appears that vtkWarpScalar and vtkProbeFilter is what I was looking for, I’ve got a rudimentary function working that still needs a little tweaking. Currently I convert the image into a scalar array for the displacement to the polydata needs to be a certain size to work. Hopefully I can figure out how the ProbeFilter works to remedy this. The color should be pretty easy to fix, it looks a tad grotesque at the moment.