Home Unity

Modular environment and vertex coloring

polycounter lvl 8
Offline / Send Message
Mant1k0re polycounter lvl 8
I'm probably going to be called names for asking this but...

I was checking out this video on planning and making modular environments and the author is showing a modular city he made (at 32') mentioning vertex coloring.

I don't understand how this can work for a modular set; if you're painting vertex in your 3d package on piece X then all instances of piece X will have the same vertex color information inside of Unity, correct? Then how did he achieve the subtle variation he's tlking about in his video, I'm confused.

Thanks!

Replies

  • amartinez
    Offline / Send Message
    amartinez polycounter lvl 8
    Agreed, maybe it's easier for 'building and constructing your scene' modular wise, but as soon as one object has a different vertex color it's not the same vertex data, hence unique and not the same instance.

    Unless there is some shader instancing vertex stream magic trick that ONLY changes the vertex color data per model, only paying the cost of the extra vertex color data and not the complete info (position, normal, uv, etc).
  • botanika
    Offline / Send Message
    botanika polycounter lvl 3
    What I usually do, is I export my meshes with black vertex colors from my 3d modeling app, and then I paint them in unity using this free tool from Synoptic entertainment : http://www.synoptic-entertainment.com/downloads/item/56-unity3d-advanced-vertex-painter

    in some other occasions, I export painted meshes from my 3d package, and use a simple script that clone the meshes, and alter their vertex colors .
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 8
    Thank you both for answering!

    More noob questions:

    @Botanika, that sounds like what I'm trying to do (the simple script approach).

    Could you detail your workflow a little bit?


    At what point do you use that scripts? What happens to the clones - are they considered as new meshes, are they still considered as instances of the first one by Unity?

    The vertex info alteration is random? etc.
  • botanika
    Offline / Send Message
    botanika polycounter lvl 3
    As far as I know, Unity doesn't support geometry instancing, so having multiple vertex painted meshes in the scene shouldn't be more expensive than reusing the original mesh (beside the build file size).

    In my tests . all the painted clones that are using the same material can be batched into 1 drawcall, witch is great for adding variations to your level for cheap (almost free).

    my workflow is pretty straightforward :
    >I model my modular meshes in 3ds max, assign different vertex colors to each of the elements of the mesh. and export them to unity as an fbx.
    >Bring my pieces into the editor, recolor them with a script, and build the level.
    > do another pass with synoptic vertex painting tool, and paint some dirt and scratches to add more variation.



    If you want, you can try my script and see if it fits in your workflow, just make sure to create a folder with the name "Editor" in your project directory, and place this file inside of it.
    https://drive.google.com/file/d/0B3n1sS2Im_HhVTRBbmNoVU83NDQ/edit?usp=sharing


    Vertex Colors in 3ds Max.
    VP1.JPG


    the same mesh in unity with a vertex color unlit shader applied.
    VP2.JPG


    you can access the script from : Window > Mesh Painter.

    it automatically process all the mesh's vertices, and find the colors originally painted on the mesh.
    VP3.JPG


    you can then change the color of any of the elements of the teapot. and save the mesh as a new.
    VP4.JPG


    Ps : You can recolor multiple meshes at once, by selecting them all, and ticking the "link Meshes" checkbox, this is especially useful for painting meshes with multiple Lods.



    Here is a modular level study I did a while back in Unity.

    https://8dd9ebc876e38ff771991a3034cc44b1b97f45cc.googledrive.com/host/0B3n1sS2Im_HhZW83ak9TWHFMWFU/full%20resolution.html

    this small scene uses a total of 3 materials(glass, decals, and one for everything else), all the variations are done with the technique demonstrated above.


    sorry for my bad English.
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 8
    Thank you so much for sharing all this, Botanika :)

    I'll let you know how it goes. I really like your level, in any case!
Sign In or Register to comment.