Changing the raster overlay at run time

Hi - I want to allow the user to change between Bing Road, Bing Image and Bing Image + Labels at run time.

I was hoping that I could use the CesiumIonRasterOverlay and set the Ion Asset ID. But it seems that that property isn’t accessible at run time (there’s no getter/setter).

Then I tried the CesiumBingRasterOverlay - that has a getter/setter for the “Bing Style” and associated Enum. Perfect I thought… But… I can’t get that working. It seems it wants some form of additional authentication.

Does anyone have any recommendations on what to try next - here are the three things I can think of:

  1. Customize the code for the CesiumIonRasterOverlay to make the Ion Asset ID visible at runtime.
  2. Figure out what credentials I need to use the CesiumBingRasterOverlay.
  3. Instantiate three Cesium3DTileSets in my game level - one for each mode - and then control the visibility of these actors (e.g. show one and hide the other two).

Any other ideas? Any thoughts on what would be the best approach.

Many thanks!

p.s. if I’ve hidden a tileset will it stop streaming data? I also have a fourth option - the user can select Google 3D Tiles - and I’m using a second tile set actor for that. But as that’s a pay-for service I don’t want it continually pinging the Google API even when it’s hidden… Thanks.

Hi @jdh2550,

It looks like the lack of getter / setter is an oversight. (You can change the ion asset ID for Cesium3DTileset, so I see no reason why raster overlays should be different). So if you have the bandwidth, we would love a community contribution to add a Blueprint getter / setter for that variable!

An alternative solution is attaching multiple ion raster overlay components to the tileset. The MI_CesiumThreeOverlaysAndClipping material is configured to handle up to three raster overlays, each on their own material layer:

So for each ion raster overlay. set the material layer key to the desired label:

Then, make a copy of the aforementioned material. You can modify the material layers to have a parameter controlling whether or not they are visible. Then, you can control these parameters from Blueprints.

However, having a getter / setter in code is definitely the easier option :smiling_face_with_tear:

Hi @janine - I’ll give that a try - it doesn’t sound too terribly difficult! (Ha, famous last words!).

I’m curious though about your alternative solution. Because I tried something similar - I wanted to be able to change the color of the material layer at run time - but I couldn’t get that working. Won’t I run into the same problem with your suggestion?

Here’s my original post: How to add colored polygons at runtime?

Hi @jdh2550,

From taking a look in your post, you were looking at changing parameters in the Material Layer Blend asset. Unfortunately, I think it isn’t possible (as you found on the thread). But there are functions for setting parameters on the material layer itself. For example, the Set Scalar Parameter Value by Info Blueprint allows you to modify a scalar parameter on the layer. You could use that to control the opacity of the raster overlay layers by proxy.

Granted, I haven’t prototyped the above, so I can’t point to a working example. But hopefully the idea counts :smiley:

1 Like

Oops - it seems I was using an old version of the plugin - when I refreshed the plugin code I found that the Ion Asset ID was available.

Note to self: Make sure you’re on the latest version! :smiley:

1 Like