Level of Detail How to make games run fast and look good - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Level of Detail How to make games run fast and look good

Description:

Level of Detail (How to make games run fast and look good) UKZN Graphics & Modelling 2006 ... Nearest texel leads to pixelation and jagged edges. ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 25
Provided by: MOL133
Category:
Tags: detail | fast | games | good | jagged | level | look | make | run

less

Transcript and Presenter's Notes

Title: Level of Detail How to make games run fast and look good


1
Level of Detail(How to make games run fast and
look good)
2
Remember this?
3
What went wrong?
  • Simple answer
  • Aliasing due to undersampling.
  • Can be fixed/ameliorated by supersampling
  • Somewhat longer answer
  • Ratio between pixels and texels changes as we
    move backwards.
  • In effect, the texels get too big.

4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
The result
13
Mipmaps
  • Why Mipmaps?
  • map is the easy part vide colour maps,
    bumpmaps, texture maps, etc.
  • Mip multum in parvo (many/much in little).

14
Storing Mipmaps
15
So, what has changed?
  • Well, that depends.
  • If you make the smaller maps naively, then not
    much.
  • If you filter the maps as you create them then
    you only need to do it once, and on a restricted
    area.

16
Filtering Mipmaps
  • Simple approach is to filter the mipmaps as you
    create them.
  • Depending on the approach, you can either create
    each successive level from the one before, or
    derive them all from the original (L0) texture.

17
Mapping pixels to texels
  • Nearest texel leads to pixelation and jagged
    edges.
  • Calculate average of 2x2 square surrounding texel
    position.
  • Linearly interpolate between those same 4 pixels.

18
Using Mipmaps
  • L log2 (texture size / polygon size).
  • If L lt 0.0, texture smaller than polygon and
    magnification filter is used.
  • If L gt 0.0, texture is larger than polygon and
    mipmapping is used where L specifies mipmap level.

19
Choosing Mipmap Level
  • Can use previous formula.
  • Can also interpolate between mipmap levels. This
    leads to tri-linear filtering.

20
Mipmaps and OpenGL (1)
  • First load textures for every mipmap level using
    glTexImage2D().
  • Be careful if you forget one of the levels,
    mip-mapping is disabled by OpenGL without any
    warning.
  • Level 0 has the highest resolution.

21
Mipmaps and OpenGL (2)
  • Generating smaller versions potentially produces
    aliasing ? filtering.
  • GLU offers automatic mipmap generation with
    filtering.
  • gluBuildMipMaps() constructs the pyramid and
    calls glTexImage() for each level to load the
    image.

22
Mipmaps and OpenGL(3)
  • OpenGL tries to pick best mipmap level and texel
    within that level.
  • GL_NEAREST (Point Sampling) pick the texel with
    nearest centre.
  • GL_LINEAR (Bilinear Sampling) weighted average
    of 2x2 closest texels.

23
Mipmaps and OpenGL(4)
  • GL_NEAREST_MIPMAP_LINEAR average nearest texels
    from two mipmap levels.
  • GL_LINEAR_MIPMAP_LINEAR (Trilinear) average two
    averaged texels from two mipmaps.

24
Next Lecture
Revision
Write a Comment
User Comments (0)
About PowerShow.com