OSM2World/Shader

From OpenStreetMap Wiki
Jump to navigation Jump to search

This page documents the progress of the GSOC 2015 project "Improving the OSM2world GUI", see Google Summer of Code/2015/AcceptedProjects. The goal is to replace the current old fixed function pipeline in the OSM2World GUI with a modern shader based one. As well the overall look shall be improved with modern graphic effects. The code can be found at github.

Progress

Week 1:

Getting familar with the OSM2World codebase, JOGL and OpenGL shader programming.

Week 2:

Refactoring the existing rendering pipeline to allow different implementations. A common JOGLTarget interface was introduced. The old implementation resides at JOGLTargetFixedFunction and a new JOGLTargetShader was introduced. As much code as possible is shared between both implementations. The fixed function pipeline is preserved as a fallback for old hardware.

Week 3:

Implementing basic lighting. An ambient, diffusion, specular reflection lighting model was implemented together with phong shading.

Week 4:

Implementing basic one layer textures.

Week 5:

Extending texture support to multiple layers, supporting transparent objects with depth sorting, basic support for multiple shader programs, supporting non-area primitives (needed by some debug views) via a separate shader program.

Week 6:

replace deprecated screenshot export code and ImageExporter code, support backgrounds with shaders, support anisotropic filtering, started work on bumpmaps

Week 7:

complete bumpmap support, add MSAA support, fix ImageExporter

Week 8:

started work on shadow maps

Week 9:

completed shadow maps: transparency, automatic optimal frustum calculation, use XZBoundary from .osm file

Week 10:

debug shadow maps, add Percentage Closer Filtering (PCF) for blurring shadow edges, started work on shadow volumes

Week 11:

support for simple shadow volumes (per vertex)

Week 12:

Week 13:

Configuration File Options

  • joglImplementation = shader Use the new shader based JOGL implementation with support of all the following options. Requires support for OpenGL 3.2
  • shadowImplementation Select the shadowing technique. shadowVolumes renders only shadows casted by non-transparent objects with shadow volumes. shadowMap renders the shadows of all objects with a shadow map, but only the back faces (from light source view) cast a shadow. both uses shadow maps for transparent objects and shadow volumes for the rest. shadowMap with a high resolution is recommended if performance matters.
  • shadowMapWidth, shadowMapHeight resolution of the shadow map in pixels
  • shadowMapCameraFrustumPadding padding in meter for the camera frustum to use for the shadow map camera. Increase here if objects outside the current camera view frustum, that should throw a shadow won't do so.
  • msaa number of samples for multi sample anti-aliasing
  • overwriteProjectionClippingPlanes optimize the clipping planes of the camera: reduce them to match the world bounding box
  • useSSAO use screen space ambient occlusion (causes dark corners of buildings etc.)
  • SSAOkernelSize size of the sampling kernel (number of samples). Higher value improves quality (less noise) but decreases performance.
  • SSAOradius sampling radius in meter. Higher value increases the range of the effect.
  • exportAlpha export alpha channel in png export. Use true if you want a transparent background.
  • material_MATERIAL_NAME_specular Specular value of the material as used in the phong lighting model
  • material_MATERIAL_NAME_shininess Shininess value of the material as used in the phong lighting model
  • material_MATERIAL_NAME_shadow false disables the shadow casting of all objects using this material
  • material_MATERIAL_NAME_ssao false disables the ambient occlusion casting of all objects using this material
  • material_MATERIAL_NAME_TEXTURELAYER_bumpmap true uses the texture assigned for TEXTURELAYER as normal map. The normal map is used by the phong lighting model and can by used to simulate bumps in the material.