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

Parts previously generated previews not consistently working #82

Closed
JBEmbedded opened this issue Dec 23, 2023 · 7 comments
Closed

Parts previously generated previews not consistently working #82

JBEmbedded opened this issue Dec 23, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@JBEmbedded
Copy link

My previous generations don't alway show the part in the preview box. See pic attached!
Screenshot 2023-12-23 at 11 30 28 AM

@alteous
Copy link

alteous commented Jan 2, 2024

Are the parts regenerated every time or cached? I'm wondering whether it has anything to do with the glTF extension changing, although the date is fairly recent.

@franknoirot
Copy link
Collaborator

I think it's more likely something sillier with my UI @alteous but I'll keep an eye out for that, appreciate it.

@franknoirot
Copy link
Collaborator

Gotten some headway here with quick fixes around using a common derived store for both generations from prompt submissions and those fetched via a GET request, but there's a larger issue looming around maintaining enough canvas contexts. If I scroll to the bottom of my feed and back up again now I start to see breaking previews:

Screenshot of text-to-cad-ui showing broken canvases at the top, with telltale errors in the console saying "Too many active WebGL contexts. Oldest context will be lost."

Too many active WebGL contexts. Oldest context will be lost.

Which led me to this THREE.js form discussion which points out that browsers really in principle only allow one WebGL context per page, although in practice depending on device and browser it could allow for a handful more.

I'm hoping that threlte has some config to help me clear the context for real between rendering different <Canvas /> components (which I do already based on scroll position), so that I can prevent this behavior, but in summary for my own notes there are a few interlocking issues:

  1. synchronizing the state of two lists of generations (submitted and fetched) is hard, and prone to being dropped from memory.
  2. creating and destroying canvases, and by extension WebGL contexts, is unreliable
  3. creating more than one canvas can be rejected depending on device and browser pair

After that rubber ducking, I'm going to try simply hoisting up the wrapper <Canvas /> component from threlte to the app level, and just have one across all views, and see if that helps things a lot. It feels like that might have been an unstated assumption in their docs.

@franknoirot
Copy link
Collaborator

franknoirot commented Jan 2, 2024

That approach didn't work, and led me down a little research run to this very recent threlte issue I've commented on here. TLDR: React's THREEjs library has a clever <View /> component that lets components share one canvas, and this threlte library needs to implement it, and I might have a go at it.

Update: oh cool I always forget that GH adds a little note if you mention an issue anywhere else regardless of where in GH.

@franknoirot
Copy link
Collaborator

Yeah this seems like a really promising example, and tunnel-rat seems not too crazy to port to a Svelte implementation (it's for React).

@franknoirot
Copy link
Collaborator

Alright I'm still going to help threlte get their <View /> component they've mostly built because I think that'll be valuable in the future, but we've decided this layout isn't necessary in this case, so I'm going to rework it to be more familiar to other chat AI tools and not need many canvasses on screen. I'll make an issue for that effort and reference this one.

@franknoirot
Copy link
Collaborator

Okay I believe this was resolved as a part of #92 but let me know if there are still any issues!

@franknoirot franknoirot added the bug Something isn't working label Jan 10, 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
Projects
None yet
Development

No branches or pull requests

4 participants