Home Technical Talk

3dsMax: project mesh to a grid, from world center?

Anyone know if Max can do this?

I am scaling vertices, using the world center as the scale center. So, each vertex has its own scale axis... starting at world center, and going thru the vertex. That's good. But I want to flatten them all to an angled grid, along those same vectors. How would I do this?

Replies

  • AlecMoody
    Offline / Send Message
    AlecMoody ngon master
    I don't fully understand what you are trying to do but could you use a UV projection and swap channel information?
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Anyone know if Max can do this?

    I am scaling vertices, using the world center as the scale center. So, each vertex has its own scale axis... starting at world center, and going thru the vertex. That's good. But I want to flatten them all to an angled grid, along those same vectors. How would I do this?

    your trying to convert from 1 grid size to another?

    scale would be 100/(intial grid/new grid) or am I missing the point?

    could you post a picture perhaps?
  • Eric Chadwick
    Here's the idea. I want to flatten the red vertices so they are flat to the green grid. And I want them to flatten along the scale axes... which are centered on the camera (which is at world center). Seen from the camera, the mesh does not change proportions at all, but in fact it will be flattened up against the green grid.

    It would take too much to explain exactly why, but it's for a skybox effect. Skybox always follows the camera, so the shape doesn't matter (from the camera's perspective) but the mesh angle is important for other skybox effects to interact with it.

    I tried a Melt modifier, but I can't seem to align the Center and Gizmo to do this kind of flattening.

    Hope this make sense. :poly142:

    s32hi8.jpg
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    so basically you want to project a ray from the world origin through a vertex and move the vert to the intersection on a rotated plane? The word Grid threw me off. You mean a maya poly grid right?

    that should be quite simple to script. Would you like me to?

    Edit: Done, hope its what you wanted.
    Capture-6.jpg

    select the grid/plane then the objects, then run the script.

    The script assumes that the objects to be projected are Editable Poly and the Grid is an EditableMesh.
    (
    projectionGrid = selection[1]
    aNodes = selection
    
    if aNodes != undefined then
    (	
    	for nNode in aNodes do
    	(
    			if nNode != projectionGrid then 
    			(
    				numVerts = polyop.getNumVerts nNode
    
    				for idx = 1 to numVerts do 
    				(
    					vertPos = polyop.getVert nNode idx
    					projectionRay = ray [0,0,0] vertPos
    					rayHit = intersectRay projectionGrid projectionRay
    					
    					if rayHit != undefined then (
    						
    						polyop.setVert nNode idx rayHit.position
    						
    					)
    					
    				)
    			)
    			
    		)
    	)
    )
    
    )
    
    
    
    
  • Eric Chadwick
    Awesome, this looks like the solution. Thank you! I will try this in the morning, and let you know.
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
  • Eric Chadwick
    Works great! A syntax error at the end, but the result is perfect. Easily fixed by removing that last parenthesis.

    This is in Max 2009

    MAXScript FileIn Exception
    -- Syntax error: at ), expected <factor>
    -- In line: )
    OK
    Thanks again!
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    must have missed a bracket when i pasted it in.

    regardless glad it worked for you.
Sign In or Register to comment.