3000 shaders on export

658
5
Jump to solution
04-20-2013 03:45 PM
GregDowning
New Contributor
I developed a scene to bring over to Maya, with the intent of creating about 60,000 buildings. I took a small section of it and exported OBJ to bring into Maya and render with Arnold. When I imported the file it created around 3000 shaders.  Since I have to convert all of these default Maya shaders to Arnold aiStandard shader I was wondering if there is a more optimized way to do this, I would think that I would not need more shaders than there are textures.

I would also be interested in any other model or texture optimization recommendations.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor
Hi !


Then it's probably the dirtmaps.

I've checked, there's 17 dirtmaps :

- Note that dirtmaps are not supported in OBJ export. Nevertheless, the material diversification is generated in CE during the model generation process, since exporting is 'post-generating'. If you want to export dirtmaps, use FBX.
- Note that this multiplies the number of materials !
- Note also that the dirtmaps have a different UV-set.

line 150 of pompeii.cga :
const dirtTex    = fileRandom("assets/general/dirtmaps/dirtmap.*.jpg")


Maybe for now, try to just deactivate all dirtmap calls (also, check the other rules) :
set(material.dirtmap, dirtTex)



You'll find that the models look more clean afterwards in CE .

Let me know what comes out.

Matt

View solution in original post

0 Kudos
5 Replies
MatthiasBuehler1
Frequent Contributor
Hi Greg,


be cautious in CGA, you can wind up creating lots and lots of materials !


check your code for :
1]
color( rand(1), rand(1), rand(1))
this creates a new material each time called !

2]
any opacity, reflectivity or other change of the default material settings.

each time that changes, a new material is created, that is also true of the same texture is used.

e.g. a default brick texture material is not the same as a glossy brick texture material.

to create 'random colors', use e.g.
myRandColor = 33% : 1 33% : 0.8 else : 0.6

Lot -->
    color (myRandColor *myRandColor , myRandColor *myRandColor , myRandColor *myRandColor )


or play with similar structures with 'const' values to further break down the variation.


I'm not sure if you're using an existing example or your own code.

Let me know .. ok ?

Matt
0 Kudos
GregDowning
New Contributor
Thanks again Matt, I will look into this next. I was still using the Pompeii example.
0 Kudos
GregDowning
New Contributor
I am using the Pompleii cga rule on a larger city I grew. I checked the maya file again after importing the obj and these materials are identical, they are using the same texture in the same channel.

Is it the random statement that causes it to create a new material for each object? It doesn't have the specific code you mentioned but it does have several "fileRandom" calls for textures.
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi !


Then it's probably the dirtmaps.

I've checked, there's 17 dirtmaps :

- Note that dirtmaps are not supported in OBJ export. Nevertheless, the material diversification is generated in CE during the model generation process, since exporting is 'post-generating'. If you want to export dirtmaps, use FBX.
- Note that this multiplies the number of materials !
- Note also that the dirtmaps have a different UV-set.

line 150 of pompeii.cga :
const dirtTex    = fileRandom("assets/general/dirtmaps/dirtmap.*.jpg")


Maybe for now, try to just deactivate all dirtmap calls (also, check the other rules) :
set(material.dirtmap, dirtTex)



You'll find that the models look more clean afterwards in CE .

Let me know what comes out.

Matt
0 Kudos
GregDowning
New Contributor
Thanks Matt, that was helpful, I was able to reduce it to 600 shaders. I have a few things to track down still as it is still ~6 times the number of textures but it is a much more manageable number now.
0 Kudos