Top Banner
Getting Started with Verold Studio and Three.js 10 March 2014
39
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Getting started with Verold and Three.js

Getting Started with Verold Studio and Three.js10 March 2014

Page 2: Getting started with Verold and Three.js

Your browser can deliver native performance. So why are you still building native apps?

Verold Studio: Publish Interactive 3D to the Web

Page 4: Getting started with Verold and Three.js

App Designer

CG Artist

App publishedto the Web, Mobile,Console, SmartTV

With Verold’s visual online tools, your creative teams build and immediately publish interactive content

Verold Publishing Solution

Page 5: Getting started with Verold and Three.js

● Verold brings the power of a game engine to web design, unlocking the latest features of modern browsers

● Verold is online and collaborative - powering an ecosystem of creators

● Verold integrates seamlessly with web publishing pipelines

● Verold allows you to scale effortlessly

Revolutionizing Web Publishing

Page 6: Getting started with Verold and Three.js

The Verold Studio Editor

Page 7: Getting started with Verold and Three.js

Model Viewer:

● No coding required● Single scene, built-in components● Auto-publish

Apps:

● Fully customizable using HTML/CSS/Javascript editor● Advanced components from Verold and the community● Publish to Verold or download project and host yourself

Project Types

Page 8: Getting started with Verold and Three.js

Editor Layout

Inspector

Your Assets (upload or source from Asset Library)

SceneGraph

CollaborationFeatures

Active Scene

Page 9: Getting started with Verold and Three.js

Publishing Workflow

Create NewProject

Setup Assets & Scenes

(Visual Editor)

DefineBehaviours(Three.js)

Preview

EMBED Projects: Published projects can be marked PUBLIC to be playable in the Explore section of Verold Studio, and embedded elsewhere on the web using the iFrame embed viewer.

API Access: You can add WHITELISTED DOMAINS to your published projects, allowing them to be loaded in whole or in part onto your own website. This is, for example, how we display 3D content on the Verold homepage.

Downloaded Projects: You can download all assets from your projects as a self-contained web application. Host this on your own website, or package it up as a mobile app (e.g. using Cordova).

Publishor Download

As many iterations as you like, solo or with collaborators

Page 10: Getting started with Verold and Three.js

You create components as Javascript objects, and attach them anywhere in the scene graph. The Components API:

init() Invoked immediatelyobjectLoaded() Invoked when target’s hierarchy is loadedupdate() Invoked every frameshutdown() Invoked when the component is unloaded

For example, if you attach a component to a character in your scene, you could move the character by typing: this.getThreeData().position.x += 0.1;

Component-Entity Model

Page 11: Getting started with Verold and Three.js

Components expose Attributes, allowing for easy reuse and streamlined collaboration between developers and the rest of the creative team.

Attributes can be:

Primitives (string, int, float, array, etc)Assets Objects (e.g. Cameras, model instances, prefabs, etc)

When a component is attached to an object in the scene graph, the attributes are made available in a nice UI.

Attributes

Page 12: Getting started with Verold and Three.js

Components can also import third party libraries. Verold provides several out of the box:

● Oculus VR● Leap Motion● NeuroSky● Box2D● Ammo● …

Or add your own. Simply reference the third-party script URL from your component.

Third Party Libraries

Page 13: Getting started with Verold and Three.js

Verold supports all the major transfer formats:

● FBX, Collada, OBJ, PLY, STL

If your model has textures, bundle them in a ZIP file with the model, and upload all together.

For best performance, keep polycount and number of meshes/textures low. Models with millions of polys will run, but not well.

Importing 3D Models

Page 14: Getting started with Verold and Three.js

We support:

● Diffuse (Transparency in the Alpha channel)● Normal● Specular (Gloss in the Alpha channel)● Ambient Occlusion● Others?

When you upload a texture, we generate a DDS compressed texture for you. If you need larger than 2K textures, or your app uses a lot of texture data, consider enabling hardware compression on your texture settings.

Textures

Page 15: Getting started with Verold and Three.js

You can upload skeletal animations as part of your FBX file. Vertex animations are not currently supported.

The editor allows you to break your animation into clips. These can then be triggered through code.

Animations

Page 16: Getting started with Verold and Three.js

Everything in Verold Studio is multi-user and real-time

You can invite collaborators by email. All collaborators have read and write access to the project.

Collaborators can also leave comments and take screenshots in the project.

Collaboration Features

Page 17: Getting started with Verold and Three.js

By default, your project is yours and can only be edited by you. You can choose to make your project “Forkable”, which lets others use your project as a Template. When you make your project Forkable, you should choose an appropriate license:

● No rights reserved: Forkers can do what they like● Attribution: Forkers need to credit you when they use it● Attribution non-Commercial: Your project can only be

used for non-commercial purposes

Forking Projects

Page 18: Getting started with Verold and Three.js

You can organize your assets in folders in the Asset Browser.

You can then upload your folders as Packages to the Asset Library. Packages can be made Private so that only you can use them, or can be shared with the community. As with templates, shared packages should have an appropriate license.

Asset Library

Page 19: Getting started with Verold and Three.js

Scripting Verold with Three.js

Page 20: Getting started with Verold and Three.js

Cloning an object

// Lookup an object by IDvar asset = this.getScene().getObjectById(objectID);

// Clone the objectthis.getScene().createInstance(asset,

