#Full rewrite of Minecraft's renderer in Rust, help wanted

40 messages ยท Page 1 of 1 (latest)

bleak berry
#

Though a little offtopic but I hope this still helps. Like if you care about improving the speed and performance of your terrain generator then I would suggest this video to you ๐Ÿ™‚ :

https://www.youtube.com/watch?v=qnGoGq7DWMc

I hope this helps ๐Ÿ™‚

This greedy mesher is blazingly fast. Written with Rust and Bevy, using clever bitwise operations we can generate chunk meshes, an average of 0.000195 per 32x32x32 mesh!!!
This mesher blows most culled meshers out of the water, and I want to teach you the "secrets" of how to implement this for own voxel engine.
There are 2 algorithms we'll explo...

โ–ถ Play video
quartz iron
#

you can implement a greedy mesher on textured voxels but it gets more complicated as you need to deal with texture mapping/wrapping

#

something like a voxel raytracer would be of more use i think

#

theres also the issue of non-standard block models such as anvils

#

also, transparency

bleak berry
# quartz iron this is a cool video and i might be able to implement some of the techniques but...

Yes but I think the code still has alot of optimization potential I feel like for example rethinking loops (like reducing inner loops as much as possible to make it like have non polynomial time complexity), rewriting some code to binary operations, etc. Also, hashmaps can be removed because why need the overhead of hashing when you don't have a really really serious use case for it. So yes if you think deep into it like you can really improve performance of your code. Also, I would suggest these talks as well though they are for c++ but they also apply to other programming languages I would suggest having a look into it too ๐Ÿ™‚ :

https://github.com/fenbf/AwesomePerfCpp

GitHub

A curated list of awesome C/C++ performance optimization resources: talks, articles, books, libraries, tools, sites, blogs. Inspired by awesome. - fenbf/AwesomePerfCpp

quartz iron
#

iirc i dont use hashmaps when meshing

#

when chunks are being meshed, indices are used to access the Block structs

#

(ignore the comment its super old)

#

did you read the code?

#

also we don't use nested for-loops, its just one for-loop, and the time complexity is constant afaik

bleak berry
quartz iron
#

they don't use hashing when you get by index

#

this is what's used

quartz iron
#

unless i am misunderstanding how indexmap works im not

#

this is how indexmap works internally, its what you described

bleak berry
quartz iron
#

it doesnt use hashing when meshing

#

it uses indices

bleak berry
quartz iron
#

am i speaking to an LLM

#

I literally just explained but i will do it one more time:

  1. When meshing we use get_index
  2. get_index internally fetches the Vec<T> from within the IndexMap using an integer-based index as a key
  3. it then uses the provided index in the vec to return your value
bleak berry
bleak berry
# quartz iron I literally just explained but i will do it one more time: 1. When meshing we u...

Ok I see, good. Then try to use indexmap, etc which fit right in the use case. Also, another suggestion would be to make sure to look for cpu cache hits/misses too because they do matter for performance. Specially doing random iterations they matter alot like because cpu uses prefeching technique which if you keep in mind and write code with it can really improve performance. ๐Ÿ™‚

gleaming socket
dim sapphire
quartz iron
dim sapphire
quartz iron
#

theres als oa discord server where you can ask questions

#

linked in the readme