Select to view content in your preferred language

Changing specific material of imported objects to iRay glass

470
0
05-30-2023 01:50 PM
Labels (1)
Brianbabu
New Contributor

Hello,

I'm trying to create a rule that changes a specific materials of an imported object to iRay glass. I've created the below but I get errors. I have a model with imported and generated buildings. I need to change the properties of the imported model glass material to iRay glass for visual richness in the online viewer.

 

/**
* File: iRay glass.cga
* Created: 30 May 2023 19:40:52 GMT
* Author: babu
*/

version "2022.1"

@StartRule
Lot -->
case File == "data/OKM_Buildings_FULL-data" and Material == "71F75542E215074EBCEE8591C1107B0ED3A0A9F8":
Glass_Material
else:
# Other rules for non-glass materials or default behavior
...

Glass_Material -->
case Glass_Material == "iRay Glass":
comp(f) { # Set the iRay glass material properties
color(0.35, 0.37, 0.5)
set(material.specular.r, 0.8)
set(material.specular.g, 0.8)
set(material.specular.b, 0.8)
set(material.reflectivity, 0.8)
set(material.shininess, 128)
set(material.opacity, 0.8)
# Additional rules or operations specific to glass material
GlassPanels
}
else:
# Rules for other materials or default behavior
...

 

Attached is a screenshot of the model. Building in the foreground is generated using CGA rules. The glass has reflective and transparency. The building in the background are imported File GDB. Glass material lacks glass qualities.

Tags (3)
0 Kudos
0 Replies