Home Technical Talk

Unwrapping modular pieces for tiling textures

greentooth
Offline / Send Message
C86G greentooth
Hello guys.

I got a problem and need your help. I want to unwrap a piece of geometry that is a part of a modular building (at this stage its only a grayboxed model).
I want to use tiling textures and so I need to make the tiling wall piece to fill exactly the horizontal space uv the UVs. How do I do that in Max?
I know there are some snapping options. But I dont want to moce vertices, I want to scale the whole uv chunk.

What am I missing here? 
Thank you : )


Replies

  • Barbiturat
    Offline / Send Message
    Barbiturat polycounter lvl 12
    Hi, Try this: 
    (
    	if(selection.count != 0) then
    	(		
    		/*max modify mode;*/
    
    		modsCount = $.modifiers.count;
    		print modsCount;
    		unwrapsCount = 0;
    		if(modsCount == 0) then
    		(
    			addmodifier $ (Unwrap_UVW());
    		)
    		else
    		(
    			for i = 1 to modsCount do if(ClassOf $.modifiers[i] == Unwrap_UVW) do unwrapsCount += 1;
    			print unwrapsCount;
    			if(unwrapsCount == 0) then 
    				addmodifier $ (Unwrap_UVW());
    		)
    
    		$.Unwrap_UVW.unwrap2.setTVSubObjectMode 3;
    
    		selectedPolys = $.Unwrap_UVW.unwrap2.getSelectedFaces();
    		if(selectedPolys.isEmpty) then
    		(
    			$.Unwrap_UVW.unwrap.selectPolygons #{1..polyop.getNumFaces $};
    		)
    
    		selectedPolys = $.Unwrap_UVW.unwrap2.getSelectedFaces();
    
    		x = 0.0; 
    		y = 0.0;  
    		w = 0.0; 
    		h = 0.0; 
    		aUVW = 0.0; 
    		aG = 0.0; 
    		$.Unwrap_UVW.unwrap4.getArea selectedPolys &x &y &w &h &aUVW &aG;
    		/*format "X: % Y: % W: % H: % aUVW: % aG: %" x y w h aUVW aG;*/
    
    		S =  (1.0 / w);
    		$.Unwrap_UVW.unwrap2.scaleSelectedCenter S 0;
    
    		$.Unwrap_UVW.unwrap4.getArea selectedPolys &x &y &w &h &aUVW &aG;
    		/*format "X: % Y: % W: % H: % aUVW: % aG: %" x y w h aUVW aG;*/
    		$.Unwrap_UVW.unwrap2.moveSelected [-x, -y, 0];
    	)
    	else ( print "Selection is empty!"; )
    )
    object should be edit poly / editable poly
    select uv-shell inside UV editor and run the code.
  • C86G
    Offline / Send Message
    C86G greentooth
    Will try tomorrow when I am back at work.
    Thank you!
  • C86G
    Offline / Send Message
    C86G greentooth
    What am I doing wrong?

    : (



  • Barbiturat
  • C86G
    Offline / Send Message
    C86G greentooth
    This is amazing! It does exactly what I want!

    Thank you so much!
Sign In or Register to comment.