Skip to content

Enable the use of threejs lightShadows with custom shaders #30842

Closed
@Spiri0

Description

@Spiri0

Description

First of all: This point is not a high priority but it would be useful.
I can access the shadow map and shadow matrix of a light source and use it in my own shaders since r174. That's great. The problem, however, is that when I change the light position, the shadows rattle.

https://codepen.io/Spiri0/pen/NPWEQmB?editors=0010

This is probably caused by a frame delay. If I create a custom light source with its own shadow and control the update myself, it works smoothly. That's also the reason why it's not a high priority in my opinion. I can solve this by creating a customLight with a customShadow. That's just more work. Being able to use the shadow texture from Threejs light sources would be much nicer.

Solution

I suspect the cause is a frame delay. I'm not very familiar with the threejs shadow logic yet. The solution would therefore be to fix this frame delay.

Alternatives

I use my own light source with my own shadow camera. It works perfectly.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions