This is brunch skeleton for starting a project in WebGL with Three.js and ES2016.
- Install (if you don't have them):
- Create a new project :
- Deploy with brunch :
brunch new myapp --skeleton https://github.com/seigler/brunch-threejs
- create new project
- Or use git to clone the brunch-threejs repository :
git clone https://github.com/Jeremboo/brunch-threejs
- Deploy with brunch :
- Download dependencies :
npm run deploy
ornpm install && npm start
npm start
orbrunch watch --server
to watch the project with continuous rebuild.npm run prod
orbrunch build --production
to build minified project for production.
-
Like brunch basic skeleton :
public/
dir is fully auto-generated and served by HTTP server. Write your code inapp/
dir.- Place static files you want to be copied from
app/assets/
topublic/
.
-
Specific to this skeleton :
-
You can use this dir
/app/js/components/
for your THREE.object3D components. For my part, I create one component for each 3D object. There is an example of a 3D object in this dir (Example.js
) to show how you can create a THREE.object3D with ES2015. -
/app/js/shaders
contains fragments and vertex.glsl
files. If you need to use some.glsl
file for build aShaderMaterial
, you can import these files. Look atExample.js
for more details. -
The directory
/app/js/core/
contains:Webgl.js
initializes the 3D scene and the camera.Loop.js
manages frame animation for each update of 3Dobjects.props.js
contains all variables of settings to be uses in all other files. It's specially created to be used by dat.gui
-
/app/js/main.js
puts these together to animate a 3D object. -
I also added EffectComposer for post processing.
-
-
Jérémie Boulay whose threejs skeleton I forked to get this one.
-
Valentin Daguenet and his repository Threejs-starter-kit.
-
Florian Zumbrunn for his starter kit during his Three.js workshop at Gobelins, l'école de l'image.