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

CameraControls break on-demand rendering (by invalidating every frame) #471

Open
5 tasks done
lnvglr opened this issue Aug 21, 2024 · 3 comments
Open
5 tasks done
Assignees
Labels
bug Something isn't working p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@lnvglr
Copy link

lnvglr commented Aug 21, 2024

Describe the bug

I am setting the render-mode on my TresCanvas to on-demand. I am using the CameraControls for controlling orbiting. I expect the @render emitter to fire only briefly when mounting the scene. But instead, it fires on every frame.

<TresCanvas
  preset="realistic"
  render-mode="on-demand"
  @render="console.log('rendering ...')"
>
  <TresPerspectiveCamera />
  <CameraControls v-bind="controlsState" make-default />

  <!-- rest of the scene -->
</TresCanvas>

Commenting out the rest of the scene does not change the behavior, when commenting out <CameraControls />, on-demand returns to working as expected.

FYI: It does not happen with <OrbitControls /> component.

Reproduction

https://stackblitz.com/edit/tresjs-minimal-reproduction-gj1p2u?file=src%2FApp.vue

Steps to reproduce

  1. Open console and verify that the @render emitter is firing the console.log
  2. Comment out <CameraControls v-bind="controlsState" make-default /> and check the console to verify that logging stops after a few render loops

System Info

No response

Used Package Manager

npm

Code of Conduct

Copy link

stackblitz bot commented Aug 21, 2024

@lnvglr
Copy link
Author

lnvglr commented Aug 28, 2024

I have found the location where the invalidate() is called (seemingly incorrectly):

Commenting it out does not break the CameraControls, but it fixes the on-demand rendering! So I'll work with a local copy of the component. I'll be happy to make a PR if need be.

Do you think the invalidate() needs to be called there and if so, why?

@JaimeTorrealba
Copy link
Member

Hi man, can you check this one when you have time @alvarosabu

@JaimeTorrealba JaimeTorrealba added bug Something isn't working help wanted Extra attention is needed labels Sep 12, 2024
@alvarosabu alvarosabu added p3-minor-bug An edge case that only affects very specific usage (priority) and removed help wanted Extra attention is needed labels Oct 17, 2024
@alvarosabu alvarosabu self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
Status: No status
Development

No branches or pull requests

3 participants