Skip to content
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

fix: MeshTransmissionMaterial prevent setting values on discard mat when backside is off #1584

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

vis-prime
Copy link
Contributor

Why

In drei/MeshtransmissionMaterial

in this section

parent.material = discardMaterial
if (backside) {
// Render into the backside buffer
state.gl.setRenderTarget(fboBack)
state.gl.render(state.scene, state.camera)
// And now prepare the material for the main render using the backside buffer
parent.material = ref.current
parent.material.buffer = fboBack.texture
parent.material.thickness = backsideThickness
parent.material.side = THREE.BackSide
}
// Render into the main buffer
state.gl.setRenderTarget(fboMain)
state.gl.render(state.scene, state.camera)
parent.material.thickness = thickness
parent.material.side = side
parent.material.buffer = fboMain.texture

if backside is off , mtm is not restored on the "parent" mesh

so in the next lines thickness, side, and buffer are actually being set on the discard material instead of mtm
bugg

What

Moving parent.material = ref.current before the value is set
This error does not affect r3f somehow

Checklist

  • Documentation updated (example)
  • Storybook entry added (example)
  • Ready to be merged

Sorry, something went wrong.

@vercel
Copy link

vercel bot commented Jul 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2023 4:41pm

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c30162b:

Sandbox Source
pedantic-dream-2k8jkv Configuration
Ground reflections and video textures Configuration
arc-x-pmndrs-colors Configuration

@vis-prime vis-prime marked this pull request as ready for review July 22, 2023 16:40
@vis-prime vis-prime changed the title fix: MeshTransmissionMateial prevent setting values on discard mat when backside is off fix: MeshTransmissionMaterial prevent setting values on discard mat when backside is off Jul 22, 2023
@drcmda drcmda merged commit eafb103 into pmndrs:master Jul 26, 2023
@github-actions
Copy link

🎉 This PR is included in version 9.80.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vis-prime vis-prime deleted the mtm-typo-fix branch July 28, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants