3D Graphics with pi3d - GitHub Pages

3D Graphics with pi3d

Release 1.0 @paddyg

November 02, 2015

CONTENTS

1 Introduction

2

1.1 Target Audience . . . . . . . . . . . . . . . . . . . 2

1.2 The Structure and how to use this book . . . . . . . 4

1.3 Installation . . . . . . . . . . . . . . . . . . . . . . 5

2 3D Graphics Explanation

6

2.1 Communication between python and the GPU . . . 7

2.2 Sequence of events . . . . . . . . . . . . . . . . . . 9

3 Vectors and Matrices

12

3.1 Vectors . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2 Matrices . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 Illustrations . . . . . . . . . . . . . . . . . . . . . . 14

4 Shapes, Buffers and Display

18

4.1 Shape . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2 Buffer . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.3 Display . . . . . . . . . . . . . . . . . . . . . . . . 24

5 Textures, Lights and Shaders

25

5.1 Textures . . . . . . . . . . . . . . . . . . . . . . . 25

5.2 Lights . . . . . . . . . . . . . . . . . . . . . . . . . 25

5.3 Shaders . . . . . . . . . . . . . . . . . . . . . . . . 26

5.4 A Final look at Textures . . . . . . . . . . . . . . . 30

i

6 Cameras, 2D projection and Sprites

32

7 Models

35

8 Constructing a Shape from scratch

38

9 User input and Environment Utilities

44

9.1 Keyboard . . . . . . . . . . . . . . . . . . . . . . . 44

9.2 Mouse . . . . . . . . . . . . . . . . . . . . . . . . 45

9.3 Events . . . . . . . . . . . . . . . . . . . . . . . . 45

9.4 3D Backgrounds . . . . . . . . . . . . . . . . . . . 46

9.5 ElevationMap . . . . . . . . . . . . . . . . . . . . . 47

10 Lines, Points and Merging

49

10.1 set_line_width and set_point_size . . . . . . . . . . 49

10.2 Points using texture mapping . . . . . . . . . . . . 52

11 Strings

54

12 Off-screen textures (and other more complicated things) 57 12.1 Other Shaders . . . . . . . . . . . . . . . . . . . . 60 12.2 Video Textures . . . . . . . . . . . . . . . . . . . . 60 12.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . 61

ii

Contents:

3D Graphics with pi3d, Release 1.0

CONTENTS

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download