Particle System shadow enable

**Hi, **

I’m trying to simulate weather conditions with practical system (see the attach video).

I create a full sky cloud coverage and add “cloud.shadows = Cesium.ShadowMode.CAST_ONLY” property to the cloud (cloud = new Cesium.ParticleSystem)

**but as you can see in the video the building are still have the same shadow. **

**I expected that the sun will be hidden from the buildings, **what am I miss here?

thanks

Ohad

Video_00002_x264.mp4 (2.45 MB)

That looks really cool! Unfortunately, I don’t think particle systems have a shadows property:

https://cesiumjs.org/Cesium/Build/Documentation/ParticleSystem.html

I’m not sure how computationally expensive it would be to take particle systems into account when casting shadows. One thing you could do for now is create an invisible entity in the position you want that’ll cast the shadow. If it’s completely invisible CesiumJS will automatically not cast a shadow, but you can make it have an alpha of just 0.01:

var shadowEntity = viewer.entities.add({

height : 40.0,

name : ‘Shadow’,

box : {

dimensions : new Cesium.Cartesian3(100.0, 100.0, 1.0),

material : new Cesium.ColorMaterialProperty(new Cesium.Color(0,0,0, 0.01)),

shadows : Cesium.ShadowMode.ENABLED

}

});

``

So here I’m using it to artificially create a shadow over the plane:

Sandcastle link.

thanks,

very good idea,

other option is to change the shadow darkness when the camera approach to the clouds area maybe it will be better in performances no?

Ohad

בתאריך יום שלישי, 4 בדצמבר 2018 בשעה 19:05:29 UTC+2, מאת Omar Shehata:

That might work but I’m not sure how easy it would be to compute the darkness based on the angle/distance of the camera.

Might be worth a try though!

well,

the shadow darkness works better.

I add to my main root a function map.camera.changed.addEventListener(function ()

in in that function I measuring the distance of the camera to array of object in the view scenario ( Cesium.Cartesian3.distance(map.scene.camera.position, <arrayOfpostions))

and according to that I’m change the environment conditions like sky, fog and clouds - in cloud display I change the shadow darkness as function of cloud density.

works wonderful

Ohad

בתאריך יום רביעי, 5 בדצמבר 2018 בשעה 18:18:27 UTC+2, מאת Omar Shehata:

That sounds really cool! Can you post a video of that? I’d love to see.

Hi, I create an online version that you can look at.

can you send me a mail address I’ll send you a link

Ohad

בתאריך יום חמישי, 6 בדצמבר 2018 בשעה 18:56:57 UTC+2, מאת Omar Shehata:

Feel free to email me at omar@cesium.com !