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

@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

// Calculate offset in float32 elements
const offset = vertexBuffer.effectiveByteOffset / sizeInBytes;
defines[`${upperName}_OFFSET`] = offset;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

"_COMPONENT_BYTES" is not set.

}

// Add vertex buffer metadata defines for proper stride/offset handling
const geometry = renderingMesh.geometry;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to use the new PrepareDefinesForVertexPullingMetadata function instead?

Also, I think we should pass stride and offset as a byte count instead of a float count, to more easily handle all type conversions we will have to support (for example, type of position could be a (u)byte, (u)short, (u)int, float, and for the integer types, they could be normalized or not - these are type conversions we will have to perform in the shader).

Another thing is that we should probably use uniforms and not defines to pass data, else we will basically generate a new shader for each mesh, as (at least) offset will be different for each mesh.

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