ݺߣ

ݺߣShare a Scribd company logo
물리 엔진 사용을 위한
게임 물리 프로그래밍 가이드



         김성익(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, 사이텍미디어

More Related Content

What's hot (20)

PDF
Visual Studio를 이용한 어셈블리어 학습 part 1
YEONG-CHEON YOU
PPTX
리플렉션과 가비지 컬렉션
QooJuice
PDF
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
devCAT Studio, NEXON
PPTX
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
MinGeun Park
PPTX
GameInstance에 대해서 알아보자
TonyCms
PDF
07_PhysX 강체물리 입문
noerror
PPTX
[KGC2011_박민근] 신입 게임 개발자가 알아야 할 것들
MinGeun Park
PDF
들로네 삼각분할과 보로노이 다이어그램
ssuserbe87d6
PPTX
[Ndc11 박민근] deferred shading
MinGeun Park
PDF
게임 개발에 자주 사용되는 디자인 패턴
예림 임
PPTX
정종필 팀장이됐어요(더저용량)
JP Jung
PDF
멀티스레드 렌더링 (Multithreaded rendering)
Bongseok Cho
PDF
실시간 게임 서버 최적화 전략
YEONG-CHEON YOU
PPTX
Bump Mapping
Sukwoo Lee
PDF
홍성우, 게임 프로그래머는 어떻게 가르치나요?, NDC2018
devCAT Studio, NEXON
PDF
레퍼런스만 알면 언리얼 엔진이 제대로 보인다
Lee Dustin
PDF
[NDC 2018] 유체역학 엔진 개발기
Chris Ohk
PDF
MMOG Server-Side 충돌 및 이동처리 설계와 구현
YEONG-CHEON YOU
PDF
[NDC07] 게임 개발에서의 클라이언트 보안 - 송창규
ChangKyu Song
PDF
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon
Visual Studio를 이용한 어셈블리어 학습 part 1
YEONG-CHEON YOU
리플렉션과 가비지 컬렉션
QooJuice
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
devCAT Studio, NEXON
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
MinGeun Park
GameInstance에 대해서 알아보자
TonyCms
07_PhysX 강체물리 입문
noerror
[KGC2011_박민근] 신입 게임 개발자가 알아야 할 것들
MinGeun Park
들로네 삼각분할과 보로노이 다이어그램
ssuserbe87d6
[Ndc11 박민근] deferred shading
MinGeun Park
게임 개발에 자주 사용되는 디자인 패턴
예림 임
정종필 팀장이됐어요(더저용량)
JP Jung
멀티스레드 렌더링 (Multithreaded rendering)
Bongseok Cho
실시간 게임 서버 최적화 전략
YEONG-CHEON YOU
Bump Mapping
Sukwoo Lee
홍성우, 게임 프로그래머는 어떻게 가르치나요?, NDC2018
devCAT Studio, NEXON
레퍼런스만 알면 언리얼 엔진이 제대로 보인다
Lee Dustin
[NDC 2018] 유체역학 엔진 개발기
Chris Ohk
MMOG Server-Side 충돌 및 이동처리 설계와 구현
YEONG-CHEON YOU
[NDC07] 게임 개발에서의 클라이언트 보안 - 송창규
ChangKyu Song
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon

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

PDF
Collision Detection an Overview
slantsixgames
PPT
4.2 collision detection
Sayed Ahmed
PPT
3장 자동적으로 움직이는 게임 에이전트 생성법_2
suitzero
PDF
Collision Detection In 3D Environments
Ung-Su Lee
PPTX
Kinect kunkuk final_
Yunkyu Choi
ODP
Programming physics games with Python and OpenGL
Daniel Pope
PDF
CUDA Raytracing을 이용한 Voxel오브젝트 가시성 테스트
YEONG-CHEON YOU
Collision Detection an Overview
slantsixgames
4.2 collision detection
Sayed Ahmed
3장 자동적으로 움직이는 게임 에이전트 생성법_2
suitzero
Collision Detection In 3D Environments
Ung-Su Lee
Kinect kunkuk final_
Yunkyu Choi
Programming physics games with Python and OpenGL
Daniel Pope
CUDA Raytracing을 이용한 Voxel오브젝트 가시성 테스트
YEONG-CHEON YOU
Ad

More from noerror (20)

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

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