Ogre ecosystem roundup #6

following the last post about what is going on around Ogre, here is another update. With the Ogre 1.12.8 release, mainly the usability of Ogre was improved with the following additions.

Nicer shadows

While revising the depth-texture implementation, I noticed that we would take advantage of that feature for performance instead of quality. With depth-textures the GPU can perform bilinear interpolation of the depth-test, so a single sample (tap) roughly corresponds to a classical 4-tap PCF in the shader. So what we did was just doing a 1 sample instead of 4.
However for hardware capable of depth-textures, performance is typically not an issue, so we should rather improve quality.

The images below show crops from the ShaderSystem sample at 200%. On the left, you see the old setting, while the new setting is in the middle. On the right, you see the 4-tap shader fallback used when depth-textures are not available i.e. on D3D9 and GLES2.

Yeah, so the other news is that D3D11 finally got depth-texture (PF_DEPTH) support as well.

But what if you need to support RenderSystems without PF_DEPTH or you are on GLES2 where PF_DEPTH support is not guaranteed. Well, Ogre will now gracefully fall back to the closeset non-depth format: e.g. PF_DEPTH16 > PF_L16 and the RTSS will then deal with the differences.

While at it, I also updated the default shadow material settings to be more robust as in shadow aliasing artefacts:

Thanks to an additional round of fixes to the emscripten GLES2 backend, you can also try out the shadow improvements in a WebGL2 capable browser.

Improved Documentation

I took another look at the documentation and added a CI test to detect docstring inconsistencies like undocumented or superficial parameters. This should help improving the documentation quality of external and my own pull-requests.While at it I also added doxygen groups to several large classes. These allow tying related methods together. See e.g. the Material class:

Speaking of Materials.. did you ever wonder how they work exactly? Well, now you can take a look at

Better Python integration

Next, it kind of bothered me that one has to write so verbose code, when using the Python bindings, so I tried to take advantage of Python protocols:

# Now, instead of specifying the type as before
vp.setBackgroundColour(Ogre.ColourValue(.3, .3, .3))

# you can do
vp.setBackgroundColour((.3, .3, .3))
# or
vp.setBackgroundColour(numpy.zeros(3))
# or even
vp.setBackgroundColour(range(3))

Also, bytes objects are now supported where raw pointers are expected in the API:

# so you can do
arr = np.zeros((256, 256, 3), dtype=np.uint8)
ogre_img.loadDynamicImage(arr, 256, 256, Ogre.PF_BYTE_RGB)

OgreUnifiedShader as a Cg replacement

In an effort to provide an modern alternative for Cg and to reduce the maintenance overhead of the Ogre internal shaders, I created the OgreUnifiedShader.h that allows writing cross-platform shaders.
It is greatly inspired by the shiny library for Ogre and the shaderc tool of bgfx. However, in contrast to the latter this header is fully self-contained. All you need to do is #include it – no need to run an additional tool. It also has the advantage that you can run your shader through the standard c preprocessor (cpp) to see what the transformed shader looks like.

Just as bgfx, I opted for GLSL as the least common denominator between the shader languages. That is with some preprocessor based abstractions on top:

  • Declare Samplers with SAMPLER2D/3D/CUBE/.. macros instead of sampler2D/3D/Cube/..
  • Use the HLSL style mul(x, y) for matrix multiplication
  • Use mtxFromRows to construct matrices
  • Declare parameters with IN/ OUT macros instead of attribute/ varying
  • Use the MAIN_PARAMETERS & MAIN_DECLARATION macros instead of void main()

Here, I tried to maintain compatibility with bgfx where possible.

For an example of usage, see this PR, where I converted the Light Shafts Demo from Cg to HLSL & GLSL. As you can see there is still some room for improvements on the Ogre Material side.

