bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
33.79k stars 3.3k forks source link

Tracking Issue: Primitive Shapes #10572

Open Jondolf opened 7 months ago

Jondolf commented 7 months ago

This issue tracks progress on primitive shapes, which were first added in #10466 based on the primitive-shapes RFC.

Meshing #10569

Primitives should support Mesh construction.

Gizmos #10571

Gizmos should support drawing primitives.

Bounding volumes #10570

Bevy should have first-party bounding volumes and support computing them for primitives.

List of primitives

Remove bounding volumes from bevy_render

Misc

Long-term possibilities

rparrett commented 4 months ago

Is this tracking issue still being utilized?

Can we add any of

Note that some shapes have behavior that can't be exactly reproduced with the new primitives yet:

  • Box is more of an AABB with min/max extents
  • Plane supports a subdivision count
  • Quad has a flipped property (also tracked in #11996)

From #11773 to the list, if still applicable? Plane subdivision, specifically was a hot topic in Discord recently.

Jondolf commented 4 months ago

I added the plane subdivision count to the list. The other two aren't as applicable in my opinion; we have AABB types and don't need a Box with min/max extents, and the rectangle flipping is perhaps more of a documentation issue than a separate property that we'd need for the mesh.

bugsweeper commented 3 months ago
  • Support subdivision for the Plane3d mesh

I think subdivision param for Meshable trait (maybe optional, or maybe in different MeshableExt trait) would be rich feature. It nice to provide not only for Plane3d

lynn-lumen commented 2 months ago

I don't understand what is meant by

  • [ ] Prism

Considering there already is

  • [ ] support converting 2D shapes to 3D shapes (i.e. extrude circle to get cylinder and so on)

which would basically produce a bunch of prisms. In addition, Ramps already cover (at least some) triangular prisms

bugsweeper commented 3 weeks ago
  • Support subdivisions

Looks like #13719 and #13580 both relates to subdivisions

bytemunch commented 1 week ago

I've got a naive ellipsoid implementation working but it produces meshes identical to a scaled UV sphere, as it uses the sphere UV code with sectors and stacks, substituting variables for a, b, and c where relevant. Is this desirable behaviour or should we strive for a better ellipsoid meshing function?

https://github.com/bevyengine/bevy/assets/43527203/2f3982a4-a974-4b16-bd98-c6957aa36fac

Scaled spheres in the back, ellipsoids in the front

Also the area calculation uses the approximate formula which could be a problem, the maths for integrating everything and getting a closer answer is too much for my brain :exploding_head: