-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Voxel shadow fixes for interleaved buffers #17376
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
Closed
+342
−30
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2a8452a
Fix for vertex pulling of interleaved buffers
37c0048
Fix bones when using vertex pulling
Popov72 3f24162
Fix vertex type in voxel shadows
b690d19
Trying to get skinned meshes working with voxelization
23de680
Fix wrong shadows with morphs
Popov72 f87ba0e
Fix for multiple voxelization calls at once
4f5c71f
Handle vertex pulling of different data type
0703d03
Cleanup and fixes
86b881a
Revert package-lock
MiiBond a23da70
Address PR comments
MiiBond bf29406
WebGPU voxelization fixes
MiiBond 94bcbe5
Fix WebGPU voxelization skinning shader
MiiBond 3c8bb21
Address PR comments
MiiBond 9df56ea
Address PR comments
MiiBond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,8 +30,11 @@ import { | |
| BindMorphTargetParameters, | ||
| BindSceneUniformBuffer, | ||
| PrepareDefinesAndAttributesForMorphTargets, | ||
| PrepareVertexPullingUniforms, | ||
| BindVertexPullingUniforms, | ||
| PushAttributesForInstances, | ||
| } from "./materialHelper.functions"; | ||
| import type { IVertexPullingMetadata } from "./materialHelper.functions"; | ||
| import type { IColor3Like, IColor4Like, IVector2Like, IVector3Like, IVector4Like } from "core/Maths/math.like"; | ||
| import type { InternalTexture } from "./Textures/internalTexture"; | ||
|
|
||
|
|
@@ -147,6 +150,7 @@ export class ShaderMaterial extends PushMaterial { | |
| private _cachedWorldViewMatrix = new Matrix(); | ||
| private _cachedWorldViewProjectionMatrix = new Matrix(); | ||
| private _multiview = false; | ||
| private _vertexPullingMetadata: Map<string, IVertexPullingMetadata> | null = null; | ||
|
|
||
| /** | ||
| * @internal | ||
|
|
@@ -897,19 +901,32 @@ export class ShaderMaterial extends PushMaterial { | |
| } | ||
| } | ||
|
|
||
| const renderingMesh = subMesh ? subMesh.getRenderingMesh() : mesh; | ||
| if (renderingMesh && this.useVertexPulling) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use the same condition with the code adding the defines ? |
||
| // Add vertex buffer metadata defines for proper stride/offset handling | ||
| const geometry = renderingMesh.geometry; | ||
| if (geometry) { | ||
| this._vertexPullingMetadata = PrepareVertexPullingUniforms(geometry); | ||
| if (this._vertexPullingMetadata) { | ||
| this._vertexPullingMetadata.forEach((_, attribute) => { | ||
| uniforms.push(`vp_${attribute}_info`); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (this.customShaderNameResolve) { | ||
| uniforms = uniforms.slice(); | ||
| uniformBuffers = uniformBuffers.slice(); | ||
| samplers = samplers.slice(); | ||
| shaderName = this.customShaderNameResolve(this.name, uniforms, uniformBuffers, samplers, defines, attribs); | ||
| } | ||
|
|
||
| const renderingMesh = subMesh ? subMesh.getRenderingMesh() : mesh; | ||
| if (renderingMesh && this.useVertexPulling) { | ||
| defines.push("#define USE_VERTEX_PULLING"); | ||
|
|
||
| const indexBuffer = renderingMesh.geometry?.getIndexBuffer(); | ||
| if (indexBuffer) { | ||
| if (indexBuffer && !(renderingMesh as Mesh).isUnIndexed) { | ||
| defines.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"); | ||
| if (indexBuffer.is32Bits) { | ||
| defines.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"); | ||
|
|
@@ -1085,6 +1102,10 @@ export class ShaderMaterial extends PushMaterial { | |
| // Clip plane | ||
| BindClipPlane(effect, this, scene); | ||
|
|
||
| if (this._vertexPullingMetadata) { | ||
| BindVertexPullingUniforms(effect, this._vertexPullingMetadata); | ||
| } | ||
|
|
||
| // Misc | ||
| if (this._useLogarithmicDepth) { | ||
| BindLogDepth(storeEffectOnSubMeshes ? subMesh.materialDefines : effect.defines, effect, scene); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/dev/core/src/ShadersWGSL/ShadersInclude/bonesDeclaration.fx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move everything related to Vertex Pulling in a vertexPullingHelper.functions.ts ?