# Distribute pointed objects on a curved surface with random orientation and constraint

I am trying to put objects with random orientations on a curved surface, however the orientations must be limited to directions pointing away from the surface, thereby, avoiding clipping the surface. The objects will be later specified to be very simple molecules with a spheric head and a zig-zag tail. In the example you see here, I just stacked two cones on each other.

I have managed to distribute the objects using Distribute Points on Faces. I also know how to individually give the objects random rotations with Random Value->Vector and connecting the node to the Rotation socket of Instance on Points.

From my understanding the generated random vector(s) use the local coordinate system of my surface object as their basis, i.e., the same coordinate system for each generated random vector. Although I can for example limit the z-rotation from 0 to pi, this does not take into account, that the surface is curved and will result in clipping.

I have started using blender a couple of days ago, so there are still a lot of things I do not understand, such as when the RNG node generates one vector for all distributed objects and when it generates a random vector for each distributed object.

Also, this is all only for a still, I do not intend to do any animations.

Thank you in advance and best regards,

WiseKouichi

It seems like the Normal socket is not very useful or I do not understand it well enough.

The Normal socket is giving you the direction of the face the point was generated on. It's just a vector though, raw data; it doesn't yet have any relation to your objects. Might be a clumsy metaphor, but think of it like this: you are in a dark room and want to face the sun. You ask Blender which direction (Normal) the sun is. It says "Sun is towards East (Vector: 1,0,0)". Trouble is, since you're in a dark room you don't know which direction you're facing. If you're facing North, for example, to face the sun you need to turn 90° clockwise. If you're facing West, you need to turn 180°, and so on... That relationship between your current direction and the sun's, the instruction that tells you how much you should turn and which way so you can align yourself with the sun, is your Rotation.

In this particular case you're lucky because you're using a Distribute Points on Faces node and it takes care of the job of calculating the alignment and gives you the Rotation directly. What if you were not using a node that gives you Rotation though? You simply instanced some objects on the vertices of a mesh directly, for instance. Then, you would need to do the alignment yourself, most of the time by using Align Euler to Vector:

To apply that in your example, you could rotate the Normal vector(s) randomly between positive and negative 90°, and then align your instances to the result(s):

when the RNG node generates one vector for all distributed objects and when it generates a random vector for each distributed object

There are two general types of sockets you'll see in Geometry Nodes. Some are circular, and some are diamond-shaped. Circular ones give you a singular data that doesn't change with the context. When it's diamond shaped, however, the data gets calculated for each element in a domain individually. These are called "fields". The "context" is basically the first main branch of the geometry (green sockets and links) the node is linked to. You can read more about it on the Blender manual.

• Thank you very much for the informative answer. I had a feeling I was lucky with the Rotation socket. In Vector Rotate a fixed rotation axis is specified, is it not? In your case, the Normals are rotated around (1,1,1). If I vary the seed I can see a bias towards the (1,1,1) direction. I am not sure if that is the case in your implementation as well. Can you clarify that? Commented Nov 19, 2022 at 23:07

I got it! It seems like the Normal socket is not very useful or I do not understand it well enough. When I use that socket and scale it up, the distributed objects point all over the place. One should simply use the Rotation socket along with Rotate Euler->Local I tested the range of values for the RNG node by using a vector node. Here, the local z-axis points in the direction of the surface normals. The local y-axis points along the slope of the surface and the x-axis coincides with the world-y-axis. In this case I allow a very limited range for the local x-rotation. Allow 180° rotation around local y and full rotation along local z. Here is the result: