Bevy Vaporwave
You may have to refresh to get the fill to work ¯\_(ツ)_/¯
Github
Side project to learn the basics of wgsl and develop a look for my main Bevy project.
The code is pretty garbage. I doubt I will continue work on this, but I will roll what I learned into the main project and hopefully it will be better that time. If you're intetested though the repo is public.
Features:
- Arbitrarily define edges to render, not render every triangle
- Varying colors per mesh, no textures
- Optionally "Solid" wireframe, ie it occludes its own back faces and objects behind it
- Outline for silhouette when visible edges are sparse
- Support gltf animation
I developed a simple workflow with Blender which allows you to mark edges for rendering, paint vertex colors and store the data in a custom gltf attribute (see video below). It isn't great but it does the job. The blender files and a python script are in the repo. Bevy then builds a mesh out of line primitives for the wireframe and uses the original mesh for a fill. The mesh is duplicated, dilated along normals and pushed backwards in clip space by a shader to create the outline.
Issues:
- Wireframe thickness cannot be set because this is not supported by wgpu line primitives
- Clip space method for outline isn't ideal, a stencil buffer approach would be better but I couldn't work out how to do that with wgpu / bevy render pipeline
- Assets are post processed in a system triggered by SceneInstanceReady events. Something that ties into Bevy's async asset loading would be much better
- The mesh building algorithm is very slow with large meshes