MeetKai / superconductor

a work-in-progress 3D renderer built on top of wgpu
Other
17 stars 3 forks source link

Needed features to use superconductor as drop in for bevy_pbr #10

Open dekuraan opened 1 year ago

dekuraan commented 1 year ago

Essential:

Very Useful:

Nice to have:

dekuraan commented 1 year ago

I believe your asset system is the way it is for a reason, so if the current asset system is better than bevy_asset I think there is no need to use bevy_asset

expenses commented 1 year ago

So tbh I'm not 100% convinced on the value of being a drop-in replacement, as I think that bevy_render has made some compromises that we'd benefit from avoiding. That said, it'd be great to get rid of as many unnecessary differences in the APIs as possible.

  • Use bevy Transforms

Bevy transforms allow for non-uniform (where each axis can have a different scale) scaling: https://docs.rs/bevy/latest/bevy/prelude/struct.Transform.html#structfield.scale.

Superconductor instances (we could just rename these transforms) do not: https://github.com/MeetKai/superconductor/blob/c37edf515d1f79007602c589c28fb8f4b354aa36/renderer-core/src/instance.rs#L20-L24

The justification here is that non-uniform scaling creates all sorts of problems for proper shading of models, and isn't frequently used to be worth supporting. I'm happy to change my mind on this if a case where we want to do a lot of non-uniform scaling though.

We can have a system that copies bevy Transforms to superconductor instances, with the uniform scale just being scale.x.max(scale.y).max(scale.z), but I'd advise against it.

It looks like this link has been messed up with bevy 0.8. I'm sure we could integrate bevy's camera system into the code though.

  • Use bevy_render's RenderGraph so we can easily add render plugins (see bevy_pbr impl)

Looks possible, haven't looked into it yet. I think the most important question is whether we need to do anything fancy to let both superconductor and any render plugins use the wgpu device.

  • compatibility with bevy_render/bevy_pbr's primitives

Which primitives would these be? https://docs.rs/bevy/latest/bevy/render/primitives/index.html?

  • compatibility with bevy_asset's assets

The reason why I didn't do this before is that A) I already had an asset system I could use from https://github.com/expenses/mateversum and B) the asset server in bevy::asset looked a little over complicated for our needs. I also think it's beneficial for us to be able to control the assets and how they're loaded. Happy to look into this more.