npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aframe-hologram-shader

v1.0.1

Published

An A-Frame shader for creating stylized holograms from images and videos

Downloads

96

Readme

A-Frame Hologram Shader

Interactive Demo

Description of Effect

This shader corrupts an image or video texture to make it look like a hologram. There are three main effects applied:

  1. The texture can be made transparent and desaturated.
  2. Scan lines (dark horizontal lines) are drawn on the image. These scanlines slowly drift down the hologram.
  3. Glitch effect: The texture is broken up vertically into equal-height "glitch bars". Each glitch bar is randomly shifted horizontally to create a jittering effect. After the horizontal shift, each of the RGBA components of the glitch bar are further randomly shifted to create a "glitch" effect. The boundaries between glitch bars slowly drift down the hologram.

Installation

You can use aframe-hologram-shader in your project in two ways. First, you can simply include the following script tag after the script that loads a-frame:

<script src="https://unpkg.com/aframe-hologram-shader"></script>

This will automatically register the hologram shader.

Alternatively, you can install the package using npm by executing

npm install aframe-hologram-shader

and then in your project you will need to either include or require the aframe-hologram-shader package.

Example Usage

Once aframe-hologram-shader is installed, you can apply the shader to an image or video in your a-frame scene by setting the material's shader attribute to be hologram. The other parameters of the shader (described below) are also set on the material component. For example:

<html>
  <head>
    <title>Hologram</title>
    <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-hologram-shader"></script>
  </head>
  <body>
    <a-scene background="color: #ECECEC">
      <a-assets>
        <img id="demo" src="[path to your image]" crossorigin="anonymous" />
      </a-assets>
      <a-image
        src="#demo"
        position="0 1.6 -1"
        material="shader: hologram;
                         numGlitchBars: 20"
      >
      </a-image>
    </a-scene>
  </body>
</html>

Configurable Parameters

The following parameters can be used to customize the effect. You can play with their values in the interactive demo.

| Parameter | Type | Description | | -------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | src | map | Texture to display on the hologram. Can be an image or video. | | numScanLines | int | The number of scan lines to draw on the texture. | | scanLineDrift | float | The speed that the scanlines move down the texture. Should be a number in [0,1] which is the fraction of the hologram each scanline moves per second | | saturation | float | The saturation of each fragment in the HSV color space is scaled by this value. A value of 0 makes the hologram grayscale, while a value of 1 leaves the saturation unmodified. | | alpha | float | The alpha value of each fragment is multiplied by this parameter. Values of 0 and 1 result in completely transparent and opaque holograms, respectively. | | numGlitchBars | int | The number of glitch bars to use in the effect. | | glitchOffset | float | Maximum horizontal offset for each glitch bar. Should be a number in [0,1], which is the maximum fraction of the holgoram width that each glitch bar can move. | | glitchBarDrift | float | Similar to the scan line drift, except it causes the boundaries of the glitch bars to move. | | rgbSeparation | float | Similar to glitchOffset, except this is the maximum shift for each of the RGBA components. | | glitchRate | float | How many times per second to update the glitch effect. |


This component was developed in partnership with Planet Voodoo® (Voodoo LLC) as part of their 'WebXR Wizardry' initiative.