7
$\begingroup$

In blender 3.0, I made a wire-like mesh using Mesh Line. So, the geometries default origin is the beginning of the mesh line which later, causes problems. I wondered if there's a way to set the position of the origin?

It would be great if I can set the origin to the center of the Geometry. Is there a way for blender to calculate the center automatically in Geometry nodes?

$\endgroup$

5 Answers 5

8
$\begingroup$

I needed something similar but a bit more specific. I ended up with the following Node Group: (make sure to limit the input on x, y and z from -1 to 1).

enter image description here

I can set the origin based on values from -1 to 1, where 0.5 is the center.

enter image description here

Just like in the answer of Gorgious https://blender.stackexchange.com/a/247902/21443, The mesh is being transformed, not the origin. I think at this point it is not possible to transform only the origin.

$\endgroup$
10
$\begingroup$

You can use the Bounding Box node which outputs a mesh's enclosing (bounding) box, as well as the minimum point and the maximum point of the box in the 3 axes.

Then take the mean value of the Min and Max to get the origin of the box. Translate the mesh by this amount to center the origin to geometry.

enter image description here

Hit CTRL + G while the new nodes are selected to create a handy node group you can use later to center the origin on other meshes.

enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ Cool, you transformed the the mesh not the origin. Thinking outside the box $\endgroup$
    – Barbod M
    Commented Dec 23, 2021 at 19:38
6
$\begingroup$

I really don't want to be a smart-ass about this, but here's how I would solve it:

enter image description here

The node Attribute Statistic returns the mean value of the positions of a geometry. Turn this value around and then you have the offset to the center of the geometry.

...or have I understood this a little too simply?

$\endgroup$
2
  • 1
    $\begingroup$ Briliant as always :) $\endgroup$
    – vklidu
    Commented Jan 16, 2023 at 15:01
  • 1
    $\begingroup$ Note this will be biased towards the parts where the geometry is more dense on the mesh. Which is indeed how the "Origin to Geometry" operation works by default in Blender. $\endgroup$
    – Gorgious
    Commented Feb 19, 2023 at 18:37
0
$\begingroup$

Cube mesh aligned to new origin

Duplicate and transform node

Set Origin Version from above plus factor -1 to 1 scale 0 center

This one works on mesh, edges, and splines but could be used to handle others. Translate moves the origin but once you apply the geometry nodes modifier, the origin always reverts to the origin of the object passed in, until this is integrated fully into Geo Nodes, this is an option tho. So you may need to manually apply Origins on anything generated from this but it seems to be usable.

if you leave the translation alone on the duplicate you still end up with the intended origin but it does work on instances within geo nodes or as an array modifier combo.

Works by altering the position of the base mesh which effects the origin like moving the object in edit mode does. duplicate and transform/set position node makes an instance copy that you can then move around and rotate on the new origin.

Hope this helps,

Thanks to all Blender youtubers but special thanks to Johnny Matthews: https://www.youtube.com/watch?v=llJdazdLmBU

Finally starting to understand fields .. a BIT ;)

$\endgroup$
0
$\begingroup$

enter image description here

enter image description here

Edit to the above:

fixed issue with realized instances losing their origin, made it more reusable? potentially. instances revert to their parent origin once realized it seems. same as when the nodes modifier gets applied. this seems to solve setup seems to solve the issue tho. takes origin line moves origin on instance to middle. moves line location back to original position and rotates on new origin. then takes instance with origin still applied and manipulates scale and rotation along modified origin. scale was broken on this step previously from above

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .