-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
712f105
commit 47d85ec
Showing
4 changed files
with
379 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Bevy Vaporwave</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Roboto+Mono&display=swap" | ||
rel="stylesheet"> | ||
</head> | ||
|
||
<body class="color-scheme-home"> | ||
|
||
<div class="grid"> | ||
<div class="main-column"> | ||
<!-- <a href="https://alexharding.ooo" class="back-arrow">alexharding.ooo</a> <a href="https://bsky.app/profile/alexharding.bsky.social" class="back-arrow">bluesky</a> --> | ||
<span class="nav-links"> | ||
<a href="https://alexharding.ooo" class="nice-links">alexharding.ooo</a> | ||
| ||
<a href="https://bsky.app/profile/alexharding.bsky.social" class="nice-links">bluesky</a> | ||
</span> | ||
<h1 class="main-heading">Bevy Vaporwave</h1> | ||
<div id="wasm-container"></div> | ||
<br> | ||
<h2><a href="https://github.com/arcadeperfect/bevy_vaporwave">Github</a></h2> | ||
<br> | ||
<p>Side project to learn the basics of wgsl and develop a look for my <a href="https://alexharding.ooo/posts/Rustroneer/">main Bevy project</a>.</p> | ||
<br> | ||
<p>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.</p> | ||
<br> | ||
<p>Features:</p> | ||
<ul> | ||
<li>Arbitrarily define edges to render, not render every triangle </li> | ||
<li>Varying colors per mesh, no textures</li> | ||
<li>Optionally "Solid" wireframe, ie it occludes its own back faces and objects behind it</li> | ||
<li>Outline for silhouette when visible edges are sparse</li> | ||
<li>Support gltf animation</li> | ||
</ul> | ||
<br> | ||
<p>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.</p> | ||
<br> | ||
<p>Issues:</p> | ||
<ul> | ||
<li>Wireframe thickness cannot be set because this is not supported by wgpu line primitives</li> | ||
<li>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</li> | ||
<li>Assets are post processed in a system triggered by SceneInstanceReady events. Something that ties into Bevy's async asset loading would be much better </li> | ||
<li>The mesh building algorithm is very slow with large meshes</li> | ||
</ul> | ||
<br> | ||
<h2>Blender Workflow</h2> | ||
<div class="video-wrapper"> | ||
<iframe | ||
src="https://www.youtube.com/embed/rfDhslnPBpA?si=I2cgElg45rW-49li&autoplay=1&mute=1" | ||
title="YouTube video player" | ||
frameborder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
referrerpolicy="strict-origin-when-cross-origin" | ||
allowfullscreen | ||
></iframe> | ||
</div> | ||
<br> | ||
<br> | ||
<span class="nav-links"> | ||
<a href="https://alexharding.ooo" class="nice-links">alexharding.ooo</a> | ||
| ||
<a href="https://bsky.app/profile/alexharding.bsky.social" class="nice-links">bluesky</a> | ||
</span> | ||
<br> | ||
<br> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<script type="module"> | ||
import init from './out/bevy_vaporwave.js'; | ||
|
||
async function run() { | ||
const wasmContainer = document.getElementById('wasm-container'); | ||
|
||
const observer = new MutationObserver((mutations) => { | ||
for (let mutation of mutations) { | ||
for (let node of mutation.addedNodes) { | ||
if (node.tagName === 'CANVAS') { | ||
node.style.width = '100%'; | ||
node.style.height = '100%'; | ||
wasmContainer.appendChild(node); | ||
observer.disconnect(); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
observer.observe(document.body, { childList: true }); | ||
|
||
await init(); | ||
} | ||
|
||
run(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.