Screen Space Curvature

This is a supplementary webpage for the following paper:

Prantl,M., Váša,L., Kolingerová,I.: Fast Screen Space Curvature Estimation on GPU, In Proceedings of the 11th Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications (VISIGRAPP 2016) - Volume 1: GRAPP, pp. 151-160 ISBN: 978-989-758-175-5, 2016.

Unity implementation

There is a Unity implementation of the demo application (see section bellow). It uses deferred rendering path and camera has also output to the depth texture via


The demo could also be done using


texture from camera instead of deferred rendering path (Unity supports this). Precission of the depth and normals together like this is of a low quality and the results of the effect are incorrect. This is fine, since the algorithm is targeted for deferred rendering eitherway. Main script of the program is Scripts\CameraScript.cs. This is script attached to the camera and is applied as post-processing effect. Main part of the camera script is this code, where screen space shader variables are set and shader is executed.

	void OnRenderImage(RenderTexture source, RenderTexture destination)
		//obtain back corners of the camera view frustum in view space
		this.vf.GetCorners(ref this.corners, ViewFrustum.Face.BACK, ViewFrustum.Space.VIEW);

		//set frustum corners to the shader
		material.SetVector("_frustrumCorners0", this.corners[0]);
		material.SetVector("_frustrumCorners1", this.corners[1]);
		material.SetVector("_frustrumCorners2", this.corners[2]);
		material.SetVector("_frustrumCorners3", this.corners[3]);

		//set LOD and curvature type
		material.SetInt("_useLod", this.useLOD);	
		material.SetInt("_meanCurvature", this.meanCurvature);
		//set inverse view matrix
		Matrix4x4 inv = Matrix4x4.Inverse(Camera.main.worldToCameraMatrix);
		material.SetMatrix("_CameraInverseViewMatrix", inv);

		//some additional variables
		material.SetFloat("_fFarClipPlane", Camera.main.farClipPlane);
		material.SetFloat("_inervalSize", this.intervalSize);
		//render effect
		Graphics.Blit(source, destination, material);

Rest of the script is GUI controling a model initializations. Folder Utils contains some utilitites for rendering, model loading and view frustum calculations.
Shaders and curvature gradient texture are in Resources folder of the project. There is also CullOff shader to turn-off backface culling of the models.
Post process surface shader only - Download
Entire Unity project - Download


This is a demo application created from the Unity project described above. Download

Controls: If you just run the application, you can choose curvature visualisation on the predefined models. Loaded OBJ is in this case empty. In the left upper corner, there is a fame-rime. This is not only shader time, but time of the entire engine loop.
Application can be started with one additional argument (...\demo.exe model.obj). This is *.obj model file that will be loaded and accessible via "Loaded OBJ" checkbox. However, there is a limitation for this model. For simplicity only models up to 50,000 are supported. If you want bigger models, use directly Unity project and import them to the scene.

  • Use mouse wheel to zoom-in / zoom-out
  • Enable ArcBall rotation - enable / disable rotations of the scene
  • LOD active - enable / disable LOD - with disabled, takes direct triangle neighbors, else use some adaptive neighborhood (see paper for details)
  • Mean curvature - shows mean curvature
  • Gauss curvature - shows Gauss curvature
  • Clamp interval - Mapping interval of the curvature. Min and Max values will have colors as shown in gradient image
  • Reset transformations - Reset all rotations and translations of the model

Download demo

Copyright © 2013 Centre of Computer Graphics and Visualization. All Rights Reserved.