Visualization with 3D Engine
Contents Assignment #3 3D engine으로 Robot Arm 제어 Shading Method( Normal Mapping, Environment Mapping ) Hierarchical control of Robot arm 3D Engine: 다누리VR Install & User Interface Shading & Control Project 생성 Scene 구성 : Object 생성및제어 ( 카메라, Light, Object,,,, etc.) Shading: Texture Mapping 등 Scene control with Python Basic Transformation: Translation, Rotation, Scaling Hierarchical Object Transformation
Assignment #3
Assignment #3 VR engine 으로 Robot Arm 제어 Requirements 1. Shading Method Normal mapping with your name and ID. Environment mapping with sky Box. 2. Hierarchical control of Robot arm Implement a 3 degree of freedom robot arm which is composed of Upper Arm, Lower Arm and Hand. Control the angle of joints by Keyboard callback. Using Python code to control the motion. Additional score 1. Realizing natural motion Control the angle of joints by Update callback. Applying appropriate time-angle mapping.
Assignment #3 Additional score: Time-angle mapping. Spline mapping looks more natural θθ θθ 1 θθ θθ 1 Linear mapping tt 1 TTTTTTTT Spline mapping tt 1 TTTTTTTT
Assignment #3 Result Example
Assignment #3 Result Example (Synchronous control of angles)
Assignment #3 Submit the Assignment Submit the zip file @ Blackboard File name must be Assignment3_StudentID_Name.zip Ex. Assignment3_2015000000_ 박지혁.zip Must include Src file Danuri projectfile(including Python code) Result running video file Due date: November 19 th
3D Engine: 다누리 VR
다누리 VR Install & User Interface
Install & User Interface Install Link http://211.230.48.42/g5/
Install & User Interface Danuri VR download page 다운로드탭에서다누리 -VR 실행파일클릭
Install & User Interface Install procedure 다누리 -VR 저작도구설치완료
Install & User Interface UI - Overview 화면구성 ToolBar Hierarchy View Scene View Inspector View Project View Console View
Install & User Interface UI Composition UI 구성 상단의메뉴창과하단의모듈창으로구분됨
Install & User Interface Multi Hierarchy View 오브젝트들의 Hierarchy 구조확인및변경가능
Install & User Interface Scene 배치된오브젝트를확인하고마우스를이용해조작
Install & User Interface Inspector 선택된오브젝트의속성확인및조작 새로 Component 를추가하거나삭제
Install & User Interface Project 해당프로젝트가보유중인에셋확인 Project 창으로외부에셋을드레그 & 드랍함으로써에셋추가가능 [Asset 창우클릭 ] [OpenExplorer] 한후 Asset file import 가능
Install & User Interface Toolbar File Ⅰ New Scene: 새로운씬을생성 Open Scene: 기존에존재하는씬을불러옴 Save Scene: 제작중인씬을저장 Save as Scene 제작중인씬을다른이름으로저장 New Project: 새로운프로젝트를생성
Install & User Interface Toolbar File Ⅱ Open Project: 기존에존재하는프로젝트를불러옴 Build: 작업중인씬을빌드 Project Setting: 프로젝트의설정을조절 World Setting: 월드컨테이너를설정 Exit: 프로그램을종료
Install & User Interface Toolbar - Edit Copy: 객체를복사 Paste: 복사한객체를붙여넣음 Undo: 최근작업을취소 Redo: Undo 작업을취소 Build Play: 제작한씬을실행
Install & User Interface Toolbar - Asset Asset 메뉴 Create: 에셋폴더내에새로운에셋을생성 ShowExplorer: 에셋폴더를파일탐색기로실행
Install & User Interface Toolbar - GameObject GameObject 메뉴 Create Empty Object: 빈오브젝트를생성 Create Empty Object Child: 빈자식오브젝트를생성 3D Object: 3D 오브젝트를생성 2D Object: 2D 오브젝트를생성
Install & User Interface Toolbar - View View 메뉴 Layout: 화면레이아웃을설정 Scene: Scene View 를설정 Inspector: Inspector View 를생성 3Dof emulation: 3Dof Emulator 를실행 1Dof emulation: 1Dof Emulator 를실행
다누리 VR: Shading & Control Project 생성
Shading & Control Create Project 프로젝트생성 New Project -> Location 설정 -> CreateProject
Shading & Control Open Project 프로젝트불러오기 FILE 메뉴 ->Open Project(Ctrl+Shift+O)
다누리 VR: Shading & Control Scene 구성
Shading & Control Scene 구성 : Camera 생성 Creation: [Multi Hierarchy View 우클릭 ] [Create ContainerSet] [Camera] Setting: [Camera 좌클릭 ] [Inspector 에서위치및각도설정 ]
Shading & Control Scene 구성 : Light 생성 Spot Direction Sphere Point Creation: [Multi Hierarchy View 우클릭 ] [Create ContainerSet] [Light] [Directional/Spot/Point 중택일 ] Setting: [Inspector 에서위치및각도빛의색결정 ]
Shading & Control Scene 구성 : Object 생성 Creation: [Multi Hierarchy View 우클릭 ] [Create ContainerSet] [3D Object] [Sphere]
Shading & Control Scene Control: Translation Position key [Ctrl+Q] 누른후, 화살표잡고 Drag 또는 Position key 누름. Inspector 창에서직접위치입력
Shading & Control Scene Control: Rotation Rotation key (Ctrl+W) 누른후 Object 회전 또는 Rotation key 누름 Inspector 창에서직접회전각도입력
Shading & Control Scene Control: Scaling Scale key 선택한객체의크기를변경 (Ctrl+E) Scale key 누름 Inspector 창에서직접팽창비율입력
Shading & Control Scene Hierarchical Control 오브젝트간상하관계적용 하위오브젝트로만들오브젝트를선택하여상위오브젝트로만들객체로드래그하면오브젝트간상하관계를적용할수있음 상위오브젝트위치변경시하위오브젝트가같이움직임을확인.
Shading & Control Shading
Shading & Control Texture Mapping Drag & Drop 텍스쳐선택버튼을클릭하면, 에셋폴더내의텍스쳐중원하는텍스쳐를선택할수있음
Shading & Control Texture Mapping 결과
Shading & Control Normal mapping Drag & Drop [Object 좌클릭 ] - [Inspector 의 TextureNormal 에 normal map file Drag&Drop]
Shading & Control Normal mapping 결과
Shading & Control Sky Box Mapping Drag & Drop Texture 로사용할 jpg 파일 MapProjection 을 CrossFit 으로변경 [Camera 좌클릭 ] - [Inspector 의 BackgroundTextureFile 에사진파일 Drag&Drop]
Shading & Control Sky Box Mapping 결과
Shading & Control Environment mapping: Opacity 투명도조정 : Opacity 값조정
Shading & Control Opacity 결과 Opacity 1 Opacity 0.7 Opacity 0.3 Opacity 0
Shading & Control Environment mapping: Reflection 반사도조정 : Glossiness 값조정
Shading & Control Reflection 결과 Glossiness 0 Glossiness 0.3 Glossiness 0.7 Opacity 0.7 Glossiness 0.7 Glossiness 1.0
Scene Control with Python
Python 설치 (1/3) 1. Python 홈페이지접속 (https://www.python.org/downloads/) 2. 프로그램다운로드
Python 설치 (2/3) 3. Add Python 3.7 to PATH 체크후설치진행 (Install Now) 2 1
Python 설치 (3/3) 4. Disable path length limit 클릭
Scene control with Python Skeleton Python code for Danuri VR class EX3Main(Actor): #Actor class inheritance( 기존 Danuri 서제공하는 Actor 클래쓰상속 ) def init (self): #Initialization self.objectname = Container(0) #Get Object information return def OnCreate(self, uid): #Constructor self.transformgroup = self.sphere.findcomponentbytype("transformgroup")#get Transformation information return 0 def OnDestroy(self): return 0 def Update(self): #Updating frame self.transformgroup.shiftposition() spherepos = self.transformgroup.getposition() self.transformgroup.rotate() self.transformgroup.setscale() return def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): if (msg == "KeyDown"): if( number == Hexa code): #Keyboard callback command return; Danuri s own functions and variables are orange color
Scene control with Python Translation Transformation: class EX3Main(Actor): def init (self): self.sphere = Container(0) #Get Object information return def OnCreate(self, uid): self.transformgroup = self.sphere.findcomponentbytype("transformgroup")#get Transformation information return 0 def OnDestroy(self): return 0 def OnEnable(self): return 0 def OnDisable(self): return 0 def Update(self): return def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): print(msg) if (msg == "KeyDown"): if( number == 0x51): #"Q" self.transformgroup.shiftposition(math3d.vector3(0.1,0.0,0.0)) if( number == 0x57): #"W" self.transformgroup.shiftposition(math3d.vector3(0.1,0.0,0.0)) return;
Scene control with Python Translation 결과
Scene control with Python Rotation Transformation class EX3Main(Actor): def init (self): self.sphere = Container(0) #Get Object information return def OnCreate(self, uid): self.transformgroup = self. Sphere.FindComponentByType("TransformGroup")#Get Transformation information return 0 def OnDestroy(self): return 0 def OnEnable(self): return 0 def OnDisable(self): return 0 def Update(self): return def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): print(msg) if (msg == "KeyDown"): if( number == 0x51): #"Q" spherepos = self.transformgroup.getposition() self.transformgroup.rotate(2,0, spherepos) if( number == 0x57): #"W" spherepos = self.transformgroup.getposition() self.transformgroup.rotate(-2,0, spherepos) return;
Scene control with Python Rotation 결과
Scene control with Python Scaling Transformation: class EX3Main(Actor): scalefactor = 1.0 def init (self): self.sphere = Container(0) #Get Object information return def OnCreate(self, uid): self.transformgroup = self. Sphere.FindComponentByType("TransformGroup")#Get Transformation information return 0 def OnDestroy(self): return 0 def OnEnable(self): return 0 def OnDisable(self): return 0 def Update(self): return def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): print(msg) if (msg == "KeyDown"): if( number == 0x51): #"Q" self.scalefactor = 1.1*self.scalefactor self.transformgroup.setscale(math3d.vector3(self.scalefactor,self.scalefactor,self.scalefactor)) if( number == 0x57): #"W" self.scalefactor = 0.91*self.scalefactor self.transformgroup.setscale(math3d.vector3(self.scalefactor,self.scalefactor,self.scalefactor)) return;
Scene control with Python Scaling 결과
Scene control with Python Hierarchical Transformation Control //Sphere1 def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): print(msg) if (msg == "KeyDown"): if( number == 0x51): #"Q" fbxpos = self.transformgroup.getposition() self.transformgroup.rotate(2,0,fbxpos) if( number == 0x57): #"W" fbxpos = self.transformgroup.getposition() self.transformgroup.rotate(-2,0,fbxpos) return; //Sphere2 def OnMessage(self, msg, number, Vector4_lparm, Vector4_wparam): print(msg) if (msg == "KeyDown"): if( number == 0x45): # E" fbxpos = self.transformgroup.getposition() self.transformgroup.rotate(2,0,fbxpos) if( number == 0x52): # R" fbxpos = self.transformgroup.getposition() self.transformgroup.rotate(-2,0,fbxpos) return;
Scene control with Python Hierarchical control 결과
Scene control with Python Importing Python code Drag & Drop [Object 좌클릭 ] - [Inspector 의 Add Component] [script] [script Component] [***.py 프로그램 Script 에 Drag&Drop] [ Sphere 에 Sphere Drag&Drop]
Scene control with Python Build Script 가있는프로젝트는 File->Build(Shift+B) 를통해빌드를할수있다.
Assignment #3 Result Example