cityengine 2023.1
I need to create a material to then apply it to the shapes (gcamat)
setMaterial operation—ArcGIS CityEngine Resources | Documentation
Solved! Go to Solution.
Hello @josegudalupemeridajardinez
Thanks for the question.
Just select a CGA Model (or any static model). Then to create .cgamat files you can use the CityEngine CGA Material Encoder option in the File > Export Models... dialog.
Export a model—ArcGIS CityEngine Resources | Documentation
The material descriptions of a CGA model are collected and written into individual subdirectories. Each subdirectory contains all the material—including the used textures—which can be copied into a folder of assets, for example. The name of the subdirectory and the .cgamat file is the material.name attribute but is made unique if there are several materials with the same name.
The <matName>.cgamat file is in CSV format, as is the result of the CGA function: getMaterial(used, changed).
.cgamat files are simple plain text file contain name of material attributes and its value seperated by a comma:
metallic,0 roughness,1 colormap,Textures/Grass_Dry_10x10_Brown_Color.jpg colormap.su,0.1 colormap.sv,0.1 normalmap,Textures/Grass_10x10_Normal.jpg normalmap.rw, 0 normalmap.su,0.1 normalmap.sv,0.1 ...
Note: You can also find some material files in the ESRI.lib under /assets/Materials. Only materials stored here are shown in the Material Browser. ESRI.lib—ArcGIS CityEngine Resources | Documentation
To apply a .cgamat file on a shape, you need to set the path first. Then use the setMaterial operation—ArcGIS CityEngine Resources | Documentation and project the material on every face:
version "2024.1"
@MaterialFile
attr cgaMat = "/ESRI.lib/assets/Materials/Generic/Wood/Wood_Standard_10x10.cgamat"
@StartRule
SetMaterial -->
setMaterial( readMaterial(cgaMat) )
comp(f) { all :
setupProjection(0, scope.xy, 1, 1)
projectUV(0)
Material.
}
Hello @josegudalupemeridajardinez
Thanks for the question.
Just select a CGA Model (or any static model). Then to create .cgamat files you can use the CityEngine CGA Material Encoder option in the File > Export Models... dialog.
Export a model—ArcGIS CityEngine Resources | Documentation
The material descriptions of a CGA model are collected and written into individual subdirectories. Each subdirectory contains all the material—including the used textures—which can be copied into a folder of assets, for example. The name of the subdirectory and the .cgamat file is the material.name attribute but is made unique if there are several materials with the same name.
The <matName>.cgamat file is in CSV format, as is the result of the CGA function: getMaterial(used, changed).
.cgamat files are simple plain text file contain name of material attributes and its value seperated by a comma:
metallic,0 roughness,1 colormap,Textures/Grass_Dry_10x10_Brown_Color.jpg colormap.su,0.1 colormap.sv,0.1 normalmap,Textures/Grass_10x10_Normal.jpg normalmap.rw, 0 normalmap.su,0.1 normalmap.sv,0.1 ...
Note: You can also find some material files in the ESRI.lib under /assets/Materials. Only materials stored here are shown in the Material Browser. ESRI.lib—ArcGIS CityEngine Resources | Documentation
To apply a .cgamat file on a shape, you need to set the path first. Then use the setMaterial operation—ArcGIS CityEngine Resources | Documentation and project the material on every face:
version "2024.1"
@MaterialFile
attr cgaMat = "/ESRI.lib/assets/Materials/Generic/Wood/Wood_Standard_10x10.cgamat"
@StartRule
SetMaterial -->
setMaterial( readMaterial(cgaMat) )
comp(f) { all :
setupProjection(0, scope.xy, 1, 1)
projectUV(0)
Material.
}