A Compute shader that generates a height map from 2D vector contours. In combination with a tesselation shader this can be used to generate three-dimensional geometry out of two-dimensional polygons.
We extracted contours out of a video with OpenCV and used these contours as input for the compute shader. Using the height map with a tesselation shader you get a three-dimensional geometry out of a simple video.
Changing the mapping function 1.0 - rcp(1.0 + smallestDistance * curviness)
at the end of the shader will result in different shaping of the geometry.
This shader was written as part of the research publication Real-Time Relighting of Video Streams for Augmented Virtuality Scenes and a corresponding master's thesis at the Virtual Sets and Virtual Environments Laboratory of the University of Applied Sciences Düsseldorf.
Contours | Height Map | Rendered geometry |
---|---|---|