ideas for calculating surface coordinates?

I’m basically attempting to write my own scatter script since there appears to be no access to the native max scatter tool through script. Unfortunately I’m a bit green when it comes to max script, and I am unsure of how to calculate coordinates so that “node A” is placed somewhere on the surface of “node B” I’ve seen a simple example where copies are placed at vertex locations, but even when you introduce some randomness to the locations this technique produces poor results on objects with a low vertex count. If anyone has any ideas, or can point me to some useful syntax for calculating surface coordinates, I would greatly appreciate the help.

Cheers

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Martin Breidt's picture

Have you considered using

Have you considered using texture coordinates? If your object that you want to scatter onto has unique, non-overlapping texture coordinates, that should work.

Other than that, you could pick random faces and on a face, you could pick random barycentric coordinates (like the Attach Controller, but random). For uniform distribution, you probably have to take the face area into account in your random pick of a face?

-- MartinB

Kolgrima's picture

Thanks for the input, great

Thanks for the input, great ideas; the target geometry I’m using has no texture data at this stage of the script, so using barycentric coordinates of a face would work well. Uniform distribution is of less concern, but just off the top of my head, I suppose I could use something like the average area divided by the face area giving me a result for the chance of face selection, A(a)/F(a) = C. I’ll play around with some more ideas for surface area.

Cheers

schaf82's picture

hi I'm not shure if i did

hi I'm not shure if i did totaly understand but you can get possitions on surfaces with intersecting the surface with a ray.

maeh maeh

maeh maeh

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.