HungryProton / scatter

Godot engine addon to randomly fill an area with props or other scenes
MIT License
2.16k stars 96 forks source link

[Feature] Support Detail Map #71

Open MJacred opened 2 years ago

MJacred commented 2 years ago

place different mesh according to a "detail map" (cluster mask code can probably be re-used?)

so that instead of grass (or empty spots) there clumps of flowers, stones, etc. placed

EDIT: some notes/thoughts

addmix commented 2 years ago

I don't see how this could be integrated into scatter, considering that there is no mesh to draw a detail map onto. Beyond that, if you are using terrain, and wish to have a detail map, why not use the detail map included with terrain?

MJacred commented 2 years ago

One way to get that mesh is: Based on the source data (the polygons), create a simplified triangulated mesh. The user can draw on that mesh.

The terrain was just an example for illustration and implementation reference. A terrain system has a very limited use case range. Scatter, on the other hand, can be used on almost anything, anywhere: on houses, inside houses, in concrete cities.

HungryProton commented 2 years ago

That's a feature I didn't include in the add-on on purpose, as I wanted to avoid hand drawing anything. That's the reason it uses 3D paths as a main delimiter by default (although, this will change a little in Godot 4).

I tried to come up with various designs for this, but nothing was good enough, and it only increased the add-on complexity, so the idea was dropped.

MJacred commented 2 years ago

I see

Hm… There is one design I think should be relatively simple, yet powerful (at least regarding fixing overlaps)

what do you think?

HungryProton commented 2 years ago

If this is mainly about overlaps, then I'd suggest using a single scatter node with multiple scatter items and a Poisson distribution (Poisson is slow I know...). This way you're guaranteed to avoid overlaps without the extra complexity.

Do you have a concrete example or screenshots of what you're trying to do?

MJacred commented 2 years ago

Does the Poisson distribution take the different mesh dimensions into account?

If this is mainly about overlaps

It's also about accurate placement… but maybe using noise mask is sufficient.

Do you have a concrete example or screenshots of what you're trying to do?

I'm currently in the preparation step before props placement.
the goal is to be able to quickly place smaller props of few types indoor and outdoor (some some random rotation and scaling, latter within certain range). The props range from vegetation to small everyday items scattered on the ground

HungryProton commented 2 years ago

:thinking: If I can access and run the physics engine from the editor, maybe I can create a new modifier that physically spawns rigid bodies the right size in the scene, wait until they settle and save their position to place items there (and removing the physics objects).

But the detail map... the bigger issue is that Scatter isn't designed for really large areas, partly because using a particle shader is always more performant than using a multimesh. Maybe that's something that could be added, but that a pretty big feature I won't be able to work on before a while.