Skip to content

Instantly share code, notes, and snippets.

@drcmda
Last active January 26, 2017 11:33
Show Gist options
  • Save drcmda/adecbea07d484ca3e6a81eb6368d696f to your computer and use it in GitHub Desktop.
Save drcmda/adecbea07d484ca3e6a81eb6368d696f to your computer and use it in GitHub Desktop.
material, outlining extensible structures for appearance
// ALL material info (including opacity & color) is defined under a generialized "material"
// ALL properties are optional
// color & opacity will be removed from the protocol
material: {
type: BASIC | PHONG | LAMBERT | PHYSICAL | DASHED (lines only)
opacity: 0-1,
color: [0-255, 0-255, 0-255],
fog: true | false, // affected by fog
lights: true | false, // affected by lights
shadows: true | false, // cast/receive shadows
emissive: [0-255, 0-255, 0-255], //(meshes only)
specular: [0-255, 0-255, 0-255], //(meshes only)
opacity: 0-1,
metalness: 0-1, //(meshes only)
roughness: 0-1, //(meshes only)
clearCoat: 0-1, //(meshes only)
clearCoatRoughness: 0-1, //(meshes only)
texture: DEFLATE+BASE64 (png, jpg), //(meshes only)
textureIntensity: 0-1, //(meshes only)
environment: DEFLATE+BASE64 (png, jpg), //(meshes only)
environmentIntensity: 0-1, //(meshes only)
bump: DEFLATE+BASE64 (png, jpg), //(meshes only)
bumpIntensity: 0-1, //(meshes only)
displacement: DEFLATE+BASE64 (png, jpg), //(meshes only)
displacementIntensity: 0-1, //(meshes only)
glow: DEFLATE+BASE64 (png, jpg), //(meshes only)
glowIntensity: 0-1, //(meshes only)
dash: 0-1, //(dashed lines only)
width: 0-1, //(dashed lines only)
scale: 0-1, //(dashed lines only)
gap: 0-1, //(dashed lines only)
}
// Material defined in the parent container will merge with properties defined in a child (f.i. a face).
// If a mesh defines itself as "sparkly glassy transparent", a single face defining itself as "red"
// will appear as "sparkly glassy transparent red".
// Child material properties will always supercede parent properties if they collide.
// Materials can be keyed and stored in a map and linked to by index, thereby reducing material overhead
// Material maps may be placed in the general properties which would then allow styling multiple containers
materials: {
wood: { color: [...], ... },
glass: { color: [...], ... },
...
}
// Later on in a child:
material: "glass"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment