SlideShare una empresa de Scribd logo
1 de 44
Descargar para leer sin conexión
물리 엔진 사용을 위한
게임 물리 프로그래밍 가이드



         김성익(noerror@hitel.net)
                    2008/06/22
Overview
• 물리 엔진 사용을 위한 백그라운드 정보
 – 개념들 소개/정리
 – 구현을 다루지 않음
 – Box2D 소개
• PhysX 소개
Box2D
•   Erin Catto씨 개인 프로젝트
•   2D 오픈 소스 물리 엔진
•   사용한 프로젝트 : Crayon Physics
•   http://www.box2d.org
•   최적의 물리 처리 레퍼런스
Kinematics
• Newtonian Physics
 – F = ma
   •   Spring (F=-kx)
   •   Drag Force (F=-mpv)
   •   Gravity
 – F = dp/dt, P = mv
 – a = dV/dt
 – V = dX/dt
Calculus
•   Position
•   Velocity
•   Acceleration
Solution
• Analytic Solution
• Numeric Solution
  – Euler Method
  – Midpoint Method
  – Runge Kutta
  – Implicit Method
  – Verlet
Solution
• Analytic Solution
• Numeric Solution
  – Euler Method
  – Midpoint Method
  – Runge Kutta
  – Implicit Method
  – Verlet
Solution
• Analytic Solution
• Numeric Solution
  – Euler Method
  – Midpoint Method
  – Runge Kutta
  – Implicit Method
  – Verlet
Solution
• Analytic Solution
• Numeric Solution
  – Euler Method
  – Midpoint Method
  – Runge Kutta
  – Implicit Method
  – Verlet
Solution
• Analytic Solution
• Numeric Solution
  – Euler Method
  – Midpoint Method
  – Runge Kutta
  – Implicit Method
  – Verlet
Rotational Dynamics
• Center of Mass
• Linear vs Angular
  – Force vs Torque
  – Mass vs Moment of inertia
  – Momentum vs Angular Momentum
  – Velocity vs Angular Velocity
  – Position vs Orientation
Box2d CodeReview(1)
• Simulation iteration step
  – broadphase
    • 충돌검사 (충돌정보 Arbiter 개체로 저장)
  – force 적용
    • force->velocity
    • torque->angular velocity
  – prestep
    • 충돌 포인트에 대해서 massnormal,
      masstangent, bias 계산
Box2d CodeReview(2)
– 충돌에 의한 impulse
 • 충돌체에 impulse
   – velocity, angular velocity 적용
 • Joint 에 의한 impulse
   – 양 joint에 충돌체에 impulse
– 위치 및 회전에 적용
 • velocity => position
 • Angular velocity => rotation
