-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed shadowing on entity #5736
Conversation
@tomermoshe thanks for the pull request! I noticed that I am a bot who helps you make Cesium awesome! Thanks again. |
Fixing issue #1825 |
Thanks for the pull request @tomermoshe! |
done and done :) |
@tomermoshe this sample code from #1825 produces the same lighting problems that exist in master: var viewer = new Cesium.Viewer('cesiumContainer', {
sceneMode: Cesium.SceneMode.SCENE2D
});
var scene = viewer.scene;
var instances = [];
for (var lon = -175.0; lon < 175.0; lon += 5.0) {
for (var lat = -85.0; lat < 85.0; lat += 5.0) {
instances.push(new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(lon, lat, lon + 5.0, lat + 5.0),
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)
}
}));
}
}
scene.primitives.add(new Cesium.Primitive({
geometryInstances : instances,
appearance : new Cesium.PerInstanceColorAppearance()
})); |
It's because the appearance is created without {flat:true} . Right now by default PerInstanceColorAppearance is using PerInstanceColorAppearanceFS which takes shadowing into account. If PerInstanceColorAppearance is created with {flat: true} the shader that will be used is PerInstanceColorAppearanceFlatFS (not 100% sure about the name of the shader as I'm not near a computer) which will draw the geometry without shadows. |
Thanks for the explanation @tomermoshe, I forgot about that. We should make sure that the Entity API is passing the correct options to the appearance as well. @bagnell do you want to review this? |
While |
@tomermoshe thanks again for contributing, we received the CLA. |
Hey guys :) How is the review going? |
@tomermoshe sorry for the delay. A lot of the team is at the FOSS4G conference this week. We'll have more time to review your PR when we get back. Thanks! |
any progress on the PR review? |
I don't think this is the right fix either.
Shadows only affect whether the geometry receives shadows from itself or other objects in the scene, but does not affect the shading of the geometry. So you can have a geometry with flat shading that still receives shadows. Basically shadows and flat/regular shading are separate concepts. |
Thanks for taking the time to look into this @tomermoshe! However, it sounds like this isn't the way we want to go about fixing this. We're always happy to review pull requests if you want to submit a different fix =) @lilleyse if you have any suggestions for a different approach, please make a comment in #1825 |
Fixes #1825