0% found this document useful (0 votes)
62 views48 pages

Gsprogramming 1

The document discusses graphics programming techniques for the PlayStation 2, including using interlaced frame buffers, different screen modes, texture mapping, multipass rendering, and vertex lighting. It provides recommendations for taking advantage of the PlayStation 2's capabilities while working within its memory and processing constraints.

Uploaded by

a w
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views48 pages

Gsprogramming 1

The document discusses graphics programming techniques for the PlayStation 2, including using interlaced frame buffers, different screen modes, texture mapping, multipass rendering, and vertex lighting. It provides recommendations for taking advantage of the PlayStation 2's capabilities while working within its memory and processing constraints.

Uploaded by

a w
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

PlayStation2 Developers

Conference

Silicon Valley 2000


Introduction to GS Programming(1)

! David Coombes
Support Engineer
SCEA Developer Support
[email protected]

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 2
Introduction to GS(1)
! Presentation Outline
– The evils of television
– GS screen modes
– GS memory scheme
– Texturing (Multipass etc)
– Memory Access
– Coordinate systems
– Zbuffer
– Conclusion

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 3
The Evils of Television (1)
! NTSC/PAL TV Picture
– Not hi-def tv or Vesa monitor
– Take this into consideration
– Check frequently
! Picture signal is analog
– No concept of horizontal resolution ( about
740 ish)
– Vertically about 512 lines (NTSC), but not all
are used to display picture

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 4
The Evils of Television (2)
! TV picture is interlaced. A complete picture
is sent every 30th of a second.
! However it is not sent in row order.
– First the odd fields are sent, then the even
– Reduces flicker and smearing
– TV is old analog technology
– Good for smooth analog images
– Not so good for us

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 5
Screen Modes
! To take advantage of the maximum
vertical resolution - have to run at full
frame rate
! Have to supply 256 vertical lines of picture
every 60th of a second
! Brute force solution
– Two 640*448 frame buffers and a 640*448 Z
buffer
– Not interlaced. Uses a LOT of VRAM
– No frame rate constraints
Introduction to the GS (1)  2000 SCEA CONFIDENTIAL
Slide # 6
Field Based Solution
– A single 640*448 frame buffer and a single
640*448 Z buffer
– Interlaced
– Have to run at 60 fps
– Have to render entire screen every 60th of a
second even though only displaying half of it
– Old PlayStation style

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 7
Field Based Solution
GS Renders into odd fields while sending even fields
to the Television and vice versa.1

Interlaced Frame Buffers

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 8
Frame Based Solution
– Two 640*224 frame buffers and a single
640*224 Z buffer
– Interlaced
– Have to run at 60 fps
– All SCEI demos advocate this mode
! Have to do a bit of fiddling to get it to work.
– Half the height of everything (can be done in
final stage of transform)
– Half pixel offset for even frames

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 9
Frame Based Rendering
Double buffering in interlaced mode

Frame Buffer 1

Frame Buffer 2

Frame Buffer 1 and 2 have different vertical offsets

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 10
Screen Modes (Interlaced)
! Do use 24 or 32 bit
– 16 bit z buffer is likely to give problems
! 640*224 (448) frame based interlace
– Most launch titles use this mode. Likely to
become the standard
! 512*224 (448) frame based interlace
– Saves a useful chunk of video memory

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 11
Screen Modes (Non-Interlaced)
! Free frame rate
! Twice the drawing time. Half the resolution
! Your engine had better be pumping out
some amazing visuals…
If you want to compete with 60fps games

! 60fps interlaced strongly recommended!


– Flicker Fusion Frequency ( FFF)

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 12
Textures
! Limited Memory available
! Upload texture from main ram when
needed
– Fast
– Sort models based on texture requirements if
possible
– See other presentation

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 13
Textures
! Use 8 and 4 bit textures where possible
! Still get full range and lighting Looks fine
on a TV
– Gouraud Shading and Bilinear Filtering
! Don’t want too much high frequency noise
in textures anyway (Aliasing)
! Allows for bigger textures without
thrashing page buffer

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 14
Textures
! Can hide 8 bit textures in unused bits of
other pixel modes e.g. PSMT8H
! Storing an 8 bit texture in the unused bits
of the frame buffer

PSMT8H PSMCT24

IDTEX 8 red green blue

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 15
Textures
! Loading 8 bit and 4 bit textures is slow
compared to 16/24/32
! However can munge multiple textures
together for the purposes of loading

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 16
Texture Coordinate Values
! STQ or UV ?
! UV coordinates are not perspective
correct.
! Does this matter?
! Don’t need to calculate or send a q value
! Fine for flat shaded distant objects (LOD)

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 17
Texture Coordinate Values (2)
! STQ
! Generally going to look better as its
perspective correct
! Can use tri-linear mip mapping.

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 18
Textures (Conclusion)
! GS local memory is not that big but….
– Dynamic texture loading is viable
– 4 and 8 bit textures save space

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 19
Multitexture
! No support for multitexture
– You can use the trilinear mip map filter to
bodge this… but it's slow
! Composite multitexture could be built at
run time
! There wasn’t room left on the chip

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 20
Multipass Rendering
! Gouraud + Texture is boring
! Completely diffuse model
! Use Multipass rendering to accumulate
multiple effects
– Dark/light Map
– Specular pass
– Reflection/Refraction

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 21
Multipass Rendering (2)
! No Source * Destination Alpha blend
– Can’t have color dark maps a la Quake.
– Bummer
– Can use Alpha multiply
• Single color light maps
• Combine with a vertex lighting pass

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 22
Vertex Lighting
! Pre-calculated or dynamic, fast cheap and
looks good
! Gouraud shading isn’t perspective correct
! Need heavy Tessellation for highlights
– But that’s ok, PS2 can process lots of
polygons
! Dynamic lighting effects are easier than
with dark maps
! Doesn’t use any VRAM
Introduction to the GS (1)  2000 SCEA CONFIDENTIAL
Slide # 23
Texture Wrap Modes
! Clamp
! Repeat
! Region Clamp
! Region Repeat
! Can be useful, but generally tessellation is
a better option, as have more vertices for
lighting and clipping

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 24
Complex Texturing Conclusion
– Use combination of vertex lighting and
multipass rendering to create complex
rendering.

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 25
GS Local Memory
! Fast local on chip memory
! Unified memory for frame, Z and texture
! 1 Meg of 4byte memory space = 4Mb!
! Non-linear address conversion

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 26
GS Memory Addressing
FBP: Frame buffer start address
Frame
(0x00000)