Anyway, this allowed to drop 1800 lines (#1663) of shader code from the RTSS and we now have arrived at a single, GLSL based, shader library. When I joined Ogre there were 4 RTSS implementations (GLSL, GLSLES, HLSL, Cg) – with individual, subtle, bugs.

blender2ogre for Blender 2.8x

Thanks to a contribution by “Grodou” blender2ogre gained back the ability to export textures with Blender 2.8x, which is notable as we need to read from the node-based shaders for this. Together with some additional fixes by yours truly and the initial porting done by Paul Gerke, this brings exporting with Blender 2.8x roughly at the same level as with Blender 2.7x.

However, we can now take advantage of the texture semantics one gets from the Cycles materials. Thereofore, blender2ogre is able to correctly export emissive textures and, notably, normal maps.

The difference in appearance that you see above is due to the missing gamma handling. Also, to fully match what you see in Blender, we need add support for metalness and roughness maps.

Ogre ecosystem roundup #5

following the last post about what is going on around Ogre, here is another update.

Ogre 1.12.7 point release

The 1.12.7 point release kept its focus on integration. Notably, it ships the new Metal RenderSystem, that was discussed in a previous post. Also there are the following notable changes:

  • Improved Terrain Rendering: The lighting computation was pretty messed up before, which I could fix. See the following screens for comparison. Also, now vertex compression (60% less data per vertex) is used with OpenGL, too.
before – after

  • Filament shader support: Thanks to a contribution of SNiLD, I could extend the existing PBR sample to showcase the usage of Filament PBR shaders. The images below also show the existing glTF2 based material and how far you get by only using plain ogre materials.
  • New stable CSM Sample: I found another interesting Demo on the Forums and added it as a Sample to the Sample Browser. This time it is “Cascaded Shadow Mapping” which resembles the implementation you get in the CryEngine. This is a different take on the PSSM Shadow Mapping Algorithm, which is best explained by visualizing it
  • Debug view in the PSSM RTShader: While working on the CSM Sample, I found the debug split view particularly useful. Therefore, you can now visualize how the PSSM Shadow splits are placed in your scene – check out the updated ShaderSystem Sample.

OgreMeshViewer: LOD preview

If your mesh contains LOD levels, Meshviewer will now display a new tab, highlighting the currently active level

If you would like to know how to automatically generate LOD for your meshes, see the updated Ogre Tutorial.

Ogre 2.2.2 Cerberus Released!

This is a maintenance release. Efforts to port from 2.2.1 to 2.2.2 should be minimum.

Notable additions are:

  • Stable PSSM shadows technique added. Use this feature with ‘num_stable_splits 1’ in compositor scripts when defining the shadow node. Stable PSSM shadows tend to improve quality on the first splits, but they can dramatically reduce quality on the last splits of PSSM; thus using num_stable_splits 1 or 2 but not higher than that is recommended
  • D3D11 improved its handling of device lost
  • It is now possible to draw to a cubemap using MSAA, which was an oversight in Ogre 2.2.1. See the updated DynamicCubemap tutorial

For a full list see the Github release

Discussion in forum thread.

Metal RenderSystem in Ogre 1.12

The Metal RenderSystem backport from Ogre-next, that I talked about in the last round-up, now has landed in the master branch and will be available with Ogre 1.12.7. See the screenshot below for the SampleBrowser running on Metal

The current implementation pretends to have Fixed Function capabilities. Leveraging the unified FFP API introduced with the initial 1.12 release, this allows operating with a default shader. This shader only supports using a single 2D texture without lighting. E.g. vertex color is not supported. This is why the text is white instead of black in the screenshot above.

Proper lighting and texturing support, requires a Metal Shader Language support in the RTSS, which is not there yet. However, if you are mainly using custom shaders on OSX, you can start experimenting with Metal now. Furthermore, buffer updates are currently slowish, as staging buffers had to be disabled. Therefore, the Metal RenderSystem is tagged as EXPERIMENTAL.

Further development will happen at a lower pace though, as Metal neither has the large prevalence of D3D11 nor gives the synergy effects across platforms we have with OpenGL.

So if you want full Metal support in Ogre1, consider contributing and fixing bugs. The code was simplified during backporting, which shows by the size reduction from 14k loc in v2.1 to 9k loc that are now in Ogre1.

Ogre 2.2.1 Cerberus Released!

Whoa! What’s this? Didn’t you announce Ogre 2.1 Baldur was released a few days ago? Yes! Then, what’s going on?

I noticed Ogre 2.1’s release announcement atracted more popularity than I expected (thank you!!!) thus I shall explain:

Ogre 2.1 has been in development for many years, approximately since 2015.

At some point it matured and we started working on the next version: Ogre 2.2

Our regular users who stick around knew 2.1 has been stable for a while now; but we just didn’t have the time or resources to make a release (packaging binaries, ensuring everything works, etc). And many fixes from 2.2 also kept getting backported.

And 2.2 had just reached maturity too.

Ogre 2.1 was a major refactor and users porting existing code from Ogre 1.x is definitely doable, but still requires a lot of effort.

Unlike 1.x -> 2.1 transition though, 2.1 -> 2.2 transition is a much smoother experience, because it mostly touches Texture manipulation code and end users rarely manipulate a lot of Textures via code directly.

The Texture code of 2.1 was entirely replaced by the new TextureGpu code; which supports background streaming and solves many RAM issues that plagued 2.2.

Wait! 2.2.1… where’s Ogre 2.2.0?

Ogre 2.2.1 and 2.2.0 are being released concurrently. This is because during development a few of our users and testers needed to distinguish between more stable features (texture streaming) from the less stable ones (Global Illumination) and we used OGRE_VERSION_PATCH for that.

However our GI code has stabilized now.

Because there is now virtually no reason to use Ogre 2.2.0 over 2.2.1; we just went ahead and make a source-code-only release of Ogre 2.2.0 for archival reasons and a source-code + SDK release of 2.2.1

Ogre 2.2.1 also contained several bug fixes which made no sense to backport to 2.2.0 as it would only increase our work.

Download Ogre 2.2.1

Codename Cerberus

For more information, see the manual

See SW & HW Requirements
See platforms supported
See Ogre 2.1 FAQ
See What’s new in Ogre 2.2

  • Texture streaming! Completely refactored Texture code. It consumes a lot less RAM and supports background streaming
  • Voxel Cone Tracing (VCT): Semi-Realtime GI solution. Supports diffuse and specular. Can consume a lot of VRAM depending on quality. Lighting changes can be done in realtime. Changes to static objects in scene needs to rebuild voxels (not realtime)
  • Irradiance Field with Depth (IFD): Generic variant of DDGI using Voxels (consumes more VRAM) or Rasterization (slower to build). It supports diffuse only and is lower quality than VCT, but is much faster. And if completely static, consumes very little memory.
  • Per-pixel Cubemap probes
  • VR readiness: New sample showing how to integrate OpenVR SDK, deal with running start, performance optimizations such as Instanced Stereo, Hidden Area Mesh and Radial Density Mask
  • Mobile friendly: Added Load and Store actions to control how TBDR GPUs flush their caches

What’s next?

  • Stable PSSM Shadowmaps
  • Vulkan support

All branches except the Vulkan one are being merged back into master. Whatever is in master will likely become Ogre 2.2.2 one day.

That doesn’t mean Vulkan will or will not make it to 2.2.2, it’s just that we want to always keep master branch with a relatively high degree of stability (i.e. rolling release model), which the Vulkan branch cannot yet provide.

Relevant posts: