+ Reply to Thread
Results 1 to 5 of 5

Thread: Export Mesh and Material Granularity

  1. #1
    André Cardoso
    Join Date
    Oct 2011
    Posts
    69
    Points
    2
    Answers Provided
    0


    0

    Question Export Mesh and Material Granularity

    Hello

    I have a sort of a vague question:
    - does it make sense to allow a more specific material and mesh granularity options in CE.
    I'm not on a comfortable zone here, as I'm no 3D expert... please bear with me with me. Nevertheless, consider the the pictures attached.

    The building has "picking boxes" around each floor. For the purposes of the application we're working on, each picking box mesh must have a unique ID. However, the picking box material is exactly the same.
    The second picture is how the building is imported into Unity3D. It shows different meshes and materials.

    The building was exported with "merge by material".

    In this specific case, I would like to:
    - have only 1 mesh for everything that is *not* a picking box;
    - have only 1 material for the picking boxes (less materials, means less "draw calls" on Unity, means better application performance)
    - have different meshes for the picking boxes, uniquely identified.

    I think this is not possible within CE. Is it?
    But I think it makes sense at least to allow to merge everything into one single mesh? However, no such option exists within the exporter.

    What do you think about this? All of these things relate to performance issues on game engines.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	building.jpg‎
Views:	103
Size:	83.8 KB
ID:	12214   Click image for larger version

Name:	fbx_meshes_n_materials_CE.png‎
Views:	65
Size:	12.9 KB
ID:	12215  

  2. #2
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,683
    Points
    441
    Answers Provided
    142


    0

    Default Re: Export Mesh and Material Granularity

    hi !

    did you work with
    set(material.name, "matName")
    ?

    did you work with the option
    create shape groups ?

    * * *

    there's rules which define when exactly a new material is created in the CE. that usually is if some of the attributes have changed.

    so, make sure that your pick box material go thru the exact same rules and get the exact same material settings & naming.


    not all of the material / mesh merging combinations are possible with the CityEngine, thus it may make sense to post process them with a series of scripts in an other 3d app (such as Maya).

    * * *

    please note also that if you export 'one file per shape', the material merging only works per shape. e.g. the absolute same materials will not be merged over multiple files.
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  3. #3
    André Cardoso
    Join Date
    Oct 2011
    Posts
    69
    Points
    2
    Answers Provided
    0


    0

    Default Re: Export Mesh and Material Granularity

    Yup, I did work with that. Actually, currently that is my only option to create "identifiers" for each picking box:
    Code:
    ...
    ...
    FloorPickingBox(splitTotal, floorIndex) -->
    	case floorIndex < splitTotal - 1:
    		set(material.opacity, 0.5)
    		misc.SetMaterial(FLOOR_PICKING_BOX_NAME + 
    				"__" + floorIndex + "__" +
    				listItem(FLOOR_PICKING_BOXES_UUIDS, floorIndex))
    	else:
    		s('1, '2, '1)
    		set(material.opacity, 0.5)
    		misc.SetMaterial(FLOOR_PICKING_BOX_NAME + 
    				"__" + floorIndex + "__" +
    				listItem(FLOOR_PICKING_BOXES_UUIDS, floorIndex))
    ...
    ...
    # misc.cga
    SetMaterial(name) -->
    	set(material.name, name)
    	TerminalMaterial.
    I'm calling set(material.name, "name") all the time, to make sure that on the "other side" I can query things...
    The "create shape groups" does not do anything that I find relevant. It only organizes the meshes in a hierarchical manner.


    But let me tighten the scope of my question:
    - given the example in the code above, is there a way to end up with a one single material for all the picking boxes, but meshes with different names (after importing into Unity)?
    The way I have been doing it, I get different named meshes And different materials.


    Quote Originally Posted by matthiasbuehler View Post
    hi !

    did you work with
    set(material.name, "matName")
    ?

    did you work with the option
    create shape groups ?

    * * *

    there's rules which define when exactly a new material is created in the CE. that usually is if some of the attributes have changed.

    so, make sure that your pick box material go thru the exact same rules and get the exact same material settings & naming.


    not all of the material / mesh merging combinations are possible with the CityEngine, thus it may make sense to post process them with a series of scripts in an other 3d app (such as Maya).

    * * *

    please note also that if you export 'one file per shape', the material merging only works per shape. e.g. the absolute same materials will not be merged over multiple files.

  4. #4
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,683
    Points
    441
    Answers Provided
    142


    0

    Default Re: Export Mesh and Material Granularity

    it seems you're working with imports, right ?
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  5. #5
    André Cardoso
    Join Date
    Oct 2011
    Posts
    69
    Points
    2
    Answers Provided
    0


    0

    Default Re: Export Mesh and Material Granularity

    Yup,

    I tend to try to keep "common" rules or operations on a separate file. It becomes handy when you have multiple projects... a "ln -s" does wonders

    But I think you can ignore that. Do you think it is possible to do what I proposed, when exporting to FBX and importing on Unity? If yes, can you give me a very simple example?


    Quote Originally Posted by matthiasbuehler View Post
    it seems you're working with imports, right ?

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts