Announcement

Collapse
No announcement yet.

rotate and flip texture sample?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    rotate and flip texture sample?

    Does anyone know how to rotate and/or flip a texture sample within a material? I know the rotator material expression will consistently rotate a texture sample, but what I am looking for is a static rotate. I would like to rotate a texture sample, say, 90, 180, or -90 degrees (270), and have that sample NOT move. I have read through the descriptions of all of the material expressions and am not able to find a way to do this. I would also like to be able to flip a texture sample on the horizontal and/or vertcal without having to create and import a unique texture in to my package. I figured that these functions would be very simple and easy to do, but I am having no luck. The only other way I can think of accomplishing my end-goal (without having to create more unique models/textures) is to create each of my assets with 9 UV channels, each channel with a unique variation of my UVs rotated and flipped (the 9th channel would be for my light map). I would then reference a specific channel within my level based apon my asset's unique use within the map. I'm not sure if this is even a plausaible or cost-worthy solution. I have used three UV channels before, but nothing close to nine.

    I am basically trying to get the most use out of my content without having to create additional unique content. I am working on a long term project that is heavily based on modular buildings/cities, and I need to be able to change the rotation and orientation of a material based on the rotation and scaling (flipping) of the assets used within the world. Any help would be awesome

    #2
    Use a rotator and plug a constant into the Time node. Time is in seconds how long the texture will rotate for. Fiddle with Time and Speed to get the desired rotation. It also works the same for a panner.

    There may be a simpler way to mirror a texture, but here's how I would do it off the top of my head:

    Open the texture in the texture editor. The first two options on the list are something related to X and Y, I forget what, but set one of them to Mirror (X for horizontal mirror). Then use a panner and use the time node again to move the texture over one full texture length.

    Comment


      #3
      When you select (L-click)the material surface in Perspective View, press F5 on your keyboard. This brings up the Surface Properties window.

      In this window, there is Pan, which shifts the material/texture up, down, left right (shift-click to move opposite).

      Rotation- rotates the material/texture.

      Scaling- size of tiles, tiling.

      Lighting- the resolution defines how detailed the shadows thrown of this surface are. The lower the number the more detailed AND computer intensive the shadows are.

      Alignment- Planer is cool as it allows two brushes to seem seamless.

      Options- I have no clue!

      Comment


        #4
        He was asking how to flip/rotate the texture within the material editor.

        Comment


          #5
          I'm not sure if I explained myself very well. What I am trying to do is rotate my texture sample a specific amount (say 90 degrees) within the material editor, and after that rotation has been calculated the texture should not rotate anymore. The image should be static. I am attaching an image that I Photoshopped to make look like what I would idealy want. I created a simple Rotate material expression (all photoshopped, not real) which allows the user to input the degree of rotation, and perhaps change the origin of the rotation (like the rotator expression).

          In addition to rotating a texture sample a given amount I would also like to mirror the sample along the U and V.

          bclagge, I am having trouble finding the options that allows me to mirror my texture sample. When referring to "the list", are you referring to the material expression list? I can't find any simple mirroring options anywhere within the material edior.

          Comment


            #6
            It looks like you're using a different version of the editor than I am. In my version, the Rotate function has Time instead of Degree - but I would think Degree should do exactly what you want it to do. Add a Constant function and make it 90 or -90 and connect it to Degree. In theory, that should be all you have to do to make the texture rotate.

            Mirroring:
            In the generic browser, select the texture you want mirrored. Open it in the texture editor, as displayed in the lower half of the following image. Change AddressX to TA_Mirror. This means that when the texture repeats itself (tiles) every other copy is mirrored on the X axis. So, all you have to do now is move the texture over one tile and it will be mirrored. Use a Panner. As you can see in my pic, my Panner has a Time input, for which I input 1. For SpeedX I use 1. These two combined will move the texture over 1 tile on the X axis. If your Panner has something other that Time, and you can't figure it out, post a screenshot and I'll see what I can do.

            Look at the shading on the sun's face and you can see that it is mirrored:

            Comment


              #7
              Thanks a ton bclagge, I figured it out. I overlooked your first comment about how to rotate an image properly, because, I suppose, I didn't realize you could just plug a constant value into the Time input to accomplish this (I assumed it would constantly rotate and I did not try it... my first stupid mistake). I then went ahead and photoshopped the image in an attempt to explain myself in more detail (thinking you didn't understand my first post), which in turn probably confused you a bit.

              Figuring out the mirroring was very easy also. I didn't realize it was possible to change the way an image would tile directly in the image's properties.

              I'm surprised I didn't troubleshoot this issue by myself before posting here. I suppose I just don't fully understand how some things work in Unreal still. I was getting frustrated with the issue so decided to try out a forum. Thanks for the help though. I'll definetely be saving some harder questions to post in these forums later

              Comment


                #8
                Ask any question you want! We're all here to help, and often it's easier for someone to type up a 20 second response that it is for you to spend an hour fiddling with things trying to trial&error it. I'm glad you were able to get it to work.

                Comment


                  #9
                  ok, i've almost figured out eveything, but I seem to still be having some issues. Using the panner and rotator material expressions have helped me orient and fix six of the eight possible material orientations. It turns out that two of the orientations require materials that use both a rotator AND panner order for the material to be properly oriented. I am having trouble getthing these two material expressions to work in one material at the same time, and I'm not sure if it's possible. They can easily work by themselves, but together, i'm not sure. I have attached am image that should help demonstrated my issue. Every actor shown in the image is referencing the same geometry within my package. Notice how I am trying to make my materials display as if I am projecting a texture on to them from the side, despite the mirroing and rotation of the actors.

                  Comment


                    #10
                    Just take the output from the rotator or panner that you've already worked out, and plug it into the UV input for the next rotator/panner you need to use. Then it should work fine.

                    Comment


                      #11
                      Wow, i'm an idiot. I thought I had already tried that 5+ times already w/ failed results.... guess not Now, the real question is: can I plug in paramaters in substitution for these values in my material template so that I may change my orientaion and flippage per instanced material.

                      Comment


                        #12
                        Yes, absolutely. Set it up like I have it below. Leave the parameters at 0 if you're not using that function for the MI. Of course, you can only rotate/pan in one direction, but that shouldn't be a problem as it comes full circle. If it doesn't align properly then just switch the rotator and panner. The only reason I think this would happen is if you pan it, but the pivot point for the rotator doesn't pan with it. I think it does though.

                        Comment


                          #13
                          the thing about that setup is the fact that I don't have control over the SpeedX and SpeedY of the Panner expression. These values basially correlate with the mirroring of the texture sample along the X and Y axis. What I do have control over in that setup is the Time option of the panner, which basically is the on/off switch for whatever mirror options I have input in to the SpeedX and SpeedY of the panner. I was hoping to plug parameters in to the SpeedX and Y so that I would be able to have ALL mirroring combinations. Without having control control of the SpeedX and SpeedY variables, I can not accomplish all combinations listed below.

                          1. The off state (no mirroring): SpeedX = 0 and SpeedY = 0 (this can also be accomplished by inputting 0 in to the Time parameter).

                          2. Mirror on the X axis: SpeedX = 1 and SpeedY = 0.

                          3. Mirror on the Y axis: SpeedX = 0 and SpeedY = 1.

                          4. Mirror on both the X and Y axis: SpeedX = 1 and SpeedY = 1.

                          I did think about this a bit more and, for now, I have concluded that I don't actually need to have access to all of these combinations in order to accomplish what I want. Although, it would be nice. I was able to orient all 8 of my materials properly by using the rotator by itself AND in combination with the panner expression. When using both expressions together, I only actually needed to mirror along one of the Axis; I chose the X-axis. I think with the proper rotate value and the ability to mirror along only one of the axis allows me to still cover all combinations of material orientations, despite the fact that I don't have full control over all the mirroring possibilites listed above.

                          Comment


                            #14
                            You may not need it, but it's still possible. Just add another Panner to the chain, and make one Panner have a SpeedY value of 1, and the other Panner have a SpeedX value of 1. Then you can use one or the other, or both, by turning the Time parameter on and off for each one.

                            Comment


                              #15
                              ok, cool, what you said in your last post works just fine. The only issue I am having now is a issue with the Scalar Parameter. Since you used the Scalar Parameter in your last image, I assumed that it would be the proper parameter to replace my constants. It appears that the Scalar Parameter has issues flipping my texture samples when a whole number is input in to the DefaultValue of the parameter: an issue which a Constant material expression has no issues with. See the image attached below.

                              Comment

                              Working...
                              X