Conversation
|
The example needs to be added to And please add the respective E2E screenshot via: The PR checks should then be successful. |
8f3fba9 to
b6fd65e
Compare
|
@Mugen87 Added the file to the examples listing and added the screenshot, PR checks passed now! |
|
I had to diff the example in this PR to find the 3 lines which differ from the original example upon which it is based. I think this will be confusing to users.
Why not create an example of that, instead? |
| if ( _clippingEnabled === true ) clipping.beginShadows(); | ||
|
|
||
| shadowMap.needsUpdate = true; | ||
| shadowMap.render( lightsWithShadows, scene, camera, clipping ); |
There was a problem hiding this comment.
clipping parameter does not exist in the ShadowMap render method
|
I did give a try to this feature. It works like a charm. I was able to bake a static shadow on the whole scene in 4k and then render a small dynamic shadow in 1k that calls renderShadowMap only on a few meshes: (In this video the giant shadow camera helper is the shadow camera of the scene, and the small shadow camera helper is the dynamic that only renders the characters through shadowbake.movAlso, to make full usage of it I would recommend a 4th parameter Like so:
That will allow being able to manually force to render an object even though In that case, the render method of |
Agreed. This needs a simple example. |
|
With that new feature it would be very interesting to also introduce Array usage on top of Mesh.Group for the second parameter of It will allow to prevent a complex filtering of the meshes that we want to apply shadow to. That way, instead of doing It could look like this: function WebGLShadowMap( _renderer, _objects, _capabilities ) {
this.render = function ( lights, scene, camera, forceUpdate ) {
// bypass if we want to manually update the shadowmap for specific elements
if ( scope.autoUpdate === false && scope.needsUpdate === false && forceUpdate === undefined ) return;
// allow arrays
const elements = Array.isArray( scene ) ? scene : [ scene ];
for ( let vp = 0; vp < viewportCount; vp ++ ) {
//viewport
_frustum = shadow.getFrustum();
for ( let j = 0; j < elements.length; j ++ ) {
const element = elements[ j ];
renderObject( element, camera, shadow.camera, light, this.type );
}
}
//.... |
|
@mrdoob @Mugen87 Hey! Sorry that it took such a long time for me to get around to updating the example, but it should be much better now! The manually updated shadow map now includes an object that's not visible in normal rendering. DeepScan is complaining about an unrelated issue since this code was forked off of dev a while back - do I need to rebase this branch or merge dev into here? |
This can be used to manually update shadow maps, which can be convenient in case the user wants to set up the scene differently for shadow map rendering. This can be useful for example when showing a cutout view. This work is sponsored by Higharc https://higharc.com/
This example now includes one object that's in the shadow map, but isn't included in normal rendering. It's similar to a real use case where you'd disable a roof of a building when rendering an interior view, but still keep the whole building's shadow visible.
9caed87 to
8fbd7f5
Compare
|
Rebased this to pass the tests and made sure that the patch still works, @mrdoob time to merge this? 😁 I'd be really happy if we got this change in, hope you're not too busy! 🙏 |
|
+1 ! |
|
Hey there, reviving this topic @RenaudRohlinger @sunag I did hack my way on a custom threejs on the webGLRenderer to have both baked and real time lighting, this should definitely be useful to select which shadow you'd like to update, but also : Determining if a light should contribute of the color lighting output, or cast shadow only Example for a scene, let say you have two directional lights : 1 used for baking shadows globally and for lighting color contribution 1 used for real time shadowing, but this one should not contribute to the color lighting as it would add up a second contribution, but on top affecting perfs since one light is only needed for the lighting color contribution EDIT : Found out we can now set light.shadow.autoUpdate to false, and call light.shaow.needsUpdate only when required |
|
Didn't try but I'm pretty sure if you render a shadow once and then do Also you probably need to use |
|
@RenaudRohlinger Yes, It work this way indeed, I did edit the comment, I opened a feature request for the no-lightingcolor contribution |
|
@RenaudRohlinger btw, about using "three": "mrdoob/three.js#dev", the builds are not updated |
This can be used to manually update shadow maps, which can be convenient in case the user wants to set up the scene differently for shadow map rendering. This can be useful for example when showing a cutout view.
Fixed #23461
This contribution is funded by Higharc.