Terrain Simulator
- 19 Devlogs
- 20 Total hours
3D terrain generator and renderer. Uses WebGPU for low level control and cross platform compatibility.
3D terrain generator and renderer. Uses WebGPU for low level control and cross platform compatibility.
final polishes, random seed on every load, small changes like that
MORE IMPORTANTLY setup a github action that auto builds for EVERY SINGLE PLATFORM, PUSHES TO CRATES.IO, AND DEPLOYS TO GITHUB PAGES
https://shuflduf.github.io/Terrain-Simulator/
lots and lots of little optimizations and QOL things
the project is basically done already.
heap allocated some stuff that really shouldnt be on the stack
made the textures actually tile each other instead of having harsh borders
vsync toggle
text rendering for overlay (using glyphon)
Q and E for camera controls
etc etc
cant upload video because sd crashes every time i try to
frustum culling! now chunks that you cant see arent rendered. i actually have no idea if its working or not because if the chunks are behind me then i cant see tham get culled anyways
procedural chunk loading so YOU CAN FLY FOREVER
SKYBOXXXXX
i have a massive physics test tmw and my diploma is in 5 days
ANYWAYS its cool because it draws over the water that draws over nothing, so when you go below the map you dont see the water plane since the skybox draws over it its so cool
ANIMATED WATERR!!!
WATER!!!!!!!!!!!!!!!!! IM PROCRASTINATING SCHOOL SO HARD RIGHT NOW!!!!!!!!! BUT IT LOOOKS SOOOO GOOOOOOD!!!!!!!!!!
FINALLY
different textures depending on height
right now theres 4, going from sand, grass, stone (mountain) to snow. and they all have their various blend thesrholds and widths and its so sigma
next step is adding like water or smth
improve terrain generation, minor refactors, etc etc
This is a video of me flying around the terrain while Chris Christodoulou’s “…con lentitud poderosa” from Risk of Rain 2 plays in it’s entirety.
depth buffer was so light
15 minutes like holy
the docs are just that good and wgpu is just that good
code is becoming a mess tho might refactor that soon (again)
it doesnt look very impressive but like the hills IN THE FRONT are IN FRONT of the hills IN THE BACK
lfkdslfsd vsync
without vsync my laptop just renders so many frames and cpu usage spikes to 10% on idle like wtf
with vsync it goes to a much more reasonable 2%
also grass texture
next step is to add a depth buffer because as you can see some chunks are clipping in front of chunks that are in front of them
big refactoring
made it so the assets (textures and shaders) are basically created (not really) at compile time, so i can reference them using just their name (ex: “frog”) instead of the relative path from the file its being referenced in (ex: “../../assets/images/frog.png”) AND it lets me make sure the file exists at compile time
AND it makes sure the final binary is completely standalone (i think)
implementing terrain now! the code is good now i think
camera system was lowk ass so i fixed it
planning to add Q and E to move up and down relative to camera
so so so much refactoring
i still don’t think its organized enough
but i got the camera to work so thats cool
Mostly just refactoring.
I still have almost no idea how wgpu works, but at least everything is organized!
One of the benefits of Factorio is knowing when something should be it’s own module that other parts of the program can interact with.
Instead of having a massive main.rs, i split it up into like 4 different modules, the biggest ones being GpuContext, which handles setting up the wgpu backend stuff, Renderer, which renders stuff through wgpu, and Application, which handles the window management stuff.
Shapes and stuff! I’m actually making draw calls with like shader info or smth. Buffers are weird I still don’t get them. I got the famous triangle thing and textures both working (not at the same time).
The code is a mess that I no longer understand, and the docs I’ve been relying so much on are outdated for the latest version of wgpu, so that was painful (thank goodness for rust-analyzer).
Next steps are to organize the codebase so that I don’t have a massive 433 line main.rs and to properly understand uniforms and buffers and layouts and primitives and bind groups and views and queues and attachments and
Continuing to follow the docs
I’m now sending render passes to the window, which basically draws to the screen. Right now it just clears the screen with a certain color.
Next step would be shaders I think, so I can get a triangle soon
First time using wgpu so I followed the docs to get started with it. So far I have a single window through winit, which should work cross platform on native. Might add web support later.
Next step is getting something on the screen.