Skip to content
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

Merged
merged 5 commits into from
Feb 18, 2016
Merged

Shadows for terrain #3595

merged 5 commits into from
Feb 18, 2016

Conversation

lilleyse
Copy link
Contributor

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.

// 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);
}
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 17, 2016

For those interested in a screenshot:

image


var shadowCastPrograms = this._shadowCastPrograms;
for (flags in shadowCastPrograms) {
if (shadowCastPrograms.hasOwnProperty(flags)) {
Copy link
Contributor

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.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 17, 2016

Once again, awesome progress here!

The code is all good with me.

@bagnell please merge if you want to take a quick look.

bagnell added a commit that referenced this pull request Feb 18, 2016
@bagnell bagnell merged commit 40c4e00 into shadows Feb 18, 2016
@bagnell bagnell deleted the shadows-terrain branch February 18, 2016 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants