PDA

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


Eric Chadwick
08-29-2011, 09:53 AM
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?

AlecMoody
08-29-2011, 12:12 PM
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
08-29-2011, 12:37 PM
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
08-29-2011, 02:11 PM
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:

http://i53.tinypic.com/s32hi8.jpg

r_fletch_r
08-29-2011, 02:26 PM
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.
http://i16.photobucket.com/albums/b27/RogerKnightly/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
08-29-2011, 03:21 PM
Awesome, this looks like the solution. Thank you! I will try this in the morning, and let you know.

r_fletch_r
08-29-2011, 03:41 PM
my pleasure :)

Eric Chadwick
08-30-2011, 11:11 AM
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
08-30-2011, 11:16 AM
must have missed a bracket when i pasted it in.

regardless glad it worked for you.