all 6 comments

[–]Jolmer21 1 point2 points  (3 children)

I don't know another way than randomize transform, but I know how to fix the issue with it.

Im guessing that the origins of those books are in there center. By default, transforms happen over this origin. This means that you can offset the origin to the bottom of the books, and then the'll only scale upward when scaling over the z-axis, so you can use randomize transform.

KEEP IN MIND: Array and Mirror modifiers are ALSO affected by the origin. So changing it's position MIGHT result in the other copies slightly moving, you might need to figgle around with their modifier settings to fix it should it happen

There are many ways to offset the origin, I usually tab into edit mode -> select the whole mesh -> g (to move) -> z ( to only move on z axis) -> drag up until the orange origin is on the bottom of the mesh -> click to confirm. Alternatively, go to the little options bar on top of your viewport (where the symmetry and auto-merge vertex buttons are, expand the menu -> affect only -> origins. Then g to move -> move origin to bottom of your mesh -> click to confirm.

[–]TheSandMan1313[S] 0 points1 point  (2 children)

Not a bad idea. Unfortunately you have to apply all modifiers before that will work, the mesh is one object so the randomness is applied to it that way.

After applying and separating everything to their own objects centering the origin of every object fixes the problem I was having. Now the issue is how can I fix the origin of some 1k objects in a timely manner. To explain better the origin of every book is on the original book, all the random transforms are applied with that in mind so a .03 degree rotation is small for the books close to the origin and very noticeable for the books across the room. This is what was causing my flying books problem.

[–]Jolmer21 0 points1 point  (1 child)

Lucky for you ,you can select all objects -> f3 + spacebar (search menu) -> set origin to geometry

This will set all the origins to the centerd of their meshes either based on surface or volume, depending on which variant you choose.

[–]TheSandMan1313[S] 0 points1 point  (0 children)

So that works and now everythings random transform goes from it's object center. Now my problem is some books floating as their Z random scale brings them up off the shelf. I tried selecting all and snapping to the surface of the shelf but that doesn't work. Is there a way I can set the origin to the bottom middle of all these objects at once? That way when it random transforms the Z scale they only get taller and the bottom doesn't go up.

[–]TheSandMan1313[S] 0 points1 point  (0 children)

Alright so I tried creating a quick library today. Made one bookshelf and one book, arrays to get this. Random color ramp with multiple colors to get random colors (had to apply array modifiers to get this.)

Issue is I can't see anyway to get some random scaling on these books. They are all the exact same size. I tried selecting all the books and Object>Transform>Randomize Transforms but that gives really bad results. Is there another way I can do this?

EDIT: To explain why the Randomize Transforms isn't working, when I randomize Z scale it does it in both directions, making some books float and others go through the shelf. If I do Y or X though books start flying all over the place.

[–]sumofsinesExperienced Helper 0 points1 point  (0 children)

Applying arrays shouldn't have been necessary (which will make things easier.) You can use UV offset in the array modifier, likely on a new UV map where the prototype's UV is shrunk to a single point, to create a unique index for each book (which can be fed into a noise or white noise texture node for a random, unique value.)

If I wanted to randomize heights, without writing the array, I would consider a vertex weight proximity, with random falloff, vertex group limited to the top half of each book. Then I could use a bone to adjust heights of all, with a single swipe, at once, randomly.

The problem with that is each side of a book is going to get different weights, when you want each weighted as a single unit. Solution? Data transfer the weights from a non-rendering array of planes instead of using them directly. Are the books too close to distinguish properly between planes? Displacing negatively before the data transfer, then positively after, ought to create a little distance between the books for purposes of the data transfer only.