Skip to content

castle-engine/test-high-precision-terrains

Repository files navigation

Test loading terrains from 16-bit and higher precision image formats

We added to CGE capability to read 16-bit and higher precision image formats:

  • 16-bit PNG images can be loaded to 4 float-based image formats:

    • TGrayscaleFloatImage,
    • TGrayscaleAlphaFloatImage,
    • TRGBFloatImage,
    • TRGBAlphaFloatImage.

    This happens both when PNG are read using LibPng (default) and Vampyre Imaging Library (as a fallback).

  • Float-based KTX images can be loaded to 4 float-based image formats mentioned above.

  • Likewise, 16/32-bit TIFF images can be loaded to float-based image formats mentioned above.

    Note that TIFF reading capability is not enabled by default in CGE. You have to enable TIFF support in your application and distribute the TIFF library (libtiff) with your application. See

  • We have full set of 4 float-based image formats:

    • TGrayscaleFloatImage,
    • TGrayscaleAlphaFloatImage,
    • TRGBFloatImage,
    • TRGBAlphaFloatImage.

    Previously we only had TRGBFloatImage, which was not optimal (in case you only needed grayscale) or missed alpha.

    All the float-based image formats can now be uploaded to GPU as float textures, thus could be used to process this data on GPU in shaders. That is, we don't "lose" the extra precision (from 16/32-bit information or floats) anywhere on the way to the GPU.

This example contains some terrains designed using this feature.

This example also contains some testing TIFF images. Remember that you will not open them with default CGE editor or castle-image-viewer:

  • for CGE editor, you need to follow the above instructions to get custom build with libtiff support.

  • for castle-image-viewer, you can compile it from the extra-image-formats branch mentioned above.

See https://forum.castle-engine.io/t/request-for-tif-support/1240/26 for forum thread that initiated this.

Screenshots

Screenshot with heightmap and diffuse texture - great lakes Screenshot with heightmap and diffuse texture - rugged terrain Screenshot with heightmap Huge TIFF in castle-image-viewer

Thank you

Thanks go to Erik Johnson for supporting Castle Game Engine development, both on Patreon and by actually using the engine to develop new projects, and providing a ton of useful feedback on our forum!

The sample data has been provided by:

License

Permissive (do what you want) BSD 3, see LICENSE.

This example by Michalis Kamburelis.

Building

Compile by:

  • CGE editor. Just use menu items "Compile" or "Compile And Run".

  • Or use CGE command-line build tool. Run castle-engine compile in this directory.

  • Or use Lazarus. Open in Lazarus test_height_map_16_standalone.lpi file and compile / run from Lazarus. Make sure to first register CGE Lazarus packages.

  • Or use Delphi. Open in Delphi test_height_map_16_standalone.dproj file and compile / run from Delphi. See CGE and Delphi documentation for details.

About

Test loading terrains from 16-bit and higher precision image formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages