Replies: 4 comments 5 replies
-
I'm personally more used to the camera driven approach, but that might just be my prior Unity experience biasing it. I'm not too fond of the idea of using the hierarchy to limit visibility beyond global visibility inheritance. IMO it's not all that intuitive. Imagine adding a first person-camera to the root of a player character, and suddenly the character's body is now only visible to that player? It also encourages "foldering" hierarchies which has runtime costs in other ways (i.e. transform propagation). Post-processing is the part that I definitely think we should be able to have finer control over how it applies. However, this can be exposed as a thin config component in the app world and a more complete extracted state. |
Beta Was this translation helpful? Give feedback.
-
Heres an illustration of what these approaches might look like for common use cases: // RenderTarget-driven render-to-texture without UI
let render_target = commands
.spawn_bundle(RenderTargetBundle {
target: Target::Image(my_image_handle),
ui_config: UiConfig::disabled(),
..default()
})
.id();
commands.spawn_bundle(Camera3dBundle {
render_target: Some(render_target),
transform: Transform::from_xyz(1.0, 2.0, 3.0),
..default()
});
// Camera-driven render-to-texture without UI
commands.spawn_bundle(CameraBundle {
target: Target::Image(my_image_handle),
transform: Transform::from_xyz(1.0, 2.0, 3.0),
ui_config: UiConfig::disabled(),
..default()
}); Note that these would default to the "default render graph" because one wasn't manually specified in the bundles. |
Beta Was this translation helpful? Give feedback.
-
FWIW, I personally like the "RenderTarget as driver" approach, although I'm fine with both, I guess. But I do agree with Also: how would this approach look like if the render graph produces something other than an image? |
Beta Was this translation helpful? Give feedback.
-
I feel like the RenderTarget driver approach is cleaner but either way is probably fine. What I'm not clear on is why, in the RenderTarget driver approach, does the render target need to be a separate entity? Couldn't you have a camera component and a render target component on the same entity? If that's the case then it seems similar in usability to the camera approach. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've recently been pushing for "RenderTarget entities as Render Graph drivers" over "Cameras as RenderGraph drivers", as I think RenderTarget entities map best to the primitives and patterns we've built. But I've given it more thought and I'm not so sure anymore.
I'm curious to hear what others think about these options.
Note that I don't want to discuss "camera/render target relative ordering" here because that feels tangential to the core problem. Assume that we will adopt a good way to order "drivers" relative to each other (ex: a simple way would be to give each driver an integer weight, sort the drivers by weight, and then run in that order).
RenderTarget Entities as Render Graph Drivers
Cameras as Render Graph Drivers
visible_hierarchy: Option<Entity>
field to the camera).Conclusion
This isn't clear cut. I think RenderTarget entities are a more flexible abstraction that better maps to whats happening under the hood (and the typed camera patterns we use today). But letting Cameras drive rendering makes some of the common cases easier + more intuitive. In short: im torn. I'm curious to hear what everyone else thinks.
Beta Was this translation helpful? Give feedback.
All reactions