Export Mesh and Material Granularity

1301
4
02-24-2012 07:25 AM
AndréCardoso
New Contributor III
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.
0 Kudos
4 Replies
by Anonymous User
Not applicable
Original User: matthiasbuehler

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.
0 Kudos
AndréCardoso
New Contributor III
Yup, I did work with that. Actually, currently that is my only option to create "identifiers" for each picking box:
...
...
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.


matthiasbuehler;176484
0 Kudos
by Anonymous User
Not applicable
Original User: matthiasbuehler

it seems you're working with imports, right ?
0 Kudos
AndréCardoso
New Contributor III
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?


matthiasbuehler;177071
0 Kudos