A-Frame VR component for using the THREE.MeshNormalMaterial as a material on a component. The MeshNormalMaterial is a material that maps the normal vectors to the RGB colors.
It currently has all the defaults for the material as defined in the Three.js Docs.
Using NPM
npm install aframe-normal-material
require('aframe-normal-material')
AFRAME.registerComponent('normal-material', {
multiple: true,
init: function (){
var material = new THREE.MeshNormalMaterial();
var geometry = this.el.getObject3D('mesh').geometry;
this.el.setObject3D('mesh', new THREE.Mesh(geometry, material));
},
remove: function(){
this.el.removeObject3D('mesh');
}
});
<a-box height="5" width="5" depth="5" normal-material></a-box>