Coder Social home page Coder Social logo

akbartus / a-frame-shaderfrog-component-upd Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 84 KB

ShaderFrog Loader Component for A-Frame

Home Page: https://shaderfrog-component.glitch.me/

HTML 6.76% JavaScript 93.24%
a-frame aframevr shaders threejs shaderfrog

a-frame-shaderfrog-component-upd's Introduction

A-Frame Component: ShaderFrog Loader (Upd)

Screenshot

Description / Rationale

This is a component, which allows to load shaders made in ShaderFrog in A-Frame environment. This is the updated version of the component created by MSG121 and is compatible with A-Frame ver. 1.4.1.

Instructions

To see the component at work add "shader-frog" component to an a primitive. The component has the following attributes:

  • src: { type: 'string' } - the url to a json file, exported from ShaderFrog.
  • side: { type: 'string'} - three.js default is single side material, if 'side' set to 'double' then use THREE.DoubleSide

Example implementation is given below:

<html>
<head>
  <script src="https://aframe.io/releases/1.4.1/aframe.min.js"></script>
  <script src="js/aframe-shaderfrog-component.js"></script>
</head>
<body>
  <a-scene>
    <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
    <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
    <a-torus position="0 1 -5" radius="1" shader-frog="src:url(shaders/shader9.json)">
    </a-torus>
    <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
    <a-sky rotation="-180 0 90" shader-frog="src:url(shaders/shader8.json); side: double"></a-sky>
  </a-scene>
</body>
</html>

Please note that not all shaders are supported by this loader. Also, 3d models are not supported. To see some shaders at work, load a shader (already exported from ShaderFrog) from shaders folder. Here is the list of shaders:

    shader0 - Water Shader
    shader1 - Patterns Shader
    shader2 - Blue Glow Shader
    shader3 - Toon Shader
    shader4 - BlackWhite Line Shader
    shader5 - Smoke Shader
    shader6 - Marching Ants Outline
    shader7 - BlueWhite Line Shader
    shader8 - Sky Shader
    shader9 - Fire Shader
    shader10 - Heat Map Shader
    shader11 - Lava Shader
    shader12 - Space Shader
    shader13 - Water Waves Shader

If you want to use other shaders, make sure to select "Export" > "Three.js" in ShaderFrog's environment, which will export shader in JSON file format.

Tech Stack

The project is powered by AFrame and Three.js.

Demo

See demo of the component here: Demo

a-frame-shaderfrog-component-upd's People

Contributors

akbartus avatar kfarr avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

kfarr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.