Changing scene background

1683
4
02-04-2017 02:17 PM
KirstenStrandjord
New Contributor III

I create a topographic scene in my main window constructor like so:

ui->setupUi(this);

// Create a scene using the topographic BaseMap

mn::Scene* scene = new mn::Scene(mn::Basemap::topographic(this), this);

// create a new elevation source from Terrain3D rest service

mn::ArcGISTiledElevationSource* elevationSource = new mn::ArcGISTiledElevationSource(

QUrl("http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"), this);

// add the elevation source to the scene to display elevation

scene->baseSurface()->elevationSources()->append(elevationSource);

// Create a scene view, and pass in the scene

m_sceneView = new mn::SceneGraphicsView(scene, this);

ui->map->addWidget(m_sceneView);

The scene currently has a starry night background. I would like the background to just be a solid color. This seems like a simple change, but I am having the hardest time finding the code for it. Any ideas? Thanks!

4 Replies
LukeSmallwood
Esri Contributor

Hi Kirsten,

If you want to change the background of your scene, you can use:

void SceneView::setAtmosphereEffect(AtmosphereEffect effect);

with your m_sceneView object above.

The AtmosphereEffect enum lefts you choose from:

AtmosphereEffect::None (0)

No atmosphere effect.

AtmosphereEffect::HorizonOnly (1)

A simple atmosphere effect. This is not resource intensive.

AtmosphereEffect::Realistic (2)

A more realistic atmosphere effect. Looks the best but is resource intensive.

The HorizonOnly option will give you a scene background with a blue sky effect which may help with what you are looking for. The default is None (the starry night background you mentioned).

We do not currently support the ability to set a custom colour for the scene background - is that something which you have a use case for?

0 Kudos
KirstenStrandjord
New Contributor III

Hi Luke,

Thanks for the input. I was hoping to set the background color of the scene. I don't like the appearance of the starry sky. Is there any work around for setting the scene background to a custom color?

0 Kudos
LukeSmallwood
Esri Contributor

Hi Kirsten,

We do not currently have a method to allow you to set the background colour of your scene. If this is a workflow which you require I can see if it can be added for a future release.

0 Kudos
LukeSmallwood
Esri Contributor

Hi Kirsten - just to keep you informed, a feature planned for the  `SceneView` for a future release is the ability to set the background to be transparent.  

When implemented, this would allow you to use whatever you need as the background (for example and Image or a Rectangle with the colour you want)