cs 468 cg texture mapping n.
Skip this Video
Download Presentation
CS 468 Cg Texture Mapping

Loading in 2 Seconds...

play fullscreen
1 / 16

CS 468 Cg Texture Mapping - PowerPoint PPT Presentation

  • Uploaded on

CS 468 Cg Texture Mapping. Jon Moon Spring 2004 Computer Science Cornell University. Agenda. NVIDIA’s Cg Browser effects Bump Mapping Reflection Mapping Thin Film Bump Horizon Mapping Car Paint Bumpy Shiny Patch Watch demo, understand the shaders. Cg Commands.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CS 468 Cg Texture Mapping' - dezso

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cs 468 cg texture mapping

CS 468Cg Texture Mapping

Jon Moon

Spring 2004

Computer Science

Cornell University

  • NVIDIA’s Cg Browser effects
    • Bump Mapping
    • Reflection Mapping
    • Thin Film
    • Bump Horizon Mapping
    • Car Paint
    • Bumpy Shiny Patch
  • Watch demo, understand the shaders
cg commands
Cg Commands
  • saturate(x): same as clamp(x,0,1)
  • lerp(a,b,f): (1-f)*a + b*f
  • lit(ndotl, ndoth, m): returns Blinn model {ambient, diffuse, specular,1}
  • length(x), distance(x1,x2), pow(x,y), etc.
simple fp20 bump mapping
Simple fp20 Bump Mapping
  • Goal: Bumpy Earth
  • What should the FP do?
    • Vertex inputs?
    • Uniform Parameters?
    • Outputs?
    • Code?
simple fp20 bump mapping1
Simple fp20 Bump Mapping
  • Goal: Bumpy Earth
  • What should the VP do?
    • Inputs?
    • Uniform Parameters?
    • Textures?
    • Code?
texture reads in cg
Texture reads in Cg
  • Need uniform parameter for the texture itself: sampler2d, sampler3d, etc.
  • Need to call appropriate texture read function, with appr. Params: tex2d(my2dTexture, myCoords)
simple fp20 bump mapping2
Simple fp20 Bump Mapping
  • Texture read code (out of context):

float2 decalCoords : TEXCOORD0;

uniform sampler2D decal, etc.

float3 decalColor = tex2D(decal, IN.decalCoords).rgb;

  • OpenGL side will be covered next week!
bump reflection mapping
Bump Reflection Mapping
  • Goal: Achieve reflection using normal map, environment map
  • What kind of textures will we use?
bump reflection mapping1
Bump Reflection Mapping
  • float4 normal = tex2D(NormalMap);
  • Color = texCUBE_reflect_dp3x3(EnvironmentMap, TangentToCubeSpace0, TangentToCubeSpace1, normal);
    • transforms the normal, computes the reflected vector, and uses that to lookup into cubemap.
thin film interference
Thin Film Interference
  • Goal:
    • produce thin film color patterns (think oil or soap bubbles)
  • Plan:
    • calculate the depth of film on the surface of object, based on view/normal angle
    • Use depth as lookup and get color, use that to modify specular component
bump horizon mapping
Bump Horizon Mapping
  • Goal: bump mapping with self-shadowing
  • Theory: create horizon maps that store the elevation angle needed in a particular direction at each point
  • Use the horizon maps nearest the light direction to find elevation, compare to light vector
bump horizon mapping1
Bump Horizon Mapping
  • Can encode 4 horizon maps in one texture, with 1 elevation in each RGBA value.
  • Thus horizon maps for 8 cardinal directions (N, NE, etc.) can be encoded nicely in 2 textures
car paint
Car Paint
  • Goal: Make realistic car paint
    • Fresnel effect
    • Flecks in paint
    • Wavy normals
    • Reflection
    • Fancy paint BRDF
  • Plan: Use a ton of textures
bumpy shiny patch
Bumpy Shiny Patch
  • Goal: (go watch it!)
  • What mapping effects are being used?
other possibilities
Other possibilities?
  • Iridescence: color is view dependent
  • Gloss mapping: reflectivity differs over object
  • Height field, offset bump maps
  • Be creative! Be clever!
  • Cg User Manual:
    • http://developer.nvidia.com/object/cg_users_manual.html
    • Also in Cg Toolkit folder
  • Cg Browser download:
    • http://developer.nvidia.com/object/cg_toolkit.html
    • Part of the Cg Toolkit (~100 MB)