demofox,
@demofox@mastodon.gamedev.place avatar

Does anyone know of any code laying around the net that distributes points on a mesh in a blue noise distribution?
A student intern i work with is looking for this. It's tempting to write it, but im also kinda swamped :X

topher_batty,
@topher_batty@mastodon.acm.org avatar
aeva,
@aeva@mastodon.gamedev.place avatar

@demofox you once gave me advice once on this exact subject! alas, I have not implemented it because I never settled on a suitable meshing strat

demofox,
@demofox@mastodon.gamedev.place avatar

@aeva it turns out it's really hard. Sorry for not realizing.

aeva,
@aeva@mastodon.gamedev.place avatar
vethanis,
@vethanis@mastodon.gamedev.place avatar

@demofox a lot of renderers are already doing this.
render the mesh, sample blue noise texture, project passing samples to world space using depth buffer the usual way.

added step: use inverse model matrix to project to local space, throw result into a uav with interlocked add.

demofox,
@demofox@mastodon.gamedev.place avatar

@vethanis neat

mmby,
@mmby@mastodon.social avatar

@demofox I think the task may be harder than one thinks, since you cannot make continuous maps of any arbitrary 3d surface that are isometric

what do you do between the cuts? if you cannot work with a parameterization, you have to work locally on the surface

demofox,
@demofox@mastodon.gamedev.place avatar

@mmby working locally on the surface is what I'd do, yeah, agreed.
Islands would work themselves out

lritter,
@lritter@mastodon.gamedev.place avatar

@demofox sounds like if you can do it uniform randomly, blue noise is corollary

demofox,
@demofox@mastodon.gamedev.place avatar

@lritter well i can choose a triangle uniform randomly based on size, and can uniformly generate a point in a triangle.
That'd give you candidates for MBC.
But now you have to calculate distance between points :/

demofox,
@demofox@mastodon.gamedev.place avatar

@lritter so we can keep whichever white noise candidate is farthest away from whatever blue noise point it's closest to.
Then rinse / repeat :P

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox @lritter lloyd relaxation I guess

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin @lritter you still need distance between points on mesh for lloyd relaxation. im more a fan of MBC, but they both have the requirement of needing to be able to calculate distance between points on a mesh, which makes it a longer task hehe

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox @lritter Maybe distance can be done in 3d if you are going for high point density but still not easy. Maybe generate many points using white noise and then just remove close ones is easiest.

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin @lritter if dense enough, yeah, i bet you could just deal with points within a triangle and the immediate neighbors. I think this is all solvable but not ~1 hour of work haha. sigh...

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox @lritter nope! Lots of code! If you have tooling do uv-unwrap, spread points blue in uv space and profit? Like project them back. Not perfect but maybe doable.

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin @lritter yeah that'd work, and xatlas is good at that. But, unless you deal with triangle connectivity, the seams of triangles will be fubar

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox Only at the uv seams.

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin oh yeah, that's true. not good enough for me. sorry for posing an unsolvable problem. Was just hoping some code existed somewhere hehe. TinyOBJ + mitchell's best candidate.

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox geogram? No idea but it has stuff in it…

demofox,
@demofox@mastodon.gamedev.place avatar
breakin,
@breakin@mastodon.gamedev.place avatar

@demofox I came to think of it since Levy made the lscm uv unwrap that is in blender, but maybe geogram doesn’t do simple things like this :)

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin it looks really promising

mmby,
@mmby@mastodon.social avatar

@demofox @breakin the closest to isometric parameterization I know of is this one

https://www.mdpi.com/2227-7390/7/8/753

approximate geodesic distances over the entire mesh, then get the parameterization from an eigenvalue problem (only first two largest), it's close to isometric but not conformal

demofox,
@demofox@mastodon.gamedev.place avatar

@mmby @breakin eesh, i wish this problem was simpler hehe.
finding the distance between 2 points on a mesh doesn't SOUND that hard. but then you think of the details and urgh...

breakin,
@breakin@mastodon.gamedev.place avatar

@demofox @mmby I'm thinking that if you only need to figure out if a point should be removed, then you "only" need to find distance with all triangles that are inside a sphere. If you have connectivity making some shortest-path algorithm shouldn't be that hard. But yeah yuck.

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin @mmby the hardest problem i can see with the "shortest path between points on mesh" is: what is the straight line as you move between triangles that go concave, convex etc. am i overthinking that? it sounds hard.
The "which triangles should i take to go the shortest path" maze solving seems easier at least.

litherum,
@litherum@masto.ai avatar

@demofox @breakin @mmby

Oh I actually studied this problem a few years ago! There’s a paper about how to do it. https://www.cs.umd.edu/users/mount/Papers/mmp-sicomp-87.pdf

demofox,
@demofox@mastodon.gamedev.place avatar

@litherum @breakin @mmby thank you :)

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin it specifically mentions being able to make a voronoi diagram and using Lloyd relaxation to optimize the point sets, which is an algorithm for making blue noise point sets.
I think this is the winner.
Thanks a lot!
https://github.com/BrunoLevy/geogram/wiki/Delaunay2D

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin oh darn it. It's not on a mesh.

demofox,
@demofox@mastodon.gamedev.place avatar

@breakin @lritter basically like.. why didn't one of us already write this?! past selves were slacking

lritter,
@lritter@mastodon.gamedev.place avatar

@demofox @breakin i vaguely recall a keenan crane paper that deals with mesh surface distance

lritter,
@lritter@mastodon.gamedev.place avatar

@demofox i wonder how much tris are good proxies. like, the furthest point away should lie within the furthest triangle away?

demofox,
@demofox@mastodon.gamedev.place avatar

Mitchell's best candidate would work well here, and would give a sequence instead of a set (use the first N of M total points, for any N), but what makes it more than a 1 hour task is the mesh connectivity, and multiple paths through triangles to the same points that you need to calculate distance between.

BartWronski,
@BartWronski@mastodon.gamedev.place avatar

@demofox haven't tried in practice, so might be suboptimal, but I am pretty sure it would be "correct": I would probably do 3D Mitchel's best candidate on some conservative voxel grid around the mesh, then take only points closer to a surface than some epsilon and project them onto surface (can be done as gather, not scatter). But it depends if you want the blue noise with geodesic distance (surface connectivity) or 3D. For most meshes (convex or locally almost convex), should be ~similar.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • provamag3
  • everett
  • cisconetworking
  • Leos
  • normalnudes
  • cubers
  • modclub
  • ngwrru68w68
  • tacticalgear
  • megavids
  • anitta
  • tester
  • JUstTest
  • lostlight
  • All magazines