MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.43k stars 312 forks source link

Animations in RPRMakie #2648

Open asinghvi17 opened 1 year ago

asinghvi17 commented 1 year ago

I just went through the source code of RPRMakie, and it looks like it doesn't support Observables updating implicitly - you have to re-render each time you want to change anything about your plot in many cases (e.g. changing the color or z of a surface).

It looks like hooking up updates would be as simple as deleting the old material/shape and setting a new one. Is that the case or am I horribly off base here?

Also, it looks like there's no implementation for plot deletion - would that be a definition of Base.delete!(screen::RPRMakie.Screen, scene, plot)? If so, does it make sense to store a Dict of plot => (observables, rpr_objects) in the Screen, or perhaps as attributes in the plot itself, so we have access to them when deleting?

This ties in to my earlier question about defining finalizers for plots.

lazarusA commented 1 year ago

It looks like hooking up updates would be as simple as deleting the old material/shape and setting a new one. Is that the case or am I horribly off base here?

Once you change something in your scene, you need to re-render. A priory I think you would not know in advance the output from performing ray tracing.

What would be interesting to have is the option to change as many things as you want and then when ready be able to say please do the rendering now 😄 .

asinghvi17 commented 1 year ago

Ahh, sorry, bad choice of words - I should have said re-create the Scene, basically what seems to happen now is that a new context has created and everything must be totally re-rendered from scratch if you want to change a surface or mesh dynamically. I was wondering if we could e.g. dynamically delete and re-add surfaces when they change, such that the rest of the scene can remain as it is.

the option to change as many things as you want and then when ready be able to say please do the rendering now

Isn't that what currently happens? The rendering only happens when a colorbuffer is called if I understand correctly?

ffreyer commented 3 months ago

Doesn't any visually reflected change require a full rerender because the rays will take different paths?

asinghvi17 commented 3 months ago

My wording was bad - by re-render I mean totally recomputing e.g the BVH of the scene as well as translating meshes etc from Julia to RPR. Maybe recreating is a better term.