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

Shadow Catcher Script #7299

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Shadow Catcher Script #7299

wants to merge 9 commits into from

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented Jan 20, 2025

Consolidates the various Shadow Catcher implementations into a single version that can be used across editor/react/web components.

See demo and editor

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@marklundin marklundin requested a review from a team January 20, 2025 13:29
@marklundin marklundin self-assigned this Jan 20, 2025
@LeXXik
Copy link
Contributor

LeXXik commented Jan 20, 2025

The first link is not correct me thinks.

@marklundin
Copy link
Member Author

The first link is not correct me thinks.

Ah yep. Needs V2 engine. updating comment

@willeastcott
Copy link
Contributor

Great that we will add a shadow catcher to the engine's esm script library. It's a little different from the Web Components copy though:

https://github.com/playcanvas/web-components/blob/main/examples/assets/scripts/shadow-catcher.mjs

How come this version doesn't require a custom layer? cc @slimbuck

shadowBias: 0,
shadowDistance: this.shadowDistance,
shadowResolution: 1024,
shadowType: SHADOW_VSM_16F,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few/most of the light properties should be exposed as attributes, allowing user control. Lets say I want soft shadows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep valid point

@mvaligursky
Copy link
Contributor

also please expose soft shadow properties now that the shadow type is exposed, see public in description here: #7258

@willeastcott
Copy link
Contributor

willeastcott commented Jan 21, 2025

Instead of just proxying lots of light properties, why not just stipulate that the script has to be applied to an entity with a light component? Better yet, the script could collect all lights below the entity and bake them all into the shadow catcher.

@marklundin
Copy link
Member Author

Instead of just proxying lots of light properties, why not just stipulate that the script has to be applied to an entity with a light component? Better yet, the script could collect all lights below the entity and bake them all into the shadow catcher.

Yep I like this, although we have a custom shader at the moment that just picks the internal light

litArgs_opacity = mix(light0_shadowIntensity, 0.0, shadow0);
gl_FragColor.rgb = vec3(0.0);

We'd need that for each shadow and dynamically generate that shader, or could introduce some getShadow() to the lit shader which returns it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants