-
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
Shadows for terrain #3595
Shadows for terrain #3595
Conversation
// TODO : should have a better way of modifying the GlobeVS and GlobeFS shaders... | ||
vs.sources[1] = ShadowMapShader.createReceiveShadowsVertexShader(vs.sources[1]); | ||
fs.sources[0] = ShadowMapShader.createReceiveShadowsFragmentShader(fs.sources[0], frameState.context); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the easiest way for me to modify the Globe shader to support shadows. I am open to other ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now - standard for the globe shader.
Longer-term (which could be soon), we need a better low-level material system (that still allows dynamically recompiling the shader for when the shadow flags are enabled/disabled). Perhaps we will beef up ShaderProgram
to know about shadows, and add flags to commands for if they cast/receive shadows.
|
||
var shadowCastPrograms = this._shadowCastPrograms; | ||
for (flags in shadowCastPrograms) { | ||
if (shadowCastPrograms.hasOwnProperty(flags)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also longer-term, the pick shader can likely be the same as the shadow cast shader since all it wants to do is render depth for opaque geometry.
Once again, awesome progress here! The code is all good with me. @bagnell please merge if you want to take a quick look. |
For #2594
Terrain casting and receiving shadows. Like
Primitive
I had to modify the terrain uniform map to support relative-to-center that doesn't automatically use the scene's camera.