{success:function(newAsset){ //add it to the scene scene.addChildObject(newAsset); //set the position newAsset.threeData.position.set(10, 0, 0);}}

);

Page 21: Getting started with Verold and Three.js

Instantiating an asset

// Lookup an asset by IDvar asset = this.getAssetRegistry().getAssetById(assetID);

// Instantiate the asset - Same as cloning an assetthis.getScene().createInstance(asset,

{success:function(newAsset){ //add it to the scene scene.addChildObject(newAsset); //set the position newAsset.threeData.position.set(10, 0, 0);

//make sure to load itnewAsset.load();

}});

Page 22: Getting started with Verold and Three.js

Working with animations// Starting an animationthis.getEntity().playAnimation(loop, startTime, null, callback);

// Stopping an animationthis.getEntity().stopAnimation();

// Scrub to a specific time in secondsthis.getEntity().setAnimationTime(time);

// Set an animation takethis.getEntity().setAnimationTake(strAnimation);

Page 23: Getting started with Verold and Three.js

Keyboard input

// Setup the event listenerthis.getEngine().on(‘keyDown’, this.onKeyDown, this);/*remember to turn off the listener in shutdown()*/

// CallbackComponent.prototype.onKeyDown = function(event){ var in = this.getInput(); if(event.keyCode === input.keyCodes.rightArrow){ console.log(“Right Arrow Down!”) }}

Page 24: Getting started with Verold and Three.js

Mouse input

// Move eventthis.getEngine().on(‘mouseMove’, this.onMove, this);

Component.prototype.mouseMove = function(evt){ var x = evt.sceneX; var y = evt.sceneY; //do something with it //if you want to use it’s position on the canvas, use the //width and height of this.getRenderer().renderController}

//Click eventthis.getEngine().on(‘mouseDown’, this.onDown, this);//get coords the same way

Page 25: Getting started with Verold and Three.js

WebAudioPlayer Component

// create a web audio component for each sound file

// extend the web audio component with a listener eventthis.getEvents().on(‘play_audio:’ + strID, this.play, this);this.getEvents().on(‘stop_audio:’ + strID, this.stop, this);

// note: max of 4 audio nodes at a time (browser dependent)

Page 26: Getting started with Verold and Three.js

Custom Shader

Coming Soon...

Page 27: Getting started with Verold and Three.js

Particle effects

With particle effects, you need to create a ThreeJS ParticleSystem, Geometry, and ParticleBasicMaterial, and then, once it’s ready to use, add it to either the object that the script belongs to using this.getThreeData().add(system);or add it to the scene using

this.getScene().threeData.add(system);

Page 28: Getting started with Verold and Three.js

Floppy Dragon

Page 30: Getting started with Verold and Three.js

Loading Screen

Using the LoadingProgress Component, which listens to the states of the Scene data:

-hide the verold3d Canvas

-listen for Hierachy and Dependencies to be loaded

-on load of both, display the verold3d Canvas, and show the StartUI

Page 31: Getting started with Verold and Three.js

Collision Detection

-Player object has a low resolution sphere mesh attached to it-Collidable objects have a cube mesh attached to them-Player Sphere Mesh is used to cast a ray from it’s origin to each of its vertices-[Low Resolution] If the distance between player and a collidable is met do [Hi Res] -[High Resolution]If the face of any of the Collidable objects is intersected by the ray, it returns a collision event!-This is a common but low performance version of collision detection

Page 32: Getting started with Verold and Three.js

Camera & Controls

-Camera and player are nested in a Scrolling object

-The camera and player scroll together

-On either a mouse down event of the engine OR a mouse down event of a div, of full window size, underneath the game window, give the player a positive velocity

Page 33: Getting started with Verold and Three.js

Assets

-BitGem3D Art Assets: All low poly yet visually appealing

-Cut each animation into clips using the Inspector Window

-All the timings were laid out in the Bitgem site, so cutting clips by hand was simple

-Attach the animation asset to the model, and set the model to use the Idle animation and Loop

Page 34: Getting started with Verold and Three.js

Environment

-More BitGem3D!

-Create Empty Objects, put models in them!

-Align them all so that they go from origin Left, so that origin can be used for bounds checking and removal/readdition in scrolling -[Performance] Remove all shadows, enable per-vertex lighting, reference as few materials as possible

Page 35: Getting started with Verold and Three.js

Floppy Dragon Components

Floppy Dragon uses the following components:

AnimationTrigger: set the idle animation to loop OR play the death animationBurn: makes the dragon burn bright red for a short timeCollisionChecker: collision detection using RaycastingFlappyController: listens to keyboard controls, gives velocityGameManager: Notifies UI, Notifies Game Velocity and state, resets FloppyInputHandler: Listens for input events and notifies systemLoadProgress: Listens to Total Progress, Hierarchy and Dependencies statesRunnerReset: resets the positions of the items as the camera scrolls by themScrollingObject: Moves the node that the camera and player are attached toSpawner: initial addition/pooling of collision objects, notifies CollisionChecker of the collision meshes that belong to the collidables, moves the objects

Page 36: Getting started with Verold and Three.js

Remix away!

Some things to try:

● Play with material settings on the assets and environment

● Experiment with game mechanics, speed up rate of falling, jumping, etc

● Swap out assets for your own (Rob Ford flappy anyone?)● Add rewards● …

● GO NUTS!

Page 37: Getting started with Verold and Three.js

Verold for the Internet of Things

Page 38: Getting started with Verold and Three.js

The power of web sockets!

Web Sockets provide the bridge between your device and your web application.

Page 39: Getting started with Verold and Three.js

Ross McKegneyCEO, [email protected]@rossmckegney

Publish Interactive 3D to the Web