Glass Material
Updated
Ready-made see-through glass.
- Type
comp-glass-material- Script class
GlassMaterialComponent- Per entity
- One
- Version
- 2.1.0
Read about it in Materials: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
color |
"#ffffff" |
|
opacity |
0.9 |
0 ≤ x ≤ 1 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Tinted glass in front of the lightA glass cube and a glass ring from the runtime's Glass Lake demo, under an outdoor sky: what stands behind shows through their tint, and the cube steps through clear, sea and amber tints.
Orbit around the glass to see the objects behind it through the tint and the sky reflected at grazing angles. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(GlassMaterialComponent); if (component) log(component.props);}