Skip to content

Conversation

@MiiBond
Copy link
Contributor

@MiiBond MiiBond commented Oct 31, 2025

This PR adds defines to assist with vertex pulling when the vertex buffers are interleaved.
I'm also including a fix by @Popov72 for IBL shadow voxelization when using bones.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

1 similar comment
@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

#define MATRICESINDICES_OFFSET 0
#endif

fn readMatrixIndices(index : u32) -> vec4f {
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 is my attempt to get the bone matrix stuff working but I haven't been successful yet. I'm treating the storage buffer of indices as an array of u32's and then unpacking either 1 or 2-byte indices from that and converting to floats.
But I must be doing something wrong.

Copy link
Contributor

@Popov72 Popov72 Nov 3, 2025

Choose a reason for hiding this comment

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

I was trying to investigate this problem, but I noticed there's something wrong which is not related to morph/bones.

If you replace the alien head with a box, it works:

https://playground.babylonjs.com/?snapshot=refs/pull/17376/merge#BHCFCU#4
image

But if I comment out the code that checks if an animation is running, so that the voxelization code runs every two frames, there's no shadow anymore:

https://playground.babylonjs.com/?snapshot=refs/pull/17376/merge#BHCFCU#5
image

I was able to fix a bug (not related to the problem above, though):

1f3663e

With this bug fixed, if I comment out the code which regenerates the voxelization every two frames, we can see the shadow is ok (obviously, it does not take into account the animation, though):

babylonjs.webm

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 31, 2025

@deltakosh deltakosh requested a review from Popov72 November 1, 2025 00:15
@MiiBond MiiBond force-pushed the mbond/voxel-shadow-fixes branch from 1cee238 to ce4c445 Compare November 7, 2025 19:31
@MiiBond
Copy link
Contributor Author

MiiBond commented Nov 7, 2025

@Popov72 I've included your fix and also made once that fixes the voxelization when calling it repeatedly.

This allows the voxelization to work with all the animated assets that I've tried.
Though, I suspect an animated asset that moves a lot will pass outside the bounds of the voxelization since the bounds update doesn't take skinning into account.

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 7, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 7, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 7, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 7, 2025

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