1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

16
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8

Transcript of 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

Page 1: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

1

KIPA Game Engine Seminars

Jonathan Blow

Ajou University

December 4, 2002

Day 8

Page 2: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

2

Small issues left over from yesterday

• Discuss cross-platformness of Keyboard::event

• Why I converted the 5km map example to centimeters

• Memory allocation and “block loading”– Why block loading is kind of funny

Page 3: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

3

Filter bandwidth

• When talking about the frame-time independent filters, I have been speaking of decay rate and not filter bandwidth

• When a question was asked in terms of bandwidth, it made me wonder why I do this

• Answer: it has to do with uniform vs nonuniform sampling

Page 4: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

4

Event Queues

• Show example of a big networking switch like we discussed yesterday– Interesting structure where things can be sent

noncentralized, but must be received centralized• An indicator that the structure should be questioned?

• Example of in-game object destroy/create, hide/unhide– Another reason to perhaps want that history query

feature

Page 5: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

5

Mesh Load/Save

• Looking through the code for the triangle strip mesh

Page 6: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

6

Why the Tcp_Connection class

• Interface with Web services, etc

Page 7: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

7

Looking at the networkprotocol code…

• We talked about UDP vs TCP kinds of things, but never looked at the various classes– Talk about the prevent-a-copy trick for

wrapped_send() that I don’t actually do yet– Two-level structure of Net_Manager::* and

Network::*

Page 8: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

8

Rendering

Page 9: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

9

BRDF Rendering

• (Show demo again)

• Discussion of the basic idea

• Two reasons to do this:– Better simulation of the real world– Data-driven shaders

Page 10: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

10

BRDFs:Acquiring the data

• Gonioreflectometer measurements

• Virtual gonioreflectometer– Raytracer and some microgeometry

• Analytic function– Ward model

Page 11: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

11

The Singular Value Decomposition (SVD)

• Factor A into VSW*– V and W are unitary– S is diagonal, positive entries on diagonal,

highest magnitude first

• Same as weighted sum of vectors

Page 12: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

12

Using the SVDon BRDF data

• Our starting matrix is 4D, not 2D• Our V, W are 2D matrices• These matrices can be stored as texture

maps, and multiplied together– Just 2 texture units per piece of the

approximation

• The parameterization of V and W are determined by the initial parameterization of A

Page 13: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

13

SVD cost

• SVD is very expensive so we can use an approximation instead

• Kautz and McCool use the “Normalized Decomposition” (ND)

Page 14: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

14

Dynamic Rangeon conventional hardware?

• Need to compute VskW* and store that in the frame buffer– Clamping in texture units causes problems!

• s too high?

– So we need to scale the s values to therange [0, 1]

• Then we suffer a lot of banding in the texture units

– This scaling needs to be the same for all objects in the scene

• One bright object makes the darker objects suffer

Page 15: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

15

Solved on newer cards

• Radeon 9700, Geforce 5 FX• Linear-light frame buffer (gamma = 1),

floating point pixels, exponentiate pixels when it’s time to page flip– or let the CLUT / RAMDAC do the right thing

• Still not perfect– Limited handling of fp pixels is available (no

antialiasing, alpha blending)

Page 16: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.

16

Why shaders are not cool

• A shader is treated as a monolithic program

• Can only call subroutines within that program (no subroutines until pixel shader 2.0)

• There can be a combinatoric explosion of shaders based on what you want to do– Example of different BRDF parameterizations