ZBP: Z buffer start address


Z

TBP: Texture buffer start address


Texture

CBP: Clut buffer start address


CLUT
(0xFFFFF)

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 27
GS Memory Addressing
! 2 port configuration (2560 bit wide bus)
– Texture access is independent of Frame/Z
buffer access
– Each has an 8Kb page buffer
– Frame and Z buffer share the same page
buffer
• So effectively only 4 kb for Z and Frame

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 28
Memory Access Units
! Page 8192 bytes
! Block 256 bytes
! Column 64 bytes (512 bits)
! Data can be read and written to a column
in the frame/z buffer in a single cycle
– 2560 bit wide data bus
• 1024 for frame read 512 write 512
• 1024 for zbuffer read 512 write 512
• 512 texture read

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 29
Block Arrangement Order
64 Pixels

PSMCT32 (Frame buffer)


0 1 4 5 16 17 20 21
2 3 6 7 18 19 22 23
8 9 12 13 24 25 28 29
10 11 14 15 26 27 30 31
64 Pixels

16 17 20 21 0 1 4 5 PSMZ32 (Z buffer)

18 19 22 23 2 3 6 7
24 25 28 29 8 9 12 13
26 27 30 31 10 11 14 15
Introduction to the GS (1)  2000 SCEA CONFIDENTIAL
Slide # 30
PSMCT32 64 pixels PSMZT32 64 pixels

0 1 4 5 16 17 20 21 16 17 20 21 0 1 4 5
2 3 6 7 18 19 22 23 18 19 22 23 2 3 6 7

8 9 12 13 24 25 28 29 24 25 28 29 8 9 12 13

10 11 14 15 26 27 30 31 26 27 30 31 10 11 14 15

8 pixels

Column 0

8 pixels Column 1 Block size 8*8 pixels


Column 2
Column Size 8*2 pixels
Column 3

0 1 4 5 8 9 12 13

2 3 6 7 10 11 14 15

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 31
What does all this mean to me?
! Data is read from the texture page buffer
in 64 byte chunks.
! Reduced textures are costly as they thrash
the page buffer
– Consider mip mapping or lod
! Faster to fill the screen with lots of small
32*32 sprites than 1 big sprite

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 32
Page Buffer Size
! Frame / Z buffer
! 32/24 bit 32*32 pixels
! 16 bit 32*64 pixels
! 8 bit 64*64 pixels
! 4 bit 64*128 pixels

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 33
Page Buffer Size
! Texture page buffer
! 32/24 bit 64*32 pixels
! 16 bit 64*64 pixels
! 8 bit 128*64 pixels
! 4 bit 128*128 pixels

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 34
GS Memory Addressing
Conclusion
! Being aware the the memory addressing
scheme employed on the GS can result in
higher performance
! See GS Supplementary Document
– Details of GS Local Memory

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 35
Drawing Function
! Setup
! Rasterizing ( DDA)
! Texture mapping - Texture read
! Fogging/Anti-aliasing
! Pixel Test -A,Z read
! Alpha Blending -RGB
! Formatting

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 36
Pixel Test
! Reject before reads from frame buffer
– Scissoring
– Alpha Test
– Destination Alpha Test
– Depth Test

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 37
Drawing Function Conclusion
! Scissor test is late in pipeline so there is a
significant penalty for drawing off screen
! However its not as expensive as doing a 6
plane view clip!
! Especially to a tri strip

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 38
Primitive Coordinate System
! X and Y are 16 bit (0.12.4)
! 0..4095.9375
! Coordinates that exceed these values will
wrap and cause nasty artifacts
! Have to clip these coordinates

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 39
Window Coordinate System
! This is the area within the Primitive
Coordinate System that relates to the
window where drawing will occur
(0,0)
4096
Offset

4096

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 40
Window Coordinate System

(0,0)
4096

4096

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 41
Positioning of Window
Coordinate System
(0,0)
4096

4096

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 42
Coordinate System Conclusion
! Make Use of full range of primitive
coordinate system to take load of vector
processors

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 43
Z Buffer
! Programmer can control drawing order
unlike Z-sort
! Have to Z-sort for some instances
– Alpha Blending
– Transparency?

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 44
Z Buffer Accuracy
! Typically using the 1/Z from the
homogenous transform
Screen

More Accuracy for close objects

1/z

View

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 45
Z Buffer Accuracy
! Placing of near and far planes controls
range and therefore resolution and
accuracy of z buffer
! Z buffer is per pixel, so intersecting
polygons in a model display correctly
! This can be useful for low polygon count
models

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 46
Conclusion
! GS is very fast, but has limited
functionality and memory in comparison to
a PC graphics card

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 47
The End

Introduction to the GS (1)  2000 SCEA CONFIDENTIAL


Slide # 48

You might also like