Home Technical Talk

script creation challenge. no AWESOME PRIZES

polycounter lvl 18
Offline / Send Message
Rhinokey polycounter lvl 18
(UPDATE, created planes need not be segmented)

over the years i think of things that would make handy scripts to help my work flow. and since i know nothing about maxscript and am too lazy to learn, i come here and ask some nice polycount scripters to help me out and make them. its suprising that usualy they jump at the chance and it works out great.. for me! so heres my challenge now for anyone who wants to try an help, it may be complex. at work i need to set out a lot of nodes for technical side of a project. in order to do this i need to place out a lot of rectangles

so i would like a script that lets me select a ground plane rough, this will always be perfectly flat and could be in any shape or size. here is a example.
script_1.jpg

and then have the script propagate that surface area with the fewest plans as it can make, to take up the most surface area of that volumes
script_2.jpg i did this example by hand so its probably not as efficient as could be

things that need to happen. all grids need to have edges that are every .5 meters, and are snaped even to maxs grid. (not on the z axis, z should be level with the ground plane) there needs to be a one grid space gap inbetween every grid plane. and a way to set the min size gridplane that will be created, like nothing smaller than 2x2 or 3x3 depending on what you want.

so anyone up for this challenge?

if so i will love you eternaly
script_3.jpg

Replies

  • Rhinokey
    Options
    Offline / Send Message
    Rhinokey polycounter lvl 18
    oh, and if it would work in max 2009 that would be amajor pluss since thats what i am stuck workin in
  • Scruples
    Options
    Offline / Send Message
    Scruples polycounter lvl 10
    Have you tried Greeble?.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    sounds like vector shape to pixel rasterization. You figure first out the pixels (or blocks in your case) do fit within the vector shape. After that one tries to find rectangular clusters of them with 1 pixel spacing between them.
    You didn't really clarify what those clusters are, like if they really were the maximum possible area within a rectangular collection then your example doesn't fit. So I assume it would be some kind of harmony distribution with a few big and a few small ones if possible.

    There are some voxel scripts out there, i did one too some time ago. Something like that might be a good start rasterizing the topogly of the flat initial surface into grid clusters.
  • Rhinokey
    Options
    Offline / Send Message
    Rhinokey polycounter lvl 18
    (UPDATE THE CREATED PLANES DO NOT NEED ANY SEGMENTS)

    scruples, and Rhjs grid planes need to be lined up with the max grid, and need to be efficient to get thefewwest planes possible to fill up an area (yes my example up top is not perfectly efficient) the planes also need to have verts every .5 meters snapped to max grid.

    the grid is the most important here, these grids are replaced withpoint helpers on export at every vert. that allow other objects to snap to this surface in game.

    so in this example script_4.jpg
    the red circle represents the area i need to be noded. so first the script would look and figure out the largest area a grid plane can be placed while sticking to the .5 grid and places it with a segment every half meter (that is the pink gridplane)

    then with say it limited to a 2 grid min (it will not make any grides smaller than 2x2)
    it looks for the next largest area it can place a grid plane, in my example the 2 purple ones are the same size so it doesnt matter where it goes first. after those 2 the object is filled up, theres no more spaces that a 2x2 grid can be placed (must stay one grid from other planes, and not go out side of selected shape.

    during export each vert on these gridplanes will be replaced with a point node that allows objects to be snapped to this surface. (thats why the planes must be spaced apart or there will be double points where 2 verts share a grid point.

    sorry this is a bit of a confusing request. trying to make it as clear as i can.
  • commander_keen
    Options
    Offline / Send Message
    commander_keen polycounter lvl 18
    What is the data actually used for? This way or generating grid points in a shape seems really strange and I cant imagine why it would be desired over simply checking if each grid point is within the shape and adding a point if it is.
    Rhinokey wrote: »
    during export each vert on these gridplanes will be replaced with a point node that allows objects to be snapped to this surface. (thats why the planes must be spaced apart or there will be double points where 2 verts share a grid point.

    This makes me think its used for something like an valid building placement grid for an RTS or something.
  • Rhinokey
    Options
    Offline / Send Message
    Rhinokey polycounter lvl 18
    CORRECTION i was mistaken in one aspect, the planes do not need to be segmented, just one large 2 tri plane, no segments.

    keen its used to generate nodes for placing housing items in a zone, like dressers, trees statues and whatever. we end up with about 50k nodes in a file an that really hurts max's preformance, so we have a script that takes planes like this in max, and upon export ads the helper points every .5 meters and deletes the planes. the planes are much more max friendly than 50thousand helper points.

    currently we have to go in by hand and hand snap the planes all over all the flat surfaces of a zone, which can take a while.

    again this may be a horibly complex script, and not worh the time. but just figured i'd ask.
  • commander_keen
    Options
    Offline / Send Message
    commander_keen polycounter lvl 18
    That doesnt justify this strange way of representing 2d point data. It seems like the system was designed with the idea that there would only be rectangle layouts, but now it requires other shapes and you are trying to add layers of complexity on top of the current system to get it to do what you want.

    From what I understand the desired result is a bunch of points that represent the internal area of a shape.

    What your current work flow is doing:
    Create 2d vector shape
    Try to fill this shape with a bunch of axis aligned squares
    Fill each of these squares with grid aligned points

    A much easier way to generate the points:
    Create 2d vector shape
    For each possible grid point check if it is inside the shape


    You could go even further and not have point data at all. Because the points are on the grid you dont actually have to store any points, you just have to store where points can and cant exist, in this case a vector shape as an exported mesh.

    In the engine you have objects placed on the grid while checking that each grid point occupied by the object is within the shape. That can really easily be done by raycasting the mesh at each occupied grid point. Something like this would take like 10 minutes to setup if you have a good physics/raycast api.
Sign In or Register to comment.