-
This is probably a far more complex question than it seems and may not be feasible. I've been digging through the source trying to find how a Mesh (probably generically as a RenderAsset::PreparedAsset) gets sent to the underlying wgpu device for rendering but have been struggling. I've seen the render_to_texture example, which is great for many things, but it involves creating a camera to look at a specific position and rendering what is at that position. To get a clean render of just the one Mesh, would need to move it far away, ensure it is not overlapping with anything else after that move, wait a frame for it to render to the texture. I am wondering if in the case of just a single Mesh, is there a better approach? Thanks for taking the time to read this! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I don't understand your question. I think in all this rambling, you forgot to ask precisely what you were looking for :) Anyway 1 - How to render something with one camera but not anotherUse the 2 - How does bevy rendering worksVast question! I'm going to do a very high level bird's eye view here, otherwise I'll have to write an entire book.
bevy/crates/bevy_pbr/src/render/mesh.rs Lines 1251 to 1269 in 9478432
bevy/crates/bevy_pbr/src/material.rs Lines 342 to 348 in 9478432
bevy/crates/bevy_pbr/src/material.rs Lines 194 to 199 in 9478432
bevy/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs Lines 68 to 102 in 9478432
bevy/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs Lines 110 to 111 in 9478432
bevy/crates/bevy_render/src/render_phase/mod.rs Lines 77 to 91 in 9478432 I find myself in a maze of little twisty passages, and I'm utterly lost. I can't go forward on this. But I think this should close the loop, as bevy/crates/bevy_render/src/render_phase/draw.rs Lines 260 to 272 in 9478432 |
Beta Was this translation helpful? Give feedback.
I don't understand your question. I think in all this rambling, you forgot to ask precisely what you were looking for :)
Anyway
1 - How to render something with one camera but not another
Use the
RenderLayers
component. You can set your "render-to-texture" camera and what it is supposed to render to a singularRenderLayer
, separated from all the other entities layers. This way, you'll have a separate view of the object in question2 - How does bevy rendering works
Vast question! I'm going to do a very high level bird's eye view here, otherwise I'll have to write an entire book.
Asset
, and as you astutely already noted, they are passed to …