New material system.

Patrick and I have been designing and implementing a new material system that is just about ready to go into master. The main feature of this system is called Fabric, a JSON schema that lets the user customize and combine materials to form cool effects like crumbling bricks or a reflective plastic appearance (and much, much more). Since everything is specified in JSON, there is no longer a need to create individual javascript files for each new material.

To test it out, go to the visualquality branch and run sandbox. There are several examples on the side that can be customized in real time. Also, make sure to read the wiki page to learn how everything works.

The branch is currently going through a pull request, so all feedback is appreciated!

To follow up:

  • We are interested in feedback on both the code itself and the JSON schema.
  • Materials can be applied to polygons and sensors. We have plans to add them to polylines, and future primitives: ellipsoids, cylinders, boxes, etc.
  • The current CZML strategy of supporting just color and image materials is good. Longer term, we can consider a Fabric extension to CZML, but I don’t suggest we make it a requirement for the core CZML spec. The OpenGL/WebGL dependency and implicit dependency on our built-in GLSL uniforms, constants, and functions, will make the barrier to implementing CZML too high for SVG clients, etc.



Some other comments:

  • Dan and I will soon add the ability to render cube maps. This will allow some cool effects with the reflection, refraction, and Fresnel materials. For example, imagine a vehicle riding through a valley, with its body reflecting the terrain around it, and it’s windows both reflecting the terrain and refracting the vehicle’s interior. Even better, imagine a translucent and reflective ellipsoid around a satellite so potential collisions are also in the reflection. Disclaimer: cube-map reflections are not as accurate as ray tracing.
  • In addition to the different primitives, materials will also be available to models. Different parts of a model can have different materials.
  • We hope Sandcastle will become a killer authoring environment for quick Cesium API demos, CZML, and Fabric.