Reward for the one who can distribute particles from a cycles node non destructively

Hello

i’d like to distribute this green particle only on the white area of this procedurally created cycles mask. I need to find a way to link this cycles map to either a vertex or texture emplacement slot in the particle system. i need to automate this for an addon.

Could the solution be Non destructive. (= can still change parameters of the material afterward and it will influence the particles) edit* and other than baking maybe ?

→ if someone could find a process that is destructive but good enough for automation he’ll get 20$.
→ if someone can write me a code that is destructive that i can use that can automate this process for any terrain, (+explanations if needed) he’ll get 80$
→ if someone find a non-destructive solution he’ll get 100$

Okay. Good luck. I’ll only pay one solution (for now… If someone find a non-destructive one later i’ll consider it too.)

There is two topic for this question, one in the python support category, one in the Basic & interface category.

If I understood you correctly, most straight forward way is to UV bake this texture, then import as density map to particle system.

Super destructive and could not work for any terrain. Really difficult to automate.
I already though about that.

This is a huge design flaw from the part of blender because we are forced to bake a cycles material and re create it to a texture material. :woman_shrugging:

Unfortunately, there is no easy way to directly use shader data.
Apart from shader option, you might be able to detect appropriate faces via dot product of face normals and global Z axis, then combine them into vertex group and use as vgroup density guide for particles.

Unfortunately, there is no easy way to directly use shader data.

Yes that’s why i reward this question. It’s really hard, and stupid :frowning:

could you elaborate ? please ? This is done through code right ? i never did any bmesh scripting before.

Neither am I.

Here is quick concept done in Animation Nodes:


FIle for 2.79: dens_AN_2.79.blend (199.3 KB)

I am iterating through vertex normals, calculating dot product with Z axis and assigning weight data based on comparison between dot and some threshold. White circles are vertices with 1.0 weight

However there is a problem, that particle system still places particles on some faces where weight was set to 0 (like above nose of a monkey on attached pic)

1 Like

Thanks for the answer. :slight_smile: i’ll do some testing.
But about the main question. There’s really no way to use the node data ?
with cycles you can do so many dispersion maps easely. elevation, slopes, occlusion, pointiness… i want to harness cycles nodes power for particles distribution.

Relevant: https://devtalk.blender.org/t/particle-nodes-ui/8808

…dude don’t spam the thread with offtopic questions :grimacing:

There’s also the functions branch https://blender.community/c/graphicall/Qcbbbc/

Plus Cycles is a rendering engine, not a data transformation tool. Terrain generation is not non-destructive anyway, so why seek non-destructive workflow? Just bake curvature and ambient occlusion to vertex colors or vertex weighs, and use that data to control how to spawn objects or particles.

You can use Python and Blender k-d trees library to create Poisson disc sampling https://www.youtube.com/watch?v=7WcmyxyFO7o

There’s also a good blog post about how to achieve nice looking distributions that aren’t too blobby. https://caseymuratori.com/blog_0011

…dude don’t spam the thread with offtopic questions :grimacing:

Oops. :woman_shrugging: (deleted)

Terrain generation is not non-destructive anyway,

what about a noise texture + displacement ? what about non destructively re importing another model of the terrain witouth needing to remade the distribution maps from scratch ?

To give flexibility to my users. Adjusting slope/altitude/occlusion/pointiness masks on the fly from a node could be way more efficient and easy to use for a biome scattering tool.

You can use Python and Blender k-d trees library to create Poisson disc sampling https://www.youtube.com/watch?v=7WcmyxyFO7o

There’s also a good blog post about how to achieve nice looking distributions that aren’t too blobby. https://caseymuratori.com/blog_0011

Really interresting ! but it’s a bit off-topic for what i’m doing.

You can generate the slope/altitude/occlusion/pointiness yourself in your script through the mesh data.

https://github.com/amb/ambitools/blob/master/init.py#L1071

Calculating slope is dot product of two vectors: The mesh normal and the up direction. Ambient occlusion requires some ray casting.

2 Likes

that’s really really nice !!!
But it feel’s so stupid because cycles nodes already have all the tools needed for creating thoses easely !

Yeah, but Cycles is a rendering engine, not a data transformation tool. Blender really should have proper function nodes that can transform data like textures, vertex colors and weighs.

1 Like

all the data needed is only but a simple b/w color information, is this so difficult to transmit to either the texture editor or vertex paintings editors ?

To the best of my knowledge: as the entire thing is a monolithic CUDA or OpenCL blob that reads data only one way… yes. Yes, it is. Only way you can get things out of Cycles is render it to an image.

1 Like

Thanks. Now i know that im restricted to mesh data analysis distributing my particles, lot of work, i will need to find someone to work with me on that part then.
The reward is still open. anyone who find a way to make a non destructive link. he’ll recieve 100$

I also believe that baking is pretty straight forward. And it isn’t difficult to automate.
You can even have a script to bake the texture into a vertex weight layer (thought particles can use image textures as well).

baking and uv unwrapping automatically any terrain what so ever ?
what about if the script that auto unwrap don’t do it correctly for 100% of cases ? what about if the baking process is taking too long ? what about if the terrain mesh is tool heavy for all of this ?

i don’t think that it is a reliable option but if you think it could work prove me wrong with a code and i’ll give you 80$

what are the steps to automate ?

  1. terrain sellection
  2. enter edit mode
  3. enter top view
  4. unwrap
  5. optimize uv island in texture emplacement in another editor

after that there two possibilities, the vertex one ore texture creation one. i think that the texture creation one will be less complex

  1. create new texture texture
  2. adjust all parameters for particles blablabla
  3. use texture based on image
  4. set image on uv

Done. Like that ? Am i missing something ? Are you advicing me other kind’s of steps for unwrapping the terrain ? do i need to enter edit mode ?

In the case of particles, you’ll probably don’t need a very high resolution. Also you just need the color, so there’s no usage of the expensive raytracing, and you’ll be fine baking with just 1 sample.
The only problem i can imagine, is about when to update the texture (in case of changes in the material).

well, a condition that detect if there’s already a texture with X names used in the scene and an automatic suppression would do the job. isn’t it ?

And the grey areas should have less density or what?