• Stars
    star
    2,788
  • Rank 16,339 (Top 0.4 %)
  • Language
    JavaScript
  • License
    BSD 2-Clause "Sim...
  • Created over 11 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A WebGL graphic library for building scalable Web3D applications

ClayGL

NPM Version Circle CI

ClayGL is a WebGL graphic library for building scalable Web3D applications.

It's easy to use, configurable for high-quality graphics. Benefit from the modularity and tree shaking, it can be scaled down to 22k(gzipped) for a basic 3D application.

Download

API

Examples

Projects

ECharts GL

Clay Viewer

DOTA2 Hero Viewer

Paper Cut Art Generator

Little Big City

Quick Start

Create a rotating cube
<!DOCTYPE html>
<html lang="en">
<head>
  <script src="lib/claygl.js"></script>
</head>
<body>
  <canvas id="main"></canvas>
  <script>
    clay.application.create('#main', {

      width: window.innerWidth,
      height: window.innerHeight,

      init(app) {
        // Create camera
        this._camera = app.createCamera([0, 2, 5], [0, 0, 0]);

        // Create a RED cube
        this._cube = app.createCube({
            color: '#f00'
        });

        // Create light
        this._mainLight = app.createDirectionalLight([-1, -1, -1]);
      },
      loop(app) {
        this._cube.rotation.rotateY(app.frameTime / 1000);
      }
    });
  </script>
</body>
</html>

Minimum bundle example

This example is about 22k(gzipped) after bundled by webpack 4.0. It draws a triangle on the screen.

import { Renderer, GeometryBase, Shader, Material } from 'claygl';

const vsCode = `
attribute vec3 position: POSITION;
void main() {
    gl_Position = vec4(position, 1.0);
}
`;
const fsCode = `
void main() {
    gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
}
`;

const renderer = new Renderer({
    canvas: document.getElementById('main')
});
renderer.resize(400, 400);

const geometry = new GeometryBase();
geometry.createAttribute('position', 'float', 3);
// Add triangle vertices to position attribute.
geometry.attributes.position.fromArray([
    [-0.5, -0.5, 0],
    [0.5, -0.5, 0],
    [0, 0.5, 0]
]);

const material = new Material({
    shader: new Shader(vsCode, fsCode)
});
renderer.renderPass([ { geometry, material } ]);

FBX to glTF2.0 Converter

Get it

Needs python3.3 and FBX SDK 2018.1.1.

usage: fbx2gltf.py [-h] [-e EXCLUDE] [-t TIMERANGE] [-o OUTPUT]
          [-f FRAMERATE] [-p POSE] [-q] [-b]
          file

FBX to glTF converter

positional arguments:
  file

optional arguments:
  -h, --help            show this help message and exit
  -e EXCLUDE, --exclude EXCLUDE
            Data excluded. Can be: scene,animation
  -t TIMERANGE, --timerange TIMERANGE
            Export animation time, in format
            'startSecond,endSecond'
  -o OUTPUT, --output OUTPUT
            Ouput glTF file path
  -f FRAMERATE, --framerate FRAMERATE
            Animation frame per second
  -p POSE, --pose POSE  Start pose time
  -q, --quantize        Quantize accessors with WEB3D_quantized_attributes
            extension
  -b, --binary          Export glTF-binary
  --beautify            Beautify json output.
  --noflipv             If not flip v in texcoord.

Input:

  • FBX
  • COLLADA
  • OBJ

Output:

  • Scene hierarchy
  • Mesh and camera
  • PBR material
  • Texture
  • Skin
  • Animation

More Repositories

1

little-big-city

JavaScript
809
star
2

clay-viewer

3D model viewer with high quality rendering and glTF2.0/GLB export
JavaScript
767
star
3

dota2hero

Online Dota2 hero viewer based on WebGL
JavaScript
447
star
4

oidn-web

Open Image Denoise on the Web
TypeScript
215
star
5

starbucks

Starbucks locations represented by echarts map
HTML
182
star
6

geometry-extrude

A small and fast library for extruding 2D polygons and polylines to 3D meshes
JavaScript
179
star
7

paper-quilling-art

https://pissang.github.io/paper-quilling-art/
JavaScript
173
star
8

voxelize-image

JavaScript
126
star
9

papercut-box-art

Generate a paper cut art in few clicks!
JavaScript
112
star
10

emage

WebGL based image processing library
JavaScript
91
star
11

echarts-x

Extension pack of ECharts providing 3d plots and globe visualization
JavaScript
52
star
12

dfatool

JavaScript Data Flow Analyze Tool
JavaScript
47
star
13

claygl-advanced-renderer

Advanced rendering pipeline for ClayGL
JavaScript
45
star
14

worldcup-intro

World Cup 2014 intro movie
JavaScript
31
star
15

echarts-factory

TypeScript
25
star
16

lottie-parser

Parsing lottie files and display it in the Apache ECharts.
TypeScript
22
star
17

geometry-extrude-example-threejs

JavaScript
21
star
18

echarts-www-landing-animation

TypeScript
18
star
19

qtek-bootcamp

Bootcamp demo of qtek
JavaScript
17
star
20

undersea

Undersea rendering with WebGL
JavaScript
14
star
21

slides

JavaScript
13
star
22

claygl-examples

Examples of ClayGL
JavaScript
13
star
23

lottery

Lottery
JavaScript
12
star
24

bkgraph

人物图谱前端樑板
JavaScript
12
star
25

echarts-next

JavaScript
11
star
26

liquidfun-demo

JavaScript
11
star
27

qtek-physics

Physics compoment of qtek
JavaScript
11
star
28

echarts-worker

JavaScript
10
star
29

qtek-2d

2d rendering component of qtek
JavaScript
9
star
30

curlnoise-2d

2D Curlnoise Example of ClayGL
JavaScript
6
star
31

colorful-stream

JavaScript
5
star
32

lowpoly

Realtime lowpolify
JavaScript
5
star
33

oidn-web-example

Example of oidn-web
JavaScript
5
star
34

pissang.github.io

HTML
4
star
35

parametric-surface-fun

JavaScript
4
star
36

qtek-app

3D application framework based on qtek
JavaScript
4
star
37

moodymusic

Music Classification By Mood
JavaScript
4
star
38

qtek-editor-DEPRECATED

A scene editor for three.js
JavaScript
4
star
39

epage

Web based page editor
JavaScript
3
star
40

webgl-library-benchmark

JavaScript
2
star
41

hierarchy

JavaScript
2
star
42

squares

JavaScript
2
star
43

grapher.js

Simple 3d plots library
JavaScript
2
star
44

seajs-plugin-aop

AOP plugin for SeaJS
JavaScript
1
star
45

echarts-doc-public

Deploying experimental echarts docs
HTML
1
star
46

claygl-docs

Documentation of ClayGL
HTML
1
star
47

geometry-extrude-example-regl

JavaScript
1
star
48

claygl.xyz

ClayGL official website
JavaScript
1
star
49

echarts-www-spa-boilerplate

Boilerplate for creating a SPA tool page that can be integrated in Apache ECharts website.
HTML
1
star
50

doubi

JavaScript
1
star