Shadows on GeoJsonDataSource

Hi there,

is it possible, that a loaded GeoJsonDataSource recieves shadows from nearby 3DTilesets?
I can’t find any solution to this in the documents, so just stating this short question here.

Or do I have to bake the texture of the loaded data into the used aerial imagery (which is indeed possible for me, but loading it as vector data will be faster/easier for recurring but slightly different tasks)?

example picture:

Best, Lennart

Hi, I think you need to enable shadows property of viewer and also of the GeoJsonDataSource entities. Check this link for detailed example.

Regards,

Hi @lennart.imberg,

@Jacky is 100% correct. A great first step would be to ensure that you have enabled shadows. Please give this a try and let us know if it works.

Best,
Sam

@Jacky , @sam.rothstein Ty for your replies!

I think, my description was a little bit short on infos, so I provide some more:

In this case, I load some 3DTilesets (Buildings + Trees) and have a terrainProvider. Moreover I use a TileMapServceImageryProvider for the aerial imagery visible as groundtextur. All shadows are enabled and working fine (buildings + trees cast and receive, terrain only receives shadows).

Then I load some GeoJSON polygons, to “overwrite” the imageryProvider. This polygons dont receive any shadows at all, if clampToGround is true. If I set some random height (and the polygons are floating above the ground then) they receive shadows.

So maybe clampToGround + shadows isnt implemented yet?

@lennart.imberg, If you are creating polygons with extrudedHeights, you should use Cesium.sampleTerrainMostDetailed to get the actual terrain surface height of polygon locations and set polygon height to place them on terrain surface rather than using clampToGround.

EDIT: I’ve created a sandcastle link which seems polygonGraphics are working fine with clampToGround and shadows property [Increase Decrease time on timeline to see the shadow effect]. Also check the shadowMode property.

It would be easy to understand the issue If you share a sandcastle link.

Regards,

2 Likes

Hi @Jacky, thanks for your effort!

i’ve altered your example a little bit, to show my problem (there are 3 polygons now, 2 floating above the ground, 1 clamped to ground): link

The floating Polygon casts and receives shadows, the clamped one does not.

Best, Lennart

Hi @lennart.imberg, It’s a fact if anything which is clamped to ground surface and has 0 extruded height, will not show shadow. It’s a real world scenario too. I have re-modified the sandcastle link, given extrudedHieght to the clamped entity and it is showing shadow.

Regards,

1 Like

Ty @Jacky for the answer…so I’ll stick to “baking” the vector-texture to my underlying TMS-ImageryProvider, because the texture has to be clamped to ground for my use case.

It would be indeed nice, if clampedToGround polygons are able to receive (not casting obviously) shadows.

Best, Lennart

You can make polygons to receive shadows (not casting) by using shadowMode.

Regards,

Thanks again, @Jacky :rocket: :astronaut: