Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
123 stars 2 forks source link

Add SelectiveRender/ExcludeRender to CameraPortal #848

Open lxw404 opened 7 months ago

lxw404 commented 7 months ago

Is your feature request related to a problem? Please describe.

Sometimes it is useful to be able to have a portal/mirror only render a specific scene or set of items, but currently there is no way of doing this.

Describe the solution you'd like

To achieve feature parity with the Camera component, the CameraPortal should have SelectiveRender and ExcludeRender lists to allow for inclusion/exclusion of slots in the same way.

Describe alternatives you've considered

None exist.

Additional Context

No response

shiftyscales commented 7 months ago

I found a previous response regarding this request:

This would be better handled by using layers, rather than selective renderers/exclusion lists.

Using the exclusion lists enables some problematic behaviors, and could potentially block additional optimizations down the line.

Selective rendering would be very inefficient because it would need to iterate through the entire hierarchy of the world every single frame to mark each slot as active/inactive, and would actually hurt performance significantly by utilizing a lot of CPU time.

Once layer support is integrated at some point in the future, this will not be an issue as this could be made in an efficient way.

So- this would require layers to be implemented/exposed first into the engine.

JackTheFoxOtter commented 2 weeks ago

I would like to see a way to only render a specific layer / hierarchy added to the CameraPortal component as well. This would allow some pretty cool visual effects, but also certain optimizations for mirrors / portals in worlds that currently aren't possible to achieve.

Frooxius commented 2 weeks ago

Currently Resonite does not support render layers in any way, which means we can't expose anything like that.

The hierarchy is a bit more complicated - this might not actually necessarily be as efficient, because what happens with Cameras is that the whole hierarchy is walked and it's marked for rendering. This can be potentially expensive to do.

However with CameraPortals it becomes a fair bit more complicated, because of how they render. With Cameras, it's relatively simple - before they start rendering, we mark stuff, render things and then unmark stuff again.

With CameraPortals, they do not render on their own - they are invoked when they are seen by a camera - meaning they will render in middle of another camera rendering - which could also potentially be another CameraPortal that sees this one, which adds some complications to the whole process - and also makes it hard to actually change certain things.

Because of that I'm a bit hesitant to add this with the current state.

JackTheFoxOtter commented 2 weeks ago

If you say this is something that would be best solved once we have render layers, that's fine by me, I personal would prefer waiting for a more refined / optimized solution in the future rather than hacking it into the current pipeline. But I would like to see this ability added at some point in the future regardless of technical implementation, as it would unlock some cool things that weren't possible before.

This came up when we were discussing ideas to improve the viewing experience for the rework of the edu-science meeting room. I mentioned it would be cool for viewers to have a little personal 3D camera portal drone that only rendered the stage and its contents / presentors. But I think it would also be cool for social worlds if you have a mirror that only shows the avatars of the people standing in front of it.