Author Topic: Basic question: Rotating textures in GMax  (Read 585 times)

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« on: August 11, 2014, 06:19:09 pm »


               

Is there a gmax setting that will properly export a rotated texture?  Meaning the texture is rotated properly in gmax but it isn't rotated in game.  I've rotated the texture using that Material Editor by adding a w+90 to the UVW angle and applied it to a mesh using UVW mapping. 


 


Yes, this is probably a simple question, but after playing with various settings over the weekend, I'm stumped.


               
               

               
            

Legacy_MerricksDad

  • Hero Member
  • *****
  • Posts: 2105
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #1 on: August 11, 2014, 07:13:43 pm »


               

On a tile, or on a character model?



               
               

               
            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #2 on: August 11, 2014, 07:24:09 pm »


               

Tile.



               
               

               
            

Legacy_NWN_baba yaga

  • Hero Member
  • *****
  • Posts: 1944
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #3 on: August 11, 2014, 08:18:09 pm »


               

Not sure where the problem could be. Textures only rotates if you tik the option "rotate texture" in the trimesh settings for it. What you can do is to collaps all the modifiers of your mesh, resetx form and dont use the rotate texture option. That should do it! If not you can upload the mdl and i take a look at it for you.



               
               

               
            

Legacy_MerricksDad

  • Hero Member
  • *****
  • Posts: 2105
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #4 on: August 11, 2014, 08:20:31 pm »


               

ok, so on anything you want to export using NwMax (at least the version I am using) you cannot apply the texture rotation via the material. You have to actually rotate the tverts. The problem with that is the Max4 tvert rotator which is part of the unwrap modifier is screwy and the rotation point is relative to an onscreen value, rather than a flat data value (which is stupid, but I suppose it is based on screen editing, not code editing).


 


INYe1Do.png


 


I've put this little bit of code together just now to help you out. It takes all the tverts on a mesh and rotates them counter-clockwise X degrees rotated around a pivot point. UVW values are represented in a 0-1 unit scale, so I suggest rotating all points around pivot of [0.5,0.5,0.0].


 


ER2gi0N.png


 


Here is a ms file to place in your gmax scripts directory:


 


https://www.dropbox....md_rotateUVW.ms


 


open it and execute it to place the two functions into ready position


 


Then select all the parts you want rotated and run this line in the listener


 


rotateUVW <your angle> [0.5,0.5,0.0]

 


 


Edit: a warning will sound if the model node has any modifiers on it. It should be collapsed first. Reapply any needed trimesh modifier after that


 


Edit Edit: I also forgot to mention to erase the rotation angle in the material editor, so it will appear correctly both in-game and in gmax for you.


 


This will also appear on my rollout panel in the next release (v0.91) of my GMAX script library. Look under Funcs Panel > Texture



               
               

               
            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #5 on: August 11, 2014, 09:14:45 pm »


               

*blushing*  Lets assume that I've never touched the listener.  I've reached the point of running the script but then how do I, "Then select all the parts you want rotated and run this line in the listener  ---  rotateUVW <your angle> [0.5,0.5,0.0]"


               
               

               
            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #6 on: August 11, 2014, 09:26:52 pm »


               

Or I could just rotate the .tga.  '<img'>



               
               

               
            

Legacy_MerricksDad

  • Hero Member
  • *****
  • Posts: 2105
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #7 on: August 11, 2014, 09:52:44 pm »


               

well yes that is the other option, and easier IF you didn't already use that tga in something else.


 


ok, so if you are up to that point what you do is just mouse select all the bits you want to rotate the texture for, or use the "Select By Name" tool from the main toolbar and pick them from the list. I'm assuming you only want one thing rotated, but just in case...


 


So now, the listener is the window attached to the bottom left of the GUI. It initially looks like a little single line text box. If you right click it, you can tell it to open listener window, or you can just type the line in there and hit enter. You can also open the listener window from the program toolbar under Maxscript > Maxscript Listener, or otherwise F11



               
               

               
            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Basic question: Rotating textures in GMax
« Reply #8 on: August 11, 2014, 10:15:56 pm »


               

So now, the listener is the window attached to the bottom left of the GUI. It initially looks like a little single line text box. If you right click it, you can tell it to open listener window, or you can just type the line in there and hit enter.



 


That's just what I needed to know.