Displaying indoor models

This tutorial showcases another approach compared to the Importing geometries tutorial. Indeed, loading a complete landscape may be a burden, and this is a costly operation in terms of performances since REDart has to render the complete environment, including the landscape, vegetation, clouds and all decorative geometries.

As an alternative to using a full outdoor environment, we'll use a HDR texture map generated from the outdoor environment:

The generated HDR environment map.

The Asset editor can be used to produce environment maps: It'll generate both a LDR, HDR and a suitable ART environment .red file that can be loaded as we'll see below.

Loading an environment map

The loader is the ART::IAssetManager, and similarly to the loading of complete atlas, we load environment files instead:

// Load our environment:
RED::Object* environment;
RED::Matrix envaxis, planetaxissun;
RC_TEST( iassetmgr->LoadEnvironment( environment, envaxis, planetaxissun, "../Resources/atlas_Environment.red" ) );

// Setup the environment before starting the world:
RC_TEST( iearth->SetEnvironment( environment, envaxis, 1000.0 ) );

// Start the world:
RC_TEST( iworld->Start( window, REDartProgressCB, NULL ) );

We see that the ART::IAssetManager::LoadEnvironment method returns two matrices:

Then, we call ART::IPlanet::SetEnvironment, instead of ART::IPlanet::SetAtlas that was used in the previous tutorial. Setting up an environment will remove an atlas and vice-versa. Note that the SetEnvironment method requires an altitude to be supplied. This is the maximal height of all geometries that are intended to be seen within the environment. This parameter is required noticeably for a proper setup of sun shadows.

Navigating indoor

The navigation remains unchanged, except that now we don't have any environment anymore. Consequently, rendering performances are higher but the environment lighting is static since it's enclosed in an image. Here are a few images of the rendered scene:

A view from the inside with the surrounding environment

Note that since we use a HDR environment map which is a faithful capture of the landscape environment, we get the same lighting intensities as we would have got with the real landscape.

A view from the outside that reveals the environment map

Of course, using an environment don't produce good results for an outside view. In addition we loose the lighting of external lights applied to the landscape as we could notice in the Importing geometries example.