Skip to content

u/_AnonymousSloth

In this archive from Jul 2021 to Jun 2022

2
posts
9
comments
0
media
32
score
1 saved before deletion

Thanks for the reply! I am sad that you won't open source this but I understand you point and that is fair. I still had a few more questions:

  1. I am confused about how exactly you are deleting the edges to make the mesh. You stated:

Removing edges is relatively straightforward. However, we need to be careful to keep track of which edges we have already removed as to not accidentally remove an edge of a face that is already a quad. The rule for this is simple: when we remove an edge between to faces, we can’t remove any of the remaining six edges of the two now merged faces anymore. I solved this by keeping track of a list of edges that are still “available” and only removing edges listed there from the mesh. When I remove an edge from the mesh, I remove the now forbidden six edges from the list.

I don't understand what you mean by the remaining six edges. initially, the sphere will be made up of all triangle faces. Now if we remove an edge from 2 triangle faces, we will get a quad which will have 4 edges, not 6. Assuming you somehow only remove edges that are between 2 triangle faces only, you will end up with a mesh that is filled with triangles and quads. Or are you allowing removing edges between a quad/tri or quad/quad also - because that would give other shapes besides quads and triangles

Also, are you doing all this mesh generation and removing edges via code in Unity? Or do create the whole mesh, remove edges, subdivide it and relax it in blender and THEN import that in unity and do the marching square?

​

  1. How exactly is the relaxation done? You mentioned an article from andersource.dev who basically finds a square that minimizes the sum of the vertex distance from the quad vertices to their respective square vertices. But then you said you used a "restrictive" Laplacian smoothing (the Wikipedia page was short on this) and then augmented it by "adding forces". I understand you can't share the code, so could you point me to a resource that explains this well? All I come across are abstruse research papers with a lot of math jargon.

​

  1. The hover effect is still confusing. Here is what I have so far: you used marching squares to generate the effect. When the mouse is over a section of the sphere, I assume you do a raycast to find which point on the grid it is closest to.

Now normally, if you were creating a mesh there, you would look at the surrounding points and based on if they are "on" or "off" you generate the appropriate marching square arrangement and then transform it to match the quad (using the bilinear parametrization method you described) but for the hover effect, I assume you only treat the raycasted point as "on" and the surrounding points as "off" right? Then how do you actually get the hover effect? do you create a separate mesh dynamically that matches the faces of the overlaid faces and add that shader on top of it?

Also, I am curious how you achieve the shader effect as well (with the white border and the semi transparent white fill with a space between the fill and the border)

​

PS. How do you get the vertices on this type of mesh? If I am looking a vertex p and want to get all the adjacent vertex values to use for marching squares, how did you do that?

​

Lol sorry for being so nosy but this topic is really fascinating to me and as a beginner I trying understand and implement it so I can understand how it works

1 points

I loved this post! I was looking for a in-depth explanation for this for a while!

I have some beginner questions (I am just starting off in game dev)

- I have read about marching squares and cubes (and even saw sebastian lague's video and other tutorials), but could you explain a bit further how it works here for this irregular grid? The blog you mentioned didn't go into detail on this part

- This is unrelated to the algorithms used but how do you get the mouse hover effect (like oskar stalberg) for placing the tile (That white-ish selected/hover effect I mean)

- Third, I didn't see the source code for this in the blog. Is it open source? If not, I would really like to request that you made it open source so beginners like me can understand how you made it practically. Not only that, I have a thousand more questions like what kind of shaders you are using, etc

1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.