An open API service indexing awesome lists of open source software.

https://github.com/alfa256/aframe-mirror-component

Mirror effect material that works with snapshots of the scene for A-Frame
https://github.com/alfa256/aframe-mirror-component

aframevr threejs vr webvr

Last synced: 3 months ago
JSON representation

Mirror effect material that works with snapshots of the scene for A-Frame

Awesome Lists containing this project

README

          

## aframe-mirror-component

[![Version](http://img.shields.io/npm/v/aframe-mirror-component.svg?style=flat-square)](https://npmjs.org/package/aframe-mirror-component)
[![License](http://img.shields.io/npm/l/aframe-mirror-component.svg?style=flat-square)](https://npmjs.org/package/aframe-mirror-component)

Mirror effect material that works with THREE.CubeCamera snapshots of the scene.

Add it to a mesh and it will change its material for a mirror like effect.

If you use it let me know, I'm @alfredofrlp on twitter.

For [A-Frame](https://aframe.io).

[LIVE DEMO](https://alfa256.github.io/aframe-mirror-component/examples/basic/)
: WASD + mouse to look around.

![Screenshot](./mirror.png "Multiple instances of the component.")

### API

| Property | Description | Default Value |
| ---------- | ---------------------------- | ------------- |
| color | material color | #ffffff |
| resolution | CubeCamera resolution | 128 |
| refraction | material refractionRatio | 0.95 |
| distance | CubeCamera render distance | 3000 |
| interval | snapshot interval | 1000 ms |
| repeat | take snapshot every interval | false |

For a realtime mirror effect I suggest a low resolution ( 32 or 64 ) and an interval of 150 to 300, low distance also helps.
Resolution needs to be a power of 2: 8, 16, 32, 64, 128 ...

#### Browser

Install and use by directly including the [browser files](dist):

```html

My A-Frame Scene



```

#### npm

Install via npm:

```bash
npm install aframe-mirror-component
```

Then require and use.

```js
require('aframe');
require('aframe-mirror-component');
```