Comments (7)
+1 on this!
Have the control over how / when to render and render-priority is deffo something REALLY useful, with r3f you can can do
useFrame(() => {}, proprity)
that is super helpful, you can use the priority = 0 to override the internal render loop, you can use negative values and positives too. This is very helpful when you want some stuff happens after others :)
EDIT:
My two cents is that is something REALLY important when you start to get your hands dirty with advanced techniques, like using render targets, render different layers at different order, use a custom pipeline, stuff that at sooner or later you'll need :)
from tres.
+1
I also like R3F's approach. It's simple and flexible and lets users roll their own loop order.
Related
Obstacles
It seems to me that what's holding the current codebase back is the simple, practical current implementation of useRenderLoop
. It has lots of good parts, but some downsides.
useRenderLoop
is global, so something like this works:
<script>
import { useRenderLoop } from '@tresjs/core'
// NOTE: TresCanvas hasn't been created yet, but you can already ...
useRenderLoop().onLoop(() => {...})
</script>
<template>
<TresCanvas>
</TresCanvas>
</template>
Users seem to like that. Me too.
But the current implementation isn't linked to any particular <TresCanvas />
, which has implications for update/render loops:
It'd be really handy if we could both:
- tie
useRenderLoop
to a particular<TresCanvas />
- continue to
useRenderLoop
in<script>
, before<template><TresCanvas /></template>
, without having to e.g., useref
s and wait foronMounted
So ... 👇
Feedback please
Here's a proposal for creating an unbound context in <script>
, before <TresCanvas />
.
Feedback on this proposal is very appreciated.
Other proposals are also welcome.
Status
However, for me anyway, big changes like in the discussion I linked to are on hold until after v4
is rolled out, unless @alvarosabu and the rest of the team decides otherwise.
from tres.
Implemented with the new useLoop
composable available on v4 https://docs.tresjs.org/api/composables.html#useloop
from tres.
@verekia I think we should rephrase this ticket to Allow overriding the renderLoop fn
since the render-mode
functionality you describe is "Conditional Rendering" which is going to be available on #541 only stops the renderLoop from rendering but doesn't overwrite it or allow the end user to add its own render loop which correct me if I'm wrong that was the usecase you were mentioning right?
from tres.
@alvarosabu It seems like the upcoming manual
mode + invalidate
method is exactly what I am after, yes :) I didn't realize conditional rendering included that mode. With this mode, people who need more control over their game loop will be able to advance rendering exactly when they want it without relying on Tres' render loop.
This ticket was not about making an equivalent of R3F's renderPriority,
although it's a nice feature to have for people who don't want to roll out their own game loop but still want to organize some logic around Tres' loop.
Feel free to rename the ticket as you please or make a new one about allow overriding the renderLoop
fn :)
from tres.
Hey there!
As @andretchen0 perfectly explained, we need to work on having the render loop tied to the specific canvas and not global, which would be a significant change that would open a world of possibilities to users.
This together with Andre's proposal of unbound context and plugins is on top of my list for next 4.x
releases. I'm worried that the render loop one will create another breaking change that would postpone it to a future 5.x
.
@andretchen0 do you think we could do it without a breaking change or it would be better to delay the release and add this to v4?
from tres.
Hey @alvarosabu
@andretchen0 do you think we could do it without a breaking change or it would be better to delay the release and add this to v4?
I responded over here.
from tres.
Related Issues (20)
- `Event` is not triggered in `TresGroup` HOT 2
- Impossible to `inject` variable in canvas child component HOT 4
- intersect only objects with events registered HOT 3
- No more outlines since V4 HOT 8
- TresInstancedMesh breaks with a dynamic instance count HOT 14
- Nested component not rendering HOT 2
- Deltatime Documentation Inaccuracy
- Rigged models are squished and broken HOT 3
- How to use vue-cli HOT 3
- Mesh that are delayed Join in the scene cannot trigger events HOT 4
- Sprite - Raycast events not firing if inside group HOT 5
- `TresPerspectiveCamera` `lookAt` not working with `CameraControls` HOT 3
- Recipe using `tweakpane`
- Events not registering on dynamically added objects HOT 2
- Library override the DPR setting in autonomy without chances to clamp / control it
- Component: The setting parameter disableRender of TresCanvas is ineffective when renderMode is set to always. HOT 2
- Docs/playgrounds: change `ref(TresObject)` to `shallowRef(TresObject)` HOT 1
- When there is an annotated tag, the children of the scene will generate _Object3D model information HOT 1
- [Vue warn]: onUnmounted ... after upgrading to `4.2.0` - cached model fails to reload
- Vscode intellisense autocompletion not getting Tres components props
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tres.