diff --git a/src/materials/SubSurfaceMaterial.js b/src/materials/SubSurfaceMaterial.js index efac4d2..f6cebbe 100644 --- a/src/materials/SubSurfaceMaterial.js +++ b/src/materials/SubSurfaceMaterial.js @@ -1,9 +1,8 @@ import { Color, ShaderMaterial as TShaderMaterial, UniformsUtils } from 'three'; import SubsurfaceScatteringShader from './SubsurfaceScatteringShader.js'; -import ShaderMaterial from './ShaderMaterial'; export default { - extends: ShaderMaterial, + inject: ['three', 'mesh'], props: { color: { type: String, default: '#ffffff' }, thicknessColor: { type: String, default: '#ffffff' }, @@ -16,6 +15,13 @@ export default { opacity: { type: Number, default: 1 }, vertexColors: { type: Boolean, default: false }, }, + created() { + this.createMaterial(); + this.mesh.setMaterial(this.material); + }, + unmounted() { + this.material.dispose(); + }, methods: { createMaterial() { const params = SubsurfaceScatteringShader; @@ -41,5 +47,8 @@ export default { }); }, }, + render() { + return []; + }, __hmrId: 'SubSurfaceMaterial', };