Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

WebGL2.0 3D Engine - Global Illumination - RayTracing

License

NotificationsYou must be signed in to change notification settings

but0n/Ashes

Repository files navigation

image

Build Status

  • Pressk to toggle render mode
  • Pressq ande to adjust aperture (depth of field)
  • Pressa andd to focal length
  • Press[ andd] to adjust exposure

Examples

Features

ezgif-4-e4c6f3cb3183

  • Entity–component–system (ECS) architectural
  • glTF support
  • Physically based rendering (PBR)
  • Post effects (WIP)
  • Skeleton animation
  • Keyframe animation
  • HDR

Getting Started

  • via CDN
<scriptsrc="https://cdn.jsdelivr.net/npm/ashes3d/build/ashes.main.js"></script>
  • via npm
npm i ashes3d

Usage

Try it

let{ Asset, EntityMgr, Camera, vec3, quat, Screen, OrbitControl, MeshRenderer, Filter, Shader, Material, QuadMesh}=Ashes;letCDN='https://but0n.github.io/Ashes/'Material.SHADER_PATH=CDN+Material.SHADER_PATH;// DamagedHelmetletgltf=CDN+'gltfsamples/DamagedHelmet.glb';asyncfunctionmain(){letscreen=newScreen('#screen');screen.bgColor=[0.2,0.2,0.2,1];letskybox=awaitAsset.loadCubemap(CDN+'res/envmap/GoldenGateBridge2/');letscene=EntityMgr.create('root - (Click each bar which has yellow border to toggle visible)');// CameraletmainCamera=EntityMgr.create('camera');letcam=mainCamera.addComponent(newCamera(screen.width/screen.height));// Set default positionletcameraTrans=mainCamera.components.Transform;vec3.set(cameraTrans.translate,0,10,10);// Add it to scenescene.appendChild(mainCamera);// Attach controlermainCamera.addComponent(newOrbitControl(screen,mainCamera));document.querySelector('body').appendChild(scene);// Load a gltf modelletgltfroot=awaitAsset.loadGLTF(gltf,screen,skybox);scene.appendChild(gltfroot);}main();

Create a quad with texture

// Create an entityletquad=scene.appendChild(EntityMgr.create('quad'));// Load a materialletquadMat=awaitAsset.LoadMaterial('stylize');// PBR material// Load a textureletfloor=awaitAsset.loadTexture(CDN+'res/textures/floor.png',{minFilter:screen.gl.NEAREST_MIPMAP_NEAREST});floor.flipY=true;// Attach texture to material we createdMaterial.setTexture(quadMat,'baseColorTexture',floor);quadMat.shader.macros['HAS_BASECOLOR_MAP']='';// Create a renderer componentletquadMR=newMeshRenderer(screen,newQuadMesh(),quadMat);// Attach renderer to entityquad.addComponent(quadMR);// Set local translate [x, y, z]quad.components.Transform.translate[1]=-1;// Set euler angle x, y, zquat.fromEuler(quad.components.Transform.quaternion,-90,0,0);// The original size of quad is 2x2vec3.scale(quad.components.Transform.scale,quad.components.Transform.scale,9);

Deployment

git clone --recursive https://github.com/but0n/Ashes.gitcd Ashes# if you don't have yarn installednpm install -g yarnyarnyarn dev

[8]ページ先頭

©2009-2025 Movatter.jp