SlideServe
Menu
Préférences
© SlideServe · v2026

Computer Graphics: Programming, Problem Solving, and Visual Communication

curtisf avatar
24 diapositives · 292 Views · Jan 04, 2020

Explore the intricacies of texture mapping, from creating realistic images to the complexities of texture memory & interpolation. Learn to create texture maps & use noise for creative effects.

Computer Graphics: Programming, Problem Solving, and Visual Communication - slide 1
01 / 24Computer Graphics: Programming, Problem Solving, and Visual Communication
1 / 17

Télécharger la présentation

Computer Graphics: Programming, Problem Solving, and Visual Communication
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Computer Graphics:Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College PowerPoint Instructor’s Resource

  2. Texture Mapping Creating more realistic and exciting images

  3. Texture Mapping • Adds extra information from an array to graphical objects at the last stage of drawing • Can be viewed as “painting” with 1D, 2D, or 3D values • 1D - painting that depends on one direction • 2D - painting along a surface • 3D - painting throughout a solid • Painting is not literal; the values can be used in many ways

  4. A Texture Map Is… • An array of values stored in a particular memory area in the graphics system • The dimension of the texture map is the dimension of the array • The values in the texture map are used in the final computation of the colors of each pixel

  5. Texture Mapping Needs… • A graphics object that has “texture coordinates” that associate a vertex with texture values • An array of values (usually color, but it can have other meanings) • An association of each vertex with the texture so it can get a value from the array

  6. Texture Mapping is Complex… • … because many things have to go right to make it work, including • Texture memory in the system must be loaded and its format (size and data) known • What is the meaning of the texture (color, …) • How will the texture value will be combined with the object’s pixels • How will the texture value be computed when a pixel does not have an exact texture coordinate or the texture coordinates go out of the unit range

  7. Texture Coordinates • Texture coordinates are 1D, 2D, or 3D vectors with values in [0,1] • Each vertex in you model may have not only geometric coordinates but also texture coordinates • The values in texture coordinates refer proportionately to indices in the texture array

  8. Textures in the Scene Graph • Textures do not affect the geometry of a scene, but only the way that geometry appears in the final image • Textures are thus specified as part of an appearance node in the scene graph: • Color and shading • Lighting and materials • Texture mapping

  9. Creating Texture Maps • From an image: digital photo or scan • Penguins froma trip to SouthAfrica

  10. Creating Texture Maps • Synthetically, from a program that writes values to a file • A brick texture

  11. Format for Texture Files • Any image file could be used to hold a texture map • The only question is reading the file and writing the contents to memory • If you use sophisticated files, you may need to use tools to read the files • Here we choose to use only raw files (the contents are rgbrgbrgb…) to keep things simple

  12. Noise as Texture • Noise is a procedural texture with only one component • Filtered random noise • 1/f noise

  13. Noise is Very Useful • Can be used in any place where you want something random but controlled • Can process the noise to get regions • All regions where the value is greater than a fixed value • Can use noise for varying blending or varying lightness or intensity • …

  14. Texture Interpolation • The texture coordinates of points within a region must be interpolated • This is described in detail in the chapter on rendering • It is important to realize that the way interpolation is done affects the image

  15. Creative Uses of Textures • Texture is often used to “paint realism” onto objects, creating much more interesting images than modeling alone • However, there are many ways to use textures creatively

  16. MIP Mapping • Hold many different resolutions of the same content in one texture map • You can select the version that best fits your geometry, controlling the quality of the image with less computation

  17. Billboards • A billboard is a plane object (usually simple, like a rectangle) on which an image is texture mapped’ • The image often includes zero-alpha areas so they can be “seen through” • The object is rotated to face the viewer so that the viewer sees the image in 3D space, simulating a full 3D object

  18. Creating Complex Textures • You can create textures by reading several different images and combining them as you write the texture array • You can use multitexturing to create texture layers

  19. Chromadepth • Use a 1D texture map that’s red to blue • Color ramp process, but in an array • Apply the texture in eye order on a white object • Resulting image looks 3D through Chromadepth glasses (diffraction grating)

  20. Environment Maps • Environment maps can be made with the sphere map capability • Texture map is made with a spherical filter

  21. Some Details • Texture coordinates that lie outside of [0,1] -- wrapping or clamping

  22. Some Details • Texture coordinates that lie between actual texture map array coordinates -- magnification filters • Nearest (left) and linear (right)

  23. Code For Textures Can Involve Many Stepe • A typical 2D texture setup with the texture already in the array texImage glEnable(GL_TEXTURE_2D); glGenTextures(1, texName); // define texture for sixth face glBindTexture(GL_TEXTURE_2D,texName[0]); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,TEX_WIDTH,TEX_HEIGHT, 0,GL_RGB,GL_UNSIGNED_BYTE,texImage);

  24. This Code Does Many Things • Enables textures • Generates a texture with a name • Binds the texture to a texture type • Defines the texture environment • Defines many texture parameters • Links the array texImage with the texture you have defined