Home Unreal Engine

Help with rotating rings inside material

polygon
Offline / Send Message
EvilPixills polygon
Hey guys,

I have a material that has various animated parts using panners and rotators. The specific problem I am having is with a rotating disc-like element. I want the outer segmented ring to rotate around the inner solid ring:
WFfArTT.jpg
I can't get the correct rotation down. I've tried using specific masks but I cannot get it to work properly, the ring just rotates outside the model.

If anyone could lend a hand or maybe point me in the right direction, I would greatly appreciate it. Thanks!

Replies

  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    You can specify coordinates to the rotator node to give the rotation pivot point, isn't that what you are looking for ?
  • EvilPixills
    Options
    Offline / Send Message
    EvilPixills polygon
    Froyok wrote: »
    You can specify coordinates to the rotator node to give the rotation pivot point, isn't that what you are looking for ?

    Exactly. I will go back and tweak around then. I guess I was making this more complicated than it should be hehe.
  • Hourences
    Options
    Offline / Send Message
    Hourences polycounter lvl 18
    If you want it technically correct, you should use smaller images. I take it your ring texture is the same resolution? Thus most of it is black? The way to go would be using 128x128 ring texture on a 1024 texture for example. Else you just waste tons of memory + you get these kind of problems with rotation (though changing rotation center should indeed fix that but it is highly annoying to do because you need to use trial and error to find the right spot).
    If you'd use a smaller texture and offset its position, you would not need to change the pivot, because the pivot is the center of that texture automatically, regardless of resolution.
  • EvilPixills
    Options
    Offline / Send Message
    EvilPixills polygon
    Hourences wrote: »
    If you want it technically correct, you should use smaller images. I take it your ring texture is the same resolution? Thus most of it is black? The way to go would be using 128x128 ring texture on a 1024 texture for example. Else you just waste tons of memory + you get these kind of problems with rotation (though changing rotation center should indeed fix that but it is highly annoying to do because you need to use trial and error to find the right spot).
    If you'd use a smaller texture and offset its position, you would not need to change the pivot, because the pivot is the center of that texture automatically, regardless of resolution.

    Thanks for that bit of info, Hourences. I switched to a smaller image for the rings but I am having a hard time understanding whether it has to be uv dependent with the texture or aligned to the center. I have tried different positions but I have yet to get the perfect pivot without having to adjust the rotation center.

    3MEJWJ4.jpg

    Close but not quite:

    gJwxGwh.jpg
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Are you sure you set the correct rotation point? Select your Rotator and define the place you need it to be, as of default, it's set to 0.5,0.5, which is in the center.
  • EvilPixills
    Options
    Offline / Send Message
    EvilPixills polygon
    Quite honestly, Ace-Angel, this is where I am struggling the most. I cant seem to wrap my head around the center x and center y values. I have been entering values all day and have yet to find the sweet spot. It's driving me mad.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Think of your UV's as a linear graph for now, where your X and Y values will put a dot (center) on it as you change the numbers.

    0.5 (if both numbers are the same) is exactly in the middle of the UV.

    0.0 is (if I'm not mistaken) left corner of the UV (origin point).

    1.0 is the top right corner (which is near what you're looking for).

    So try and use small values on you Rotator's number, change from 0.5 for both to something like 0.95, 0.9, 0.85, etc. until you find the sweetspot you need.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Like Ace mentions UV (texture) space starts with the upper left corner of your texture being placed at 0,0. Positive U is to the right, positive V is down. One image is mapped to one unit square of UV space by default. So 0.5,0.5 is the middle of the image.

    Things to remember:
    Uv space is infinite.
    Your texture has options for how it is mapped across that infinite space. (find the texture in the editor and double click it to bring them up)
    Looks like you may have this working already, but for an image like this you want to ensure that it is set to Clamp. That will essentially isolate your image as only ONE image in all of UV space. No repeating when the UV coordinate values get below 1 or above 1.

    What you're doing here is transforming the SPACE the image is MAPPED to. Not transforming the image itself. (subtle distinction but it may help you visualize whats up since you can already think in 3d enough to model things) Think of it like having a giant plane that the image is on, and you're manipulating that plane.
    The coords node represents UV space itself. A rotator rotates your texture plane in space about a point you specify either in the rotator node itself, or through its coordinates input.
    Also just like in XYZ space, transformation order is important.

    The good news is, you're pretty close here.
    Assuming your texture for the animated element is 3MEJWJ4.jpg


    Set your rotator's center to 0.0,0.0. Don't have anything in the coords node. This will make sense in a minute.

    Hook up a texcoord node to an add node. Plug in a constant -0.5 to the add. This will re-center your texture at the origin of space.
    Next, hook this into a multiply node, and hook up a scalar parameter to the other multiply input. this will be the scale of your graphic on the other texture.
    Hook this chain into the rotator's coordinates node.

    If you hook this into a texture's UV channel, it will rotate and scale around its center, but be stuck in the upper left corner.
    To allow you to position it we'll need 2 add nodes.
    The first add node should have the rotator plugged into one input. The second add node should have the MULTIPLY node from just before the rotator plugged into one of its inputs. Now hook up a SINGLE Vector2 parameter into those add nodes. It should be the same vector2 parameter for each add node.
    Hook up the add node with the rotator plugged into it into the UV's for the outer ring, and the one without the rotator into the UV's for the static portion.
    This vector 2 will control the positioning in UV space for your rotating graphic. by using it into both add nodes, you'll be moving all the parts of your graphic together.

    The network should look something like the attached (Pardon the generic diagram. I don't have UDK available right now)
  • EvilPixills
    Options
    Offline / Send Message
    EvilPixills polygon
    Thank you so much for putting this into perspective guys! Huge thanks to you, Vailias for taking the time to put together that detailed description and diagram. This helps a lot. Here's what I ended up with in the end:

    mFLR8RZ.jpg

    I was having issues with getting the position down with just the one vector 2 parameter as it seemed to only affect the pivot of the rotation. In the end I ended up replacing the constant (-.05) node with another constant 2 vector allowing me to control the x and y positions.

    I'm not sure if I did something wrong here or not but it's working! I've learned so much in the process of getting this to work and I appreciate everyone's help. Please feel free to chime in if you guys see something that isn't technically correct or ass backwards. Thanks!
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Glad it works!
    You didn't do anything wrong if it looks right. Chaining together afine transformations is always tricky when it involves a rotation. I wasn't 100% sure I had those in the right order, but it looks like you figured it out. :)

    Oh dur, I see where I went wrong. It's like I said about transforming the space. (Forgot that partway through the mental math.) The origin is still at the corner of that image, but the addition at the rotator moves the rotation center like you found.
    :)
Sign In or Register to comment.