r/webgpu • • 3d ago

A procedural environment in WebGPU: compute-built grass and indirect draws with Rust

This is Wildlands, a test scene for Uverse, the engine I'm developing. The grass, flowers, trees and stones are procedural. The volumetric clouds move and change shape too.

It uses Rust + wgpu and WGSL shaders. Grass blades are rebuilt from seeds on the GPU each frame, while a tiled sky cache spreads the cloud rendering across frames. :)

(and it runs natively as well with Windows/macOS with DirectX 12 and Metal!)

Try the WebGPU demo or natively on your computer!

Check out at Uverse + join waitlist so then you can also try Uverse out! :) -> https://uverse.dev/#waitlist

151 Upvotes

21 comments sorted by

2

u/Zqin 3d ago

Very cool, I see "Scene Editor", "Game View", "Animation", "Materials", "Code Editor", "Collaboration", "Cinematics", "Visual Scripting", does all of that work yet?

1

u/UverseDev 3d ago

Everything except "Cinematics" and "Visual Scripting" yes! Visual Scripting I may drop it. Cinematic is functional but requires still so much more polishing!

Thank you so much! :)

1

u/HuttPilot 3d ago

Wow. How does it use rust, I thought webGPU was for the web?

3

u/UverseDev 3d ago

Rust can compile both, into native apps, and/or to WebAssembly which then runs in Browser natively and it has access to WebGPU too!

Native build compiles directly for the OS and render then through Metal, Vulkan or DirectX 12! The engine shares the same rendering code across both!

It's a custom-built game engine. We do not use Three.JS or Godot or something similar!

1

u/lazd 3d ago

The grass looks good, the foliage is full, the mountains in the background look amazing, and the sky is fantastic. But what's the performance gonna be like once you start adding game elements?

I did see pretty noticeable LOD cut ins and there's some Z fighting between the clouds and the mountains, but it's amazing overall and seems to run well!

1

u/UverseDev 2d ago

Hey lazd! Thank you so much! Yes, its not perfect yet and needs some fixing here! Thank you so much for the feedback!!

Yes, if we add more game elements, lets say, for example river or lake (working on it!) - it also means it clears up space where the grass or trees were supposed to be, which also frees up GPU for the river or lake.

But for more internal game mechanism or logics, then in this case I will start using CPU which is almost empty here. And if I end up needing more GPU, obviously then I have to optimize it even further.

But this is all configureable in Uverse Game Editor, and you can have this environment in your own game as well in very near future! :)

1

u/LobsterBuffetAllDay 3d ago

Dude not bad at all. I love the care you put into the grass, and tree foliage. It looks good. I raise you something I've been working on-
https://alpine.play.colossum.io/

Try the horvale course, it's got the sort of open world env that I'm eventually gearing up for. Besides looking great, I really do care about the performance across not just desktop / laptop but mobile and tablet too; have you tested your demo on those platforms? What's the fps like?

2

u/UverseDev 2d ago

Thank you so much! :)

I've also tried your Alpine game, it's an very impressive demo and I am loving it! :) Especialyl with the snows particles coming out thats neat!

Well, I did heavily optimized it in this Wildlands project, however, when the FPS has improved a lot, I kept adding more nature elements to get dense as possible. So I am certain its not optimized for tablet or mobile yet. But it's in the plan, after all, Uverse is a Game Engine which already runs games on mobile and tablets too, except for this wildlands project, of coruse hehe :)

1

u/LobsterBuffetAllDay 2d ago

Aw thanks man!

Nice, I like where your head is at. My game also runs on a custom built rust webgpu / webgl game engine, I'd imagine we use some similar crates. Currently I can compile for Linux, Windows, Mac, and the browser... I haven't done mobile native, but the wasm browser builds seem to run just fine on my iphone 15.

Are you a part of larger group or is this engine a solo effort of yours?

1

u/UverseDev 2d ago

I assume you're wgpu here as well, right? :) Phone works well, depending on how light the game is obviously lol.

Yes, it's just solo effort for now! ^^

1

u/LobsterBuffetAllDay 2d ago

Yes sir.

Phones draw a little differently than macbooks though, so how light the game is also needs to be defined in a way that makes sense - for example, I noticed early on during testing that I can chose to have faster rendering, but also consume more wattage on the phone which causes thermal heating, which eventually starts causing fps to drop. So I ended up favoring rendering techniques that weren't quite as fast but tend to keep the power consumption down. You would think that fast always means more optimized and therefore less power, but that's not actually always true.

Anyways I love the work you're doing. Looking forward to seeing what you do next.

1

u/UverseDev 2d ago

Yea, mobile mode does not necessary means "optimize just well to use full-power". There is a reason why we have a "low-power" mode flag for mobile ^^

Why dont you hop over to Discord to stay in touch in the future? :)

2

u/LobsterBuffetAllDay 21h ago

What discord? I'd love to stay in touch :D

2

u/UverseDev 19h ago

You can find it under https://uverse.dev! :)

1

u/WhatNoRobot 3d ago

Impressive. A lot of flicker when moving around

1

u/UverseDev 2d ago

Yes, its not perfect, it needs a lot of improvement! Mind to tell me which kind of flicker so then I can be sure its maybe flitters I already know or something new?

Thank you so much! :))

1

u/WhatNoRobot 2d ago

It was the browser demo. When moving much of the foilage would still be drawing. The view also seemed to be quite low in the grass

1

u/N7ShepardChronicles 2d ago

Looks fantastic! Excited to see how Uverse evolves! :)

1

u/UverseDev 1d ago

Thank you! As for myself, I am excited too to see how it evolves! :)

1

u/PanGalacticGargleFan 2d ago

What’s the advantage that Rust gives you here?

2

u/UverseDev 1d ago

Mainly one codebase for web and native: Rust compiles to WebAssembly/WebGPU in the browser, and compiles natively to DirectX 12/Metal, so the editor and the exported game run the exact same engine code. Plus C++ level speed without a garbage collector (so there is no GC hitches in WASM) and memory safety for all the multithreaded engine works. :)