#Generating meshes programmatically

30 messages ยท Page 1 of 1 (latest)

plucky hornet
#

Here's a list of data to generate a hexagon:

uvs: [[-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5], [-2.598076, -1.5]]
normals: [[-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 1.0, -1.5], [-2.598076, 0.707, -0.793], [-1.9857962, 0.707, -1.1465], [-1.9857962, 0.707, -1.8535], [-2.598076, 0.707, -2.207], [-3.210356, 0.707, -1.8535], [-3.210356, 0.707, -1.1465], [-2.598076, 0.707, -0.793], [-2.598076, 0.0, -0.5], [-1.7320507, 0.0, -1.0], [-1.7320507, 0.0, -2.0], [-2.598076, 0.0, -2.5], [-3.4641016, 0.0, -2.0], [-3.4641016, 0.0, -1.0], [-2.598076, 0.0, -0.5]]
pts: [[-2.598076, 0.0, -1.5], [-2.598076, 0.0, -0.5], [-1.7320507, 0.0, -1.0], [-1.7320507, 0.0, -2.0], [-2.598076, 0.0, -2.5], [-3.4641016, 0.0, -2.0], [-3.4641016, 0.0, -1.0], [-2.598076, 0.0, -0.5], [-2.598076, 0.0, -0.5], [-1.7320507, 0.0, -1.0], [-1.7320507, 0.0, -2.0], [-2.598076, 0.0, -2.5], [-3.4641016, 0.0, -2.0], [-3.4641016, 0.0, -1.0], [-2.598076, 0.0, -0.5], [-2.598076, -1.5, -0.5], [-1.7320507, -1.5, -1.0], [-1.7320507, -1.5, -2.0], [-2.598076, -1.5, -2.5], [-3.4641016, -1.5, -2.0], [-3.4641016, -1.5, -1.0], [-2.598076, -1.5, -0.5]]
plucky hornet
#

Somehow I get this extra face

plush topaz
#

You're gonna have to share your code ๐Ÿ˜‹

#

What point is the offending one? I can't seem to tell just based on the number

#

Oh nvm, it doesn't seem to show up in the list, hmm

#

What do you mean by modify offsets? These should all be the same hexagon-cylinder mesh, no? You should be moving them with the Transform, so you can reuse the same mesh for all of them

plucky hornet
#

I want to make a tile from a multiple hexagons (with different offsets) and then use https://github.com/komadori/bevy_mod_outline for outlines. The idea is to have only outer borders of this combined mesh outlined. That can not be achieved by combining multiple pbr_meshes, as outlining affects rendering of a sing object.

plush topaz
#

Or maybe not

#

But why are you only adjusting the points from len-22 to len? Surely you want to shift all the points, no?

#

Looking through the code it sure looks like if you use hex then you don't have to manually adjust the positions?

plucky hornet
#

len-22 is total length in this case. There are 22 points per a dice.

plush topaz
#

Yeah, I realized this, eventually

#

Try only rendering the first triangle (i.e. truncating to a length of 3) and see if the problem remains

#

And then keep going up if it doesn't appear

#

Just to try and minimize the issue

plucky hornet
tame tulip
#

hi i am working on 3d hexagons as well. i am thinking about to clean up the source code and to publish it as a crate.
this is a region at the beginning of the alps:

plucky hornet
#

Looks great. I've solved the issue btw, by adding an extra point to a mesh

plush topaz
#

It's really strange that it didn't work before, but I'm glad it does now! Looks really cool too!

tame tulip
#

with "polyhex" do you mean combining all hexes into a single mesh ?
I did ran into the problem that performance was terrible when i instantiated every hex one by one.
So i made a meshbuilder that generates a large mesh (13 Million indeces for a small scene).
But performance is still not good: the mesh is static, but bevy seems to pass it every frame to the GPU ? ! (assumption, have not verified).
I would expect to set a mesh to "static".
Setting the mesh to "dirty" if it was changed would be a big plus.

Also CPU Instancing could help - AFAIK it would mean that every hex has the same height - would could be done by choosing another Art Style.

plucky hornet
#

Well assuming that hexagon is 8+6*2=20 triangles I doubt performance will be a problem. And playboard is 32x32 which is just 1280 triangles

plucky hornet
tame tulip
#

yeah it's a must have ๐Ÿ™‚ rust book suggests that 1 is enough, but i use opt-level = 3 as well. it compiles fast enough with dynamic linking.

tame tulip
#

and you can have never enough performance ๐Ÿ˜› if you target mobile more performance means less energy consumption - more player satisfaction ๐Ÿ˜‰

#

and better support of low end devices...

plush topaz
#

It should not be updating the mesh every frame, but that seems like a really large mesh, what is your scene? Can you split it up into chunks and only render some chunks, or can you get rid of invisible triangles from the mesh by building it more intelligently?

tame tulip
#

yes i am aware of chunking, but i don't do it yet. Also i can process the further away chunks with less level of detail (like creating 1 hex for a block of 9 hexes)

No, i am not updating the mesh, but i would like to find out if it is passed every frame to the GPU, and how i can prevent this. Or if it is a feature request...

plucky hornet
#

This might be out of scope of this thread. https://www.youtube.com/watch?v=y3TGsTwMVAA bevy_terrain implements lod to render all of Saxony

This video showcases the latest iteration of my terrain renderer written in Rust using the Bevy game engine.

Here I am rendering the entire 18,416 kmยฒ surface of Saxony at an resolution of up to a single meter.

Data Set: https://www.geodaten.sachsen.de/
Source: GeoSN, dl-de/by-2-0

Join my discord server: https://discord.gg/7mtZWEpA82
Check ou...

โ–ถ Play video