0
$\begingroup$

Whats a good and performant way of creating a list of random vectors inside a given radius/sphere?

the random vector node (with scale set to 1) unfortunately creates vectors ranging from (-1, -1, -1) to (1, 1, 1), which results in a cube like shape. When changed to Normalized Vector, all vectors have a magnitude of exactly 1, resulting in uniform distribution on the surface of a sphere.

How can I achieve random vectors with a magnitude ranging from 0 to 1?

Is there a better way than creating a loop of a single normalized vector with a random scale?

$\endgroup$
2
  • $\begingroup$ What about multiplying with .5 and adding 1 ? 😊 $\endgroup$
    – Chris
    Jul 20 at 14:50
  • $\begingroup$ I don't want vectors in the positive quadrant, I want vectors with a maximum but variable length. For example the vector (-1, -1, -1) has a length of 1.73 but i only want vectors in the range of 0 to 1. The Normalize Vector option in the node results in vectors of length 1 and exactly length 1. 😊 $\endgroup$
    – bstnhnsl
    Jul 20 at 14:57
2
$\begingroup$

Spherical distribution of random points inside sphere the actual way: link

enter image description here

Fast and simplified version:

enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ The cube root is just for a uniform distribution, right? (I actually don't need that, but nice to know, its that simple) I also like the scaling afterwards instead of using a loop, didn't think of that. $\endgroup$
    – bstnhnsl
    Jul 20 at 18:51
  • $\begingroup$ Yes cube root is for uniform distribution $\endgroup$ Jul 21 at 1:27
0
$\begingroup$

So seems like my first (second) idea works great and performs really well:

I use a Random Number inside a loop to control the scale of a single Random Vector node. The Random Vector is set to Normalized Vector. I also added a basic setup to have some control over the seeds.

Node Setup and comparison to the native random vector nodes:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.