SlideShare a Scribd company logo
WEBGL #2Three.js
04 06, 2015 - 이준호
READY
예제 & 실습 - 
Three.js - 
Editor - 
GitHub Tool ( GUI ) - 
BSWebGL - 
BSWebGL Blog - 
https://github.com/projectBS/webGL
https://github.com/mrdoob/three.js
https://www.jetbrains.com/idea
http://www.sourcetreeapp.com
https://github.com/projectBS/bsWebGL
http://www.bswebgl.com
 CoreThree.js
Scene : 랜더링할 모든 오브젝트를 저장하는 컨테이너.
Camera : Scene을 랜더링한 결과를 정의. 시점 기반.
Renderer : Scene이 Camera 앵글에 기반하여 보여지도록 랜더링 연산.
Object3D : 그릴 영역을 정의하는 Geometry, 영역의 Color를 정의하는 Material.
Light : 3D 표현의 필수 요소.
DEMO
Mesh
var sphereGeometry = new THREE.SphereGeometry( 4, 20, 20 );
var sphereMaterial = new THREE.MeshBasicMaterial({color:0x7777FF});
var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
Geometry에서 오브젝트가 어떤 형태로 보여질지 정의. ( 그려질 영역 )
Material에서 영역이 어떻게 칠해질지 정의.
Mesh에서 Geometry와 Material을 결합.
Geometry
기본은 3D 공간에서 점의 집합.
이 점들을 연결하여 생성된 face 들의 집합.
8개의 꼭지점 ( Vertex )
6개의 면 ( Face )
Three.js에 이미 준비되어 있는 Geometry들.
geoms = [
new THREE.CylinderGeometry( 1, 4, 4 ),
new THREE.BoxGeometry( 2, 2, 2),
new THREE.SphereGeometry(2),
new THREE.IcosahedronGeometry(4),
new THREE.OctahedronGeometry(3),
new THREE.TetrahedronGeometry(3),
new THREE.TorusGeometry( 3, 1, 10, 10 ),
new THREE.TorusKnotGeometry( 3, 0.5, 50, 20 )
];
Material만 결합하면 Mesh를 생성하고 3D Scene에서 사용 가능
Vertex나 Face를 직접 정의할 필요는 없음.
Box 지오메트리를 만들기 위해서는 width, height, depth 만 지정하면 됨.
Vertex와 Face를 Three.js 라이브러리에서 생성해 줌.
DEMO
CUSTOM GEOMETRYVertex와 Face를 직접 지정하는 것.
var verices = [
new THREE.Vector3( 3, 5, 3 ), // 0
new THREE.Vector3( 3, 5, 0 ), // 1
new THREE.Vector3( 3, 0, 3 ), // 2
new THREE.Vector3( 3, 0, 0 ), // 3
new THREE.Vector3( 0, 5, 0 ), // 4
new THREE.Vector3( 0, 5, 3 ), // 5
new THREE.Vector3( 0, 0, 0 ), // 6
new THREE.Vector3( 0, 0, 3 ) // 7
];
var faces = [
new THREE.Face3( 0, 2, 1 ),
new THREE.Face3( 2, 3, 1 ), // left
new THREE.Face3( 4, 6, 5 ),
new THREE.Face3( 6, 7, 5 ), // right
vertices : 각 점들의 위치를 정의.
faces : 점들을 연결하여 삼각형 face를 정의.
Material과 결합하여 Mesh를 생성할 수 있음.
DEMO
vertices update
/* 208 render loop */
mesh.geometry.vertices = vertices; // face를 다시 정의할 필요는 없음. face는 여전히 연결되어 있음.
mesh.geometry.verticesNeedUpdate = true; // 성능을 위해 업데이트 필요시 지정.
mesh.geometry.computeFaceNormals(); // face를 다시 계산.
clone
/* 100 gui */
var geometry = mesh.children[0].geometry.clone(), // Mesh 그룹의 첫번째 Mesh의 Geometry를 복사.
materials = [
new THREE.MeshLambertMaterial({opacity:0.6, color:0xFF44FF, transparent:true}),
new THREE.MeshBasicMaterial({color:0x000000, wireframe:true})
],
mesh2 = THREE.SceneUtils.createMultiMaterialObject( geometry, materials ); // 다른 Material과 결합.
multi material
/* 164 add mesh */
materials = [
new THREE.MeshLambertMaterial({opacity:0.6, color:0x44FF44, transparent:true}),
new THREE.MeshBasicMaterial({color:0x000000, wireframe:true})
];
geom.vertices = vertices;
geom.faces = faces;
geom.computeFaceNormals();
mesh = THREE.SceneUtils.createMultiMaterialObject( geom, materials);
mesh.children.forEach( function(e){e.castShadow = true; } ); // Mesh 그룹을 loop
scene.add(mesh);
THREE.SceneUtils.createMultiMaterialObject( geometry, [material, material, ...] )
각각의 Mesh를 생성하여 그룹을 지어주는 것
THANK YOU

More Related Content

Viewers also liked

19-B-4 開発品質向上のための、ASQ/ALMソリューション
19-B-4 開発品質向上のための、ASQ/ALMソリューション19-B-4 開発品質向上のための、ASQ/ALMソリューション
19-B-4 開発品質向上のための、ASQ/ALMソリューションDevelopers Summit
 
Memory Science & Medical Education
Memory Science & Medical EducationMemory Science & Medical Education
Memory Science & Medical Education
Benjamin Williams
 
slideshare in teaching and learning
slideshare in teaching and learningslideshare in teaching and learning
slideshare in teaching and learningusha
 
Creating users and groups in obiee 11 g
Creating users and groups in obiee 11 gCreating users and groups in obiee 11 g
Creating users and groups in obiee 11 g
Ravi Kumar Lanke
 
Jinotech
JinotechJinotech
Jinotechwon ho
 
some media to teach genre
some media to teach genresome media to teach genre
some media to teach genre
En Do
 
Mediawijsheid PleinC 010212 - John Leek
Mediawijsheid PleinC 010212 - John LeekMediawijsheid PleinC 010212 - John Leek
Mediawijsheid PleinC 010212 - John Leek
Netherlands Institute for Sound and Vision
 
Economics Denzel Presentation (Perfect competition)
Economics Denzel Presentation (Perfect competition)Economics Denzel Presentation (Perfect competition)
Economics Denzel Presentation (Perfect competition)Canadian Academy
 
Removing babylon toolbar from browsers
Removing babylon toolbar from browsersRemoving babylon toolbar from browsers
Removing babylon toolbar from browsers
Ravi Kumar Lanke
 
Presentando a Miles
Presentando a MilesPresentando a Miles
Presentando a Milessergiodelmo
 
Rendement is meer dan alleen het verbeteren van het energielabel
Rendement is meer dan alleen het verbeteren van het energielabelRendement is meer dan alleen het verbeteren van het energielabel
Rendement is meer dan alleen het verbeteren van het energielabel
Netherlands Enterprise Agency (RVO.nl)
 
[Lt]今年は物理サーバーを仮想化してみましょう
[Lt]今年は物理サーバーを仮想化してみましょう[Lt]今年は物理サーバーを仮想化してみましょう
[Lt]今年は物理サーバーを仮想化してみましょうMasaya Sawada
 
Эффективное использование социальных сетей для развития интернет-магазина
Эффективное использование социальных сетей для развития интернет-магазинаЭффективное использование социальных сетей для развития интернет-магазина
Эффективное использование социальных сетей для развития интернет-магазина
Fert
 

Viewers also liked (20)

19-B-4 開発品質向上のための、ASQ/ALMソリューション
19-B-4 開発品質向上のための、ASQ/ALMソリューション19-B-4 開発品質向上のための、ASQ/ALMソリューション
19-B-4 開発品質向上のための、ASQ/ALMソリューション
 
Memory Science & Medical Education
Memory Science & Medical EducationMemory Science & Medical Education
Memory Science & Medical Education
 
slideshare in teaching and learning
slideshare in teaching and learningslideshare in teaching and learning
slideshare in teaching and learning
 
Terra do espaco
Terra do espacoTerra do espaco
Terra do espaco
 
Seatel
SeatelSeatel
Seatel
 
Esdb E Eportfolio
Esdb E EportfolioEsdb E Eportfolio
Esdb E Eportfolio
 
Creating users and groups in obiee 11 g
Creating users and groups in obiee 11 gCreating users and groups in obiee 11 g
Creating users and groups in obiee 11 g
 
Web2.0
Web2.0 Web2.0
Web2.0
 
Field study dr a razzaq - day 1-session3
Field study   dr a razzaq - day 1-session3Field study   dr a razzaq - day 1-session3
Field study dr a razzaq - day 1-session3
 
Jinotech
JinotechJinotech
Jinotech
 
some media to teach genre
some media to teach genresome media to teach genre
some media to teach genre
 
Celebrity obesity
Celebrity obesityCelebrity obesity
Celebrity obesity
 
Graduates attributes dr fawzi-day 1-session3
Graduates attributes   dr fawzi-day 1-session3Graduates attributes   dr fawzi-day 1-session3
Graduates attributes dr fawzi-day 1-session3
 
Mediawijsheid PleinC 010212 - John Leek
Mediawijsheid PleinC 010212 - John LeekMediawijsheid PleinC 010212 - John Leek
Mediawijsheid PleinC 010212 - John Leek
 
Economics Denzel Presentation (Perfect competition)
Economics Denzel Presentation (Perfect competition)Economics Denzel Presentation (Perfect competition)
Economics Denzel Presentation (Perfect competition)
 
Removing babylon toolbar from browsers
Removing babylon toolbar from browsersRemoving babylon toolbar from browsers
Removing babylon toolbar from browsers
 
Presentando a Miles
Presentando a MilesPresentando a Miles
Presentando a Miles
 
Rendement is meer dan alleen het verbeteren van het energielabel
Rendement is meer dan alleen het verbeteren van het energielabelRendement is meer dan alleen het verbeteren van het energielabel
Rendement is meer dan alleen het verbeteren van het energielabel
 
[Lt]今年は物理サーバーを仮想化してみましょう
[Lt]今年は物理サーバーを仮想化してみましょう[Lt]今年は物理サーバーを仮想化してみましょう
[Lt]今年は物理サーバーを仮想化してみましょう
 
Эффективное использование социальных сетей для развития интернет-магазина
Эффективное использование социальных сетей для развития интернет-магазинаЭффективное использование социальных сетей для развития интернет-магазина
Эффективное использование социальных сетей для развития интернет-магазина
 

Similar to WebGL 20150406

Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지guestf0843c
 
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
SangHoon Han
 
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
MinPa Lee
 
Html5 게임 기술의 개요
Html5 게임 기술의 개요Html5 게임 기술의 개요
Html5 게임 기술의 개요
Changhwan Yi
 
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
Chiwon Song
 
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js [W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
양재동 코드랩
 
c++ opencv tutorial
c++ opencv tutorialc++ opencv tutorial
c++ opencv tutorial
TaeKang Woo
 
예제를 통해 쉽게_살펴보는_뷰제이에스
예제를 통해 쉽게_살펴보는_뷰제이에스예제를 통해 쉽게_살펴보는_뷰제이에스
예제를 통해 쉽게_살펴보는_뷰제이에스
Dexter Jung
 
프론트엔드 개발자의 자바스크립트
프론트엔드 개발자의 자바스크립트 프론트엔드 개발자의 자바스크립트
프론트엔드 개발자의 자바스크립트
jeong seok yang
 
Isomorphicspring Isomorphic - spring web seminar 2015
Isomorphicspring Isomorphic - spring web seminar 2015Isomorphicspring Isomorphic - spring web seminar 2015
Isomorphicspring Isomorphic - spring web seminar 2015
sung yong jung
 
2D games with iOS or Corona
2D games with iOS or Corona2D games with iOS or Corona
2D games with iOS or Corona
EungShik (Henry) Kim
 
The Future of .NET and C#
The Future of .NET and C#The Future of .NET and C#
The Future of .NET and C#
명신 김
 
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
현철 조
 
[0602 박민근] direct2 d
[0602 박민근] direct2 d[0602 박민근] direct2 d
[0602 박민근] direct2 dMinGeun Park
 
Python on Android
Python on AndroidPython on Android
Python on Android
용 최
 
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
Jaeseung Ha
 
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
Changhwan Yi
 
3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약
Tae wook kang
 
[0602 박민근] Direct2D
[0602 박민근] Direct2D[0602 박민근] Direct2D
[0602 박민근] Direct2D
흥배 최
 
Front end dev 2016 & beyond
Front end dev 2016 & beyondFront end dev 2016 & beyond
Front end dev 2016 & beyond
Jae Sung Park
 

Similar to WebGL 20150406 (20)

Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지
 
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
ASP.NET Core 3.0과 Blazor를 활용한 새로운 WEB 개발(그리고 Try.NET)
 
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
[QGIS] 수치지도를 이용한 DEM 생성과 지형분석
 
Html5 게임 기술의 개요
Html5 게임 기술의 개요Html5 게임 기술의 개요
Html5 게임 기술의 개요
 
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
 
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js [W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
[W3C HTML5 2017] 예제를 통해 쉽게 살펴보는 Vue.js
 
c++ opencv tutorial
c++ opencv tutorialc++ opencv tutorial
c++ opencv tutorial
 
예제를 통해 쉽게_살펴보는_뷰제이에스
예제를 통해 쉽게_살펴보는_뷰제이에스예제를 통해 쉽게_살펴보는_뷰제이에스
예제를 통해 쉽게_살펴보는_뷰제이에스
 
프론트엔드 개발자의 자바스크립트
프론트엔드 개발자의 자바스크립트 프론트엔드 개발자의 자바스크립트
프론트엔드 개발자의 자바스크립트
 
Isomorphicspring Isomorphic - spring web seminar 2015
Isomorphicspring Isomorphic - spring web seminar 2015Isomorphicspring Isomorphic - spring web seminar 2015
Isomorphicspring Isomorphic - spring web seminar 2015
 
2D games with iOS or Corona
2D games with iOS or Corona2D games with iOS or Corona
2D games with iOS or Corona
 
The Future of .NET and C#
The Future of .NET and C#The Future of .NET and C#
The Future of .NET and C#
 
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
 
[0602 박민근] direct2 d
[0602 박민근] direct2 d[0602 박민근] direct2 d
[0602 박민근] direct2 d
 
Python on Android
Python on AndroidPython on Android
Python on Android
 
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
 
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
2013 W3C HTML5 Day Conferences:HTML5 Game App 개발 및 이슈
 
3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약
 
[0602 박민근] Direct2D
[0602 박민근] Direct2D[0602 박민근] Direct2D
[0602 박민근] Direct2D
 
Front end dev 2016 & beyond
Front end dev 2016 & beyondFront end dev 2016 & beyond
Front end dev 2016 & beyond
 

More from Jun Ho Lee

우아한오픈소스
우아한오픈소스우아한오픈소스
우아한오픈소스
Jun Ho Lee
 
ECMA2015 INSIDE
ECMA2015 INSIDEECMA2015 INSIDE
ECMA2015 INSIDE
Jun Ho Lee
 
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
Jun Ho Lee
 
스타일 객체 활용
스타일 객체 활용스타일 객체 활용
스타일 객체 활용
Jun Ho Lee
 
지금까지 상상한 Web 표현의한계를넘자 WebGL
지금까지 상상한 Web 표현의한계를넘자 WebGL지금까지 상상한 Web 표현의한계를넘자 WebGL
지금까지 상상한 Web 표현의한계를넘자 WebGL
Jun Ho Lee
 
WebGL의 무궁무진한 가능성
WebGL의 무궁무진한 가능성 WebGL의 무궁무진한 가능성
WebGL의 무궁무진한 가능성
Jun Ho Lee
 

More from Jun Ho Lee (6)

우아한오픈소스
우아한오픈소스우아한오픈소스
우아한오픈소스
 
ECMA2015 INSIDE
ECMA2015 INSIDEECMA2015 INSIDE
ECMA2015 INSIDE
 
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
HTML5 관점에서 본 2015년 웹개발 트렌드 및 인사이트
 
스타일 객체 활용
스타일 객체 활용스타일 객체 활용
스타일 객체 활용
 
지금까지 상상한 Web 표현의한계를넘자 WebGL
지금까지 상상한 Web 표현의한계를넘자 WebGL지금까지 상상한 Web 표현의한계를넘자 WebGL
지금까지 상상한 Web 표현의한계를넘자 WebGL
 
WebGL의 무궁무진한 가능성
WebGL의 무궁무진한 가능성 WebGL의 무궁무진한 가능성
WebGL의 무궁무진한 가능성
 

WebGL 20150406