PhysX(1)
• NVidia (http://www.ageia.com)
• 무료 (일부 플렛폼 및 소스코드 라이센스는
  유료)
• 충실한 튜터리얼 셈플 제공
• 메인스트림 물리 엔진
• 사용 프로젝트 : 언리얼3, 외 다수
PhysX(2)
• 기능
 – 복잡한 강체 물리 시스템
 – 캐릭터 컨트롤
 – 탈 것 다이나믹스
 – 멀티쓰레드/멀티 플렛폼/PPU지원
 – 유체 시뮬레이션
 – 옷, 깃발등의 천 시뮬레이션
 – 소프트 바디
 – 역장(forcefield) 시뮬레이션
PhysX–architecture diagram
Shape
• Shape
 – Sphere
 – Capsule
 – BoundBox
   • AABB (Axis Aligned Bound Box)
   • OBB (Object Oriented Box)
 – Convex
 – (height field)
PhysX-Shape
•   Sphere
•   Box
•   Capsule

•   Plane
•   Height field
•   Convex meshes
•   Triangle meshes
PhysX-Actor
Collision Detection(1)
• Distance Test
  – Point-point distance
  – Line-point distance
  – Line-line distance
  – Segment-segment distance
• Rough Bounding
  – Sweep and prune
Collision Detection(1)
• Distance Test
  – Point-point distance
  – Line-point distance
  – Line-line distance
  – Segment-segment distance
• Rough Bounding
  – Sweep and prune
Collision Detection(2)
•   SAT(separation axis test)
•   Lin Canny
•   Minkowski Diffrence
Collision Detection(2)
•   SAT(separation axis test)
•   Lin Canny
•   Minkowski Diffrence
Collision Detection(2)
•   SAT(separation axis test)
•   Lin Canny
•   Minkowski Sum/Diffrence
Collistion Detection(3)
• Determine Collision Time
 – Time of impact
• Tunnelling (CCD)
Collistion Detection(3)
• Determine Collision Time
  – Time of impact
• Tunnelling
PhysX - CCD
• Continuous Collision Detection
Collision Detection(4)
• Spatial Subdivision
  – Bsp, k-d tree
  – Portal
  – Quad tree / octree
• Grouping
  – Sleeping
Collision Detection(4)
• Spatial Subdivision
  – Bsp, k-d tree
  – Portal
  – Quad tree / octree
• Grouping
  – Sleeping
Collision Detection(4)
• Spatial Subdivision
  – Bsp, k-d tree
  – Portal
  – Quad tree / octree
• Grouping
  – Sleeping
Collision Detection(4)
• Spatial Subdivision
  – Bsp, k-d tree
  – Portal
  – Quad tree / octree
• Grouping
  – Sleeping
Collision Detection(4)
• Spatial Subdivision
  – Bsp, k-d tree
  – Portal
  – Quad tree / octree
• Grouping
  – Sleeping
PhysX-Collision Detection




•   Contact Filtering
•   Triggers
•   CCD
•   Dominance Grioup
•   Overlap Testing
Collision Response(1)
• Contact Point
  – EE (Edge-Edge)
  – FV (Face-Vertex)
  – GJK
• Normal
• Penetration
Collision Response(1)
• Contact Point
  – EE (Edge-Edge)
  – FV (Face-Vertex)
  – GJK
• Normal
• Pentration
Collision Response(2)
• Colliding
  – Bouncing
• Resting
  – Rolling
  – Sliding
Collision Response(2)
• Colliding
  – Bouncing
• Resting
  – Rolling
  – Sliding
Constraint
• Joint
  – Pin Joints
  – Hinge
• Angular Constraints
• Distance Constraints, ...
PhysX-Joint
•   spherical joint
•   revolute joint
•   prismatic joint
•   cylindrical joint
•   fixed joint
•   distance joint
•   point in plane joint / point on line joint
•   pulley joint
•   d6
PhysX-Joint
•   spherical joint
•   revolute joint
•   prismatic joint
•   cylindrical joint
•   fixed joint
•   distance joint
•   point in plane joint / point on line joint
•   pulley joint
•   d6
PhysX-Joint
•   spherical joint
•   revolute joint
•   prismatic joint
•   cylindrical joint
•   fixed joint
•   distance joint
•   point in plane joint / point on line joint
•   pulley joint
•   d6
PhysX-Example Review
• 예제 : SampleBoxes

• InitNx
  – Initialize PhysicsScene => gPhysicsSDK
  – CreateScene => gScene
  – Create Ground => gScene->createActor
• RenderCallback
  – Simulate
  – GetResult/Render All actors => actor->getGlobalPos
  – FetchSimulation => flushScream, fetchResult
• CreateCube
  – shapes.pushBack
  – gScene->createActor
More
• Breaking
• Force Field

• Character Controller
• Raycast/SweepTest

• Multithreading Model
Reference
• http://www.essentialmath.com
• 게임물리바이블,David H Everly, 사이텍미디어

Más contenido relacionado

La actualidad más candente

Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon
 
[Ndc11 박민근] deferred shading
[Ndc11 박민근] deferred shading[Ndc11 박민근] deferred shading
[Ndc11 박민근] deferred shading
MinGeun Park
 
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
devCAT Studio, NEXON
 
06_게임엔진구성
06_게임엔진구성06_게임엔진구성
06_게임엔진구성
noerror
 
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
devCAT Studio, NEXON
 
Compute shader
Compute shaderCompute shader
Compute shader
QooJuice
 
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
Esun Kim
 

La actualidad más candente (20)

Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .
 
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
 
게임프로젝트에 적용하는 GPGPU
게임프로젝트에 적용하는 GPGPU게임프로젝트에 적용하는 GPGPU
게임프로젝트에 적용하는 GPGPU
 
[Ndc11 박민근] deferred shading
[Ndc11 박민근] deferred shading[Ndc11 박민근] deferred shading
[Ndc11 박민근] deferred shading
 
C++20에서 리플렉션 기능 구현
C++20에서 리플렉션 기능 구현C++20에서 리플렉션 기능 구현
C++20에서 리플렉션 기능 구현
 
[Kgc2012] deferred forward 이창희
[Kgc2012] deferred forward 이창희[Kgc2012] deferred forward 이창희
[Kgc2012] deferred forward 이창희
 
Compute shader DX11
Compute shader DX11Compute shader DX11
Compute shader DX11
 
빠른 렌더링을 위한 오브젝트 제외 기술
빠른 렌더링을 위한 오브젝트 제외 기술빠른 렌더링을 위한 오브젝트 제외 기술
빠른 렌더링을 위한 오브젝트 제외 기술
 
멀티스레드 렌더링 (Multithreaded rendering)
멀티스레드 렌더링 (Multithreaded rendering)멀티스레드 렌더링 (Multithreaded rendering)
멀티스레드 렌더링 (Multithreaded rendering)
 
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
이무림, Enum의 Boxing을 어찌할꼬? 편리하고 성능좋게 Enum 사용하기, NDC2019
 
06_게임엔진구성
06_게임엔진구성06_게임엔진구성
06_게임엔진구성
 
취미로 엔진 만들기
취미로 엔진 만들기취미로 엔진 만들기
취미로 엔진 만들기
 
Voxelizaition with GPU
Voxelizaition with GPUVoxelizaition with GPU
Voxelizaition with GPU
 
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
 
프레임레이트 향상을 위한 공간분할 및 오브젝트 컬링 기법
프레임레이트 향상을 위한 공간분할 및 오브젝트 컬링 기법프레임레이트 향상을 위한 공간분할 및 오브젝트 컬링 기법
프레임레이트 향상을 위한 공간분할 및 오브젝트 컬링 기법
 
Compute shader
Compute shaderCompute shader
Compute shader
 
게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴
 
Multiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theoremMultiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theorem
 
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
 
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
 

Similar a 08_게임 물리 프로그래밍 가이드

cos323_s06_lecture03_optimization.ppt
cos323_s06_lecture03_optimization.pptcos323_s06_lecture03_optimization.ppt
cos323_s06_lecture03_optimization.ppt
devesh604174
 
A hybrid evolutionary algorithm for multi objective optimization of synthesis...
A hybrid evolutionary algorithm for multi objective optimization of synthesis...A hybrid evolutionary algorithm for multi objective optimization of synthesis...
A hybrid evolutionary algorithm for multi objective optimization of synthesis...
david80143
 

Similar a 08_게임 물리 프로그래밍 가이드 (20)

Introduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous AgentsIntroduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous Agents
 
Unite Boston 2015 Physics
Unite Boston 2015 PhysicsUnite Boston 2015 Physics
Unite Boston 2015 Physics
 
Lecture 1: Quadrotor
Lecture 1: QuadrotorLecture 1: Quadrotor
Lecture 1: Quadrotor
 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
 
cos323_s06_lecture03_optimization.ppt
cos323_s06_lecture03_optimization.pptcos323_s06_lecture03_optimization.ppt
cos323_s06_lecture03_optimization.ppt
 
Optimization
OptimizationOptimization
Optimization
 
Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28
 
Archipelagos
ArchipelagosArchipelagos
Archipelagos
 
Clustering - ACM 2013 02-25
Clustering - ACM 2013 02-25Clustering - ACM 2013 02-25
Clustering - ACM 2013 02-25
 
ACM 2013-02-25
ACM 2013-02-25ACM 2013-02-25
ACM 2013-02-25
 
2_CFD_SEicher.pdf
2_CFD_SEicher.pdf2_CFD_SEicher.pdf
2_CFD_SEicher.pdf
 
CE 72.32 (January 2016 Semester) Lecture 3 - Design Criteria
CE 72.32 (January 2016 Semester) Lecture 3 - Design Criteria CE 72.32 (January 2016 Semester) Lecture 3 - Design Criteria
CE 72.32 (January 2016 Semester) Lecture 3 - Design Criteria
 
Imu fusion algorithm for pose estimation (mCube invited talk) 2018 1003-1
Imu fusion algorithm for pose estimation (mCube invited talk) 2018 1003-1Imu fusion algorithm for pose estimation (mCube invited talk) 2018 1003-1
Imu fusion algorithm for pose estimation (mCube invited talk) 2018 1003-1
 
Nearest Neighbor Customer Insight
Nearest Neighbor Customer InsightNearest Neighbor Customer Insight
Nearest Neighbor Customer Insight
 
Build Your Own VR Display Course - SIGGRAPH 2017: Part 3
Build Your Own VR Display Course - SIGGRAPH 2017: Part 3Build Your Own VR Display Course - SIGGRAPH 2017: Part 3
Build Your Own VR Display Course - SIGGRAPH 2017: Part 3
 
Cold gas thruster to de orbit nano satellite
Cold gas thruster to de orbit nano satelliteCold gas thruster to de orbit nano satellite
Cold gas thruster to de orbit nano satellite
 
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnPlayer Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
 
Collision Detection an Overview
Collision Detection an OverviewCollision Detection an Overview
Collision Detection an Overview
 
A hybrid evolutionary algorithm for multi objective optimization of synthesis...
A hybrid evolutionary algorithm for multi objective optimization of synthesis...A hybrid evolutionary algorithm for multi objective optimization of synthesis...
A hybrid evolutionary algorithm for multi objective optimization of synthesis...
 

Más de noerror

NDC08_실시간비주얼그래프편집
NDC08_실시간비주얼그래프편집NDC08_실시간비주얼그래프편집
NDC08_실시간비주얼그래프편집
noerror
 
KCGS11_실시간 피사계 심도 렌더링 개선 기법
KCGS11_실시간 피사계 심도 렌더링 개선 기법KCGS11_실시간 피사계 심도 렌더링 개선 기법
KCGS11_실시간 피사계 심도 렌더링 개선 기법
noerror
 
11_통계 자료분석 입문
11_통계 자료분석 입문11_통계 자료분석 입문
11_통계 자료분석 입문
noerror
 
11_SH를 이용한 실시간 투명 근사법
11_SH를 이용한 실시간 투명 근사법11_SH를 이용한 실시간 투명 근사법
11_SH를 이용한 실시간 투명 근사법
noerror
 
ICON08_게임 애니메이션 최적화 기법
ICON08_게임 애니메이션 최적화 기법ICON08_게임 애니메이션 최적화 기법
ICON08_게임 애니메이션 최적화 기법
noerror
 
08_Marching Cube Terrains
08_Marching Cube Terrains08_Marching Cube Terrains
08_Marching Cube Terrains
noerror
 
08_플래시 맛보기
08_플래시 맛보기08_플래시 맛보기
08_플래시 맛보기
noerror
 
08_애니메이션고등학교 게임과 특강
08_애니메이션고등학교 게임과 특강08_애니메이션고등학교 게임과 특강
08_애니메이션고등학교 게임과 특강
noerror
 
08_Wxwidgets 소개
08_Wxwidgets 소개08_Wxwidgets 소개
08_Wxwidgets 소개
noerror
 
07_PhysX 강체물리 입문
07_PhysX 강체물리 입문07_PhysX 강체물리 입문
07_PhysX 강체물리 입문
noerror
 
07_스케일폼 소개
07_스케일폼 소개07_스케일폼 소개
07_스케일폼 소개
noerror
 
07_Visual Shader Editor
07_Visual Shader Editor07_Visual Shader Editor
07_Visual Shader Editor
noerror
 
06_HDR 소개
06_HDR 소개06_HDR 소개
06_HDR 소개
noerror
 
06_게임엔진 활용팁
06_게임엔진 활용팁06_게임엔진 활용팁
06_게임엔진 활용팁
noerror
 
06_자동차물리입문(1)
06_자동차물리입문(1)06_자동차물리입문(1)
06_자동차물리입문(1)
noerror
 
06_앰비언트어클루전 소개
06_앰비언트어클루전 소개06_앰비언트어클루전 소개
06_앰비언트어클루전 소개
noerror
 

Más de noerror (20)

15_TextureAtlas
15_TextureAtlas15_TextureAtlas
15_TextureAtlas
 
11_웹서비스활용
11_웹서비스활용11_웹서비스활용
11_웹서비스활용
 
NDC08_실시간비주얼그래프편집
NDC08_실시간비주얼그래프편집NDC08_실시간비주얼그래프편집
NDC08_실시간비주얼그래프편집
 
NDC12_Lockless게임서버설계와구현
NDC12_Lockless게임서버설계와구현NDC12_Lockless게임서버설계와구현
NDC12_Lockless게임서버설계와구현
 
KCGS11_실시간 피사계 심도 렌더링 개선 기법
KCGS11_실시간 피사계 심도 렌더링 개선 기법KCGS11_실시간 피사계 심도 렌더링 개선 기법
KCGS11_실시간 피사계 심도 렌더링 개선 기법
 
11_통계 자료분석 입문
11_통계 자료분석 입문11_통계 자료분석 입문
11_통계 자료분석 입문
 
11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템
 
11_SH를 이용한 실시간 투명 근사법
11_SH를 이용한 실시간 투명 근사법11_SH를 이용한 실시간 투명 근사법
11_SH를 이용한 실시간 투명 근사법
 
ICON08_게임 애니메이션 최적화 기법
ICON08_게임 애니메이션 최적화 기법ICON08_게임 애니메이션 최적화 기법
ICON08_게임 애니메이션 최적화 기법
 
08_Marching Cube Terrains
08_Marching Cube Terrains08_Marching Cube Terrains
08_Marching Cube Terrains
 
08_플래시 맛보기
08_플래시 맛보기08_플래시 맛보기
08_플래시 맛보기
 
08_애니메이션고등학교 게임과 특강
08_애니메이션고등학교 게임과 특강08_애니메이션고등학교 게임과 특강
08_애니메이션고등학교 게임과 특강
 
08_Wxwidgets 소개
08_Wxwidgets 소개08_Wxwidgets 소개
08_Wxwidgets 소개
 
07_PhysX 강체물리 입문
07_PhysX 강체물리 입문07_PhysX 강체물리 입문
07_PhysX 강체물리 입문
 
07_스케일폼 소개
07_스케일폼 소개07_스케일폼 소개
07_스케일폼 소개
 
07_Visual Shader Editor
07_Visual Shader Editor07_Visual Shader Editor
07_Visual Shader Editor
 
06_HDR 소개
06_HDR 소개06_HDR 소개
06_HDR 소개
 
06_게임엔진 활용팁
06_게임엔진 활용팁06_게임엔진 활용팁
06_게임엔진 활용팁
 
06_자동차물리입문(1)
06_자동차물리입문(1)06_자동차물리입문(1)
06_자동차물리입문(1)
 
06_앰비언트어클루전 소개
06_앰비언트어클루전 소개06_앰비언트어클루전 소개
06_앰비언트어클루전 소개
 

08_게임 물리 프로그래밍 가이드