Home Technical Talk

Maxscript Idea: Sort Alpha Order

polycounter lvl 9
Offline / Send Message
felipefrango polycounter lvl 9
I keep reading how often people have problems when displaying alpha transparency on Max's viewport. As far as I know it is dependant on the order you create the objects, right? If that's the case couldn't there be a script that would recreate your scene objects on a specific order?

Now, I'm not sure in what order you'd need to create the objects, but as far as I remember you need to create those that are far first, then the ones closest to the camera. I'm not a maxscript expert but if you could measure an objects distance to, say, a camera, then - from the farthest to the closest - clone the objects and delete the originals or something to that effect, that could get rid of the issue, right?

Anyway, not even sure it's possible, just throwing it out there.

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    I used to have this script. I'll try to dig it up.
  • felipefrango
    Options
    Offline / Send Message
    felipefrango polycounter lvl 9
    @perna: Hmm, interesting. But you had to select every object and run the script on each one separately, manually selecting the order, right? It'd be great if it could be done in a one-click automated way, but for that you have to be able to measure the distance of the objects to a certain reference and, since I'm not a programmer, I don't know how it's done (or if it's even possible).
  • felipefrango
    Options
    Offline / Send Message
    felipefrango polycounter lvl 9
    Oh cool! I know a few things here and there but my knowledge is very limited and basic, buit I think I could pull it off. Thanks for the help! :D
  • monster
    Options
    Offline / Send Message
    monster polycounter
    Couldn't find it, so I wrote it again. It doesn't delete and recreate objects. It simply links everything to a temp dummy in the order you specify and then deletes the dummy. I don't know if this works for the viewport alpha. But the alpha sorting for a couple of game engines I used needed the objects to be sorted this way.

    reorder.png


    Download here:
    http://www.juantwo.com/scripts/Martinez_Macro_ReOrderObjects.zip

    Unzip the file and place it in this folder:
    C:\Program Files\Autodesk\3ds Max 2009\ui\macroscripts
    Restart 3D Max
    Look in the monsterBlues category to bind to a hot key or toolbar.
    It's called ReOrder Objects.
  • felipefrango
    Options
    Offline / Send Message
    felipefrango polycounter lvl 9
    Damn, that was quick! Thanks a lot man, gonna try it out, I'm sure this will be useful to the community as a whole. I wish I had dedicated some time to learn a bit more scripting, it can be so useful at times.
  • throttlekitty
    Options
    Offline / Send Message
    When I was taking apart model files for Oblivion, I noticed they have some manner of script they used on hair models. Part of the vertex colors (green channel, i think) were used somewhere in the process to sort the planes out, sounded like a handy way to do things. It looked scripted based on the values used, I'd love to know more about that script.
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    what about the geometry within an object? would be much more fiddly - having to store all the smoothing, detach all the faces and re-attach them based on their distance from the camera - I don't fancy doing that myself! :D
  • felipefrango
    Options
    Offline / Send Message
    felipefrango polycounter lvl 9
    Yeah, seems interesting indeed, but I've got NO idea how it could be done. I think it could be like, you would select the face groups manually and store them in the order you choose manually, then apply the reordering function, I'm not sure it can be more automated than that.
Sign In or Register to comment.