Can this find neighboring voronoi cells? I have before used floodfill to just add a cell if it is neighboring but that I don't believe is all that efficient, you may have a better way of doing it
Hello. First note, that this asset uses shaders to fill up empty areas of surface. So you need to decode values from surfaces to use them in GML.
The main focus in this asset is to create coordinate mapping, so we have surface which tells coordinates to the closest seed values.
This mapping can be used for several things, like doing approximate Voronoi diagram by filling empty areas with closest seed. You can transform coordinates to different fields, like distance or normal fields.
Now from off the hat, I can't say could you do this efficiently; but you would want to transform this mapping to tell coordinates about second closest seed. I have idea how you could do that (edit. nope didn't work, I'll rethink)
As the elephant in the room, this asset is most useful for visual things, because all important information are stored in surfaces. To access them in GML, you need to decode them to e.g. buffer.
That can be huge hassle, but also can cause lot of overhead; if you need to constantly flood and then decode to buffer. In that case, I wouldn't recommend using this asset, even if finding second closest seed would be feasible.
Now if seed is rarely updated, then it can be useful (because then you don't need to re-flood and decode it constantly). Here is example of use with my jam-game.
The ground, glow and border use 64x64 distance-field. Distances can be interpolated nicely, so ground is smooth instead blocky. Also distances are decoded into buffer, which games uses as collisions.
In that game, distance-field is created with this asset by using 256x256 seed surface, which is only done at the start of level. Making level was done by just drawing random shapes to seed, then: flood, transform & decode. This allows destructible environment too, as I could have just erase area in seed, and do steps again.
← Return to asset
Comments
Log in with itch.io to leave a comment.
Can this find neighboring voronoi cells? I have before used floodfill to just add a cell if it is neighboring but that I don't believe is all that efficient, you may have a better way of doing it
Hello. First note, that this asset uses shaders to fill up empty areas of surface. So you need to decode values from surfaces to use them in GML.
The main focus in this asset is to create coordinate mapping, so we have surface which tells coordinates to the closest seed values.
This mapping can be used for several things, like doing approximate Voronoi diagram by filling empty areas with closest seed. You can transform coordinates to different fields, like distance or normal fields.
Now from off the hat, I can't say could you do this efficiently; but you would want to transform this mapping to tell coordinates about second closest seed. I have idea how you could do that (edit. nope didn't work, I'll rethink)
As the elephant in the room, this asset is most useful for visual things, because all important information are stored in surfaces. To access them in GML, you need to decode them to e.g. buffer.
That can be huge hassle, but also can cause lot of overhead; if you need to constantly flood and then decode to buffer. In that case, I wouldn't recommend using this asset, even if finding second closest seed would be feasible.
Now if seed is rarely updated, then it can be useful (because then you don't need to re-flood and decode it constantly). Here is example of use with my jam-game.
The ground, glow and border use 64x64 distance-field. Distances can be interpolated nicely, so ground is smooth instead blocky. Also distances are decoded into buffer, which games uses as collisions.
In that game, distance-field is created with this asset by using 256x256 seed surface, which is only done at the start of level. Making level was done by just drawing random shapes to seed, then: flood, transform & decode. This allows destructible environment too, as I could have just erase area in seed, and do steps again.
Sorry about long post 😅