PDA

View Full Version : Randomize instances angle in steps of 90



Sebasvideo
03-03-2014, 12:51 PM
I'm having a problem trying to randomize instances of squares (city blocks) in 90 increments but at the same time keeping them in place. Searching for this I found this old thread: http://forums.newtek.com/showthread.php?127274-how-do-i-step-rotations-in-instances in which Dpont suggests this solution:


Connect the Instance ID (Instance Info node)
in the A input of a Math Scalar node, set B to 4,
so for your Instance sequence you will get 0, 1, 2 or 3,
multiply by a Constant Angle node set to 90,
it converts this angle to radian which is the correct
unit for the node editor, you get 0, 90, 180 or 270 angles
for your sequence, connect this result in the X Input
of a Make Vector node (Heading), plug it in Rotation.

You could skip the Math Mod node, just multiplying
the Angle by the Instance ID but not sure with
a huge number of instances, when you reach great
angle values.

So I did that, except that I can't use the Instance Info Node, when I double click on it it gives me an error that it can only be used outside the instance node editor, and to use the input node instead. So I used the Input ID Index instead and connected the rest:

120562

The problem is that it doesn't just rotate heading for each block randomly by 90, it also distributes the instances at random places, some of which are even occupying the same space:

120564

What I need is something that will look like this, but with the instances rotated randomly by 90:

120563

Is that possible, and if so, how?

Thanks

XswampyX
03-03-2014, 01:02 PM
Something like this?

bazsa73
03-03-2014, 01:16 PM
Because your original objects doesn't sit at the origin. If those gray ones in the middle are the ones you try to instance. I guess.

Sebasvideo
03-03-2014, 02:54 PM
Something like this?

Thanks, when I load your scene I get the same error I got when I tried the method described by Dpont:

120566

Sebasvideo
03-03-2014, 03:06 PM
Because your original objects doesn't sit at the origin. If those gray ones in the middle are the ones you try to instance. I guess.

Well, the gray ones in the middle are five separate squares with buildings, however, in the screenshot, only the first one is activated. The instance system in Lightwave has me a bit confused. In my scene, if I use "Clone Instance" I get nowhere because it only clones the null that contains all the objects in each square. So I have to go into each parent null and create instances of it, but then I realized that I could create a separate null, add an instancer and inside the instancer add the parent nulls for each square and select the hierarchy icon so all the buildings will show up. Unfortunately if I wanted total control over how the squares are distributed and rotated, I would have to create single instances, which in Lightwave seems to be a long process if you have to create a lot of them.

But rotation angle aside, what is the right way of creating instances? Is it by adding the instance generator in the properties for the parent null, or in a separate null and adding the parent nulls to that instancer instead?

Sebasvideo
03-03-2014, 05:59 PM
I've also been trying out both DP Instance and DP Instancer, but neither seems to work. Basically the Node setup described in that thread doesn't really change anything, once I enable the node it changes to another position, but it's basically the bounding box of the instance, 1 or more depending on how many I set in the distribution tab.

bazsa73
03-04-2014, 04:07 AM
On the Instance Generator panel on the left side set W to L.
Since your gray shaded parts have an offset the instancer uses that offset if your coordinate system is set to World.
If Local then it doesn't give a damn.

Sebasvideo
03-04-2014, 02:20 PM
Thanks, I actually got tired of trying out different things and I ended up making five nulls, to each of which I added one instance generator (LW native) added each of the five squares, and then cloned each null about 11 times, to have 12 nulls per square. Then I arranged them myself eyeballing them, and finally aligned them to make sure they matched exactly at the borders.

bazsa73
03-04-2014, 02:39 PM
Hello,
listen dude, just forget that parenting to a null issue. You dont need that. Just create a null. Apply the instance generator to that null and import as many
instances as you want. You do not need to set up a "null per instance" scenario.

Sebasvideo
03-04-2014, 02:46 PM
Hello,
listen dude, just forget that parenting to a null issue. You dont need that. Just create a null. Apply the instance generator to that null and import as many
instances as you want. You do not need to set up a "null per instance" scenario.

It's easier that way because I have independent control over each instance. I tried what you just said two days ago, creating a null, setting up all the instances in it and it was hell trying to have the squares not occupy the same space, but also not spread out too much. I wasted like a day trying out different things and nothing worked. Lightwave could really use an instancing system like Element 3D for AE has, where you have many more options to set up arrays, including one that will rotate at random but in steps of 90, and each instance will follow local coordinates, so they don't spread all over the place in a chaotic way like in Lightwave.

The way I did it is the simplest way I could think of to have complete control of each instance, not only how far away from the center but which ones I rotate and by how much. Also having one instance per null gave me the visual aid of having the arrows on the viewport so arranging them all didn't take me too long.

bazsa73
03-04-2014, 02:58 PM
Ok, I see. I'm out of ideas. I hope you find an optimal solution.

Sebasvideo
03-04-2014, 03:01 PM
Ok, I see. I'm out of ideas. I hope you find an optimal solution.

That was pretty much the optimal solution. Although perhaps there is some nodal setup that will rotate heading in steps of 90 but without spreading the instances all over the place.