I have a case where I always want to cast a shadow from a 3d model, regardless of time of day. I've searched quite extensively (and probably spent about 4-5 hours trying to debug/find a workaround. The closest I've come is https://groups.google.com/forum/#!topic/cesium-dev/q5G3jBLqtJQ suggesting to hack the Cesium JS source code, but that is from 2016 and the source code has changed significantly since.
I've tried:
- All shadow configurations I could think of
- Setting the camera in any way I could think of
Unfortunately I rely on the date and time for the timeline, so I can't hard code the time to when the sun is up at that point.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
<code>
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox: false,
selectionIndicator: false,
shadows: true,
terrainShadows: Cesium.ShadowMode.ENABLED,
shouldAnimate: true,
terrainProvider: Cesium.createWorldTerrain()
});
var cesiumAir = viewer.entities.add({
name : 'Cesium Air',
height : 20.0,
model : {
uri : '../../../../Apps/SampleData/models/CesiumAir/Cesium_Air.glb'
}
});
var entity = cesiumAir;
entity.position = Cesium.Cartesian3.fromRadians(1.81503, 0.02356,30);
viewer.clock.currentTime = Cesium.JulianDate.fromIso8601('2018-11-20T17:33:29Z');
viewer.clock.multiplier = 1.0;
viewer.trackedEntity = cesiumAir;
</code>
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
Shadow is a good way of intuitively indicating how far away an object is from the ground (and at what point in time the object touches the ground). My backup solution is to change color of the model or something like that, but it's quite an ugly hack :)
Unfortunately I rely on the date and time for the timeline, so I can't hard code the time to when the sun is up at that point.
Any help would be greatly appreciated. Thank you so much for Cesium!
4. The Cesium version you're using, your operating system and browser.
Latest Cesium, Latest Chrome, OS X.
var position = Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(frameState.time, uniformState._sunPositionWC);Matrix3.multiplyByVector(transformMatrix, position, position);
Cartesian3.normalize(position, uniformState._sunDirectionWC);
var position = Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(frameState.time, uniformState._sunPositionWC);//Matrix3.multiplyByVector(transformMatrix, position, position);
position = new Cartesian3(0.31181546034703517, 0.8715375694318716, -0.3784090164852737);Cartesian3.normalize(position, uniformState._sunDirectionWC);
--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/D1aOT3kVPpM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.