-
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
base: master
Are you sure you want to change the base?
Changes from all commits
0f0fb87
286bfc4
3de42da
a783d45
f159a4a
ce4c445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ import { EngineStore } from "../Engines/engineStore"; | |
| import { Constants } from "../Engines/constants"; | ||
| import { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from "./clipPlaneMaterialHelper"; | ||
| import type { WebGPUEngine } from "core/Engines/webgpuEngine"; | ||
| import { GetTypeByteLength } from "../Buffers/bufferUtils"; | ||
|
|
||
| import type { ExternalTexture } from "./Textures/externalTexture"; | ||
| import { | ||
|
|
@@ -885,12 +886,33 @@ export class ShaderMaterial extends PushMaterial { | |
| 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"); | ||
| } | ||
| } | ||
|
|
||
| // Add vertex buffer metadata defines for proper stride/offset handling | ||
| const geometry = renderingMesh.geometry; | ||
|
Contributor
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. I think you want to use the new Also, I think we should pass 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) |
||
| if (geometry) { | ||
| const vertexBuffers = geometry.getVertexBuffers(); | ||
| if (vertexBuffers) { | ||
| for (const attributeName in vertexBuffers) { | ||
| const vertexBuffer = vertexBuffers[attributeName]; | ||
| if (vertexBuffer) { | ||
| const componentBytes = GetTypeByteLength(vertexBuffer.type); | ||
| const upperName = attributeName.toUpperCase(); | ||
| const stride = vertexBuffer.effectiveByteStride / 4; | ||
| const offset = vertexBuffer.effectiveByteOffset / 4; | ||
|
|
||
| defines.push(`#define ${upperName}_STRIDE ${stride}`); | ||
| defines.push(`#define ${upperName}_OFFSET ${offset}`); | ||
| defines.push(`#define ${upperName}_COMPONENT_BYTES ${componentBytes}`); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const drawWrapper = storeEffectOnSubMeshes ? subMesh._getDrawWrapper(undefined, true) : this._drawWrapper; | ||
|
|
||
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.
"_COMPONENT_BYTES" is not set.