Upload
phamque
View
220
Download
1
Embed Size (px)
Citation preview
2
What is HDR?
• Dynamic Range – Ratio between highest and lowest luminance
• High Dynamic Range– Much higher and/or lower than 0.0~1.0 range
How It Does
8
Details
• 1) Render the Scene to the Scene Tex
Details
• 2) Render the Advection with theLast Advection Tex
9
Details
• 3) Blend the Scene Tex &Advectioninto theNext Advection Tex
Details
• 4) Dump Next Advection Tex to Screen
11
Tweakable Parameters
• Advection Distance• Typically one over texture size
• Gradient Sampling Distance• Typically the same thing
• Flip the Height Map?• Not technically correct but looks good
• Transform from gradient to advection• Advect along gradient or along edges
Examples
• Original Scene
12
Impressionist• Use the background
texture for height map• Flip the height map• Advect along edges
(don’t tell anyone, but it only works well with the dandelion background)
Claude Moo-net
Pointillist• Use the background
texture for height map• Flip the height map• Advect along gradient
13
Watercolor• Use the background
texture for height map• Large gradient steps
Stained Glass• Use scene tex for
height map• Advect against gradient
14
Cellular• Use last advect tex for
height map• Advect against gradient
Glowing• Use last advect tex for
height map• Advect along gradient
16
Pen & Ink Cow
• Used a “Tonal Art Map” as described by Hughes Hoppe in “Fine Tone Control in Hardware Hatching”
• Simulated 3d texturing in fragment shader using a single 2d texture
• Requires a smooth parameterization of model
Tonal Art Map
17
Another Viewpoint
Bull Caricature: Scott ProperThe cow was morphed with two spheres in the GLSL vertex shader to achieve the appearance of a bull caricature. Parameters control each sphere’s size, height, and separation.
Several parameters control how the spheres are morphed with the cow:•“Blend” – How closely each vertex of the cow was blended with the sphere vertices•“Object Width” – Size of the cow. Controls how vertices of two spheres are blended prior to being blended with cow vertices•“Sphere Offset” – Controls how vertices on cow match up to vertices on spheres.
Several noise parameters are combined to give the cow the appearance of a Holstein. 3D noise was used to eliminate the problem of greater-frequency noise on the underbelly of the cow.
18
Further examples
“Datchund Cow”
“A Big Caboose”
Sphere offset low Sphere offset high
Object width low Object width high
http://ww
w.codem
onsters.de/
html/textures_cubem
aps.html
Jacob Lee
20
EnglishChineseArabicKorean UnknownTaiwaneseJapaneseHebrew
• Cubemap – Cloudy hills fromhttp://www.codemonsters.de/html/textures_cubemaps.html
• Distorting the cow. Then discarding parts of it.• Stuck on the Lens Effect – quad drawn in eye co-
ordinates, right in front of the eye. With parts discarded, then blended.
Flying CowKannan Jeyakuma
22
Code Bits
Cow Distortion - Vertex Displacementvec4 vert = gl_Vertex + vec4(sin(gl_Vertex.y*1*Distortion),-sin(gl_Vertex.z*2*Distortion),0,1)*t;
Lens Effect – Vertex Shadergl_Position = vec4(gl_Vertex.xy, 0.1, 1.0);
Fragment ShadersBasically use noise to calculate a threshold. Then discard some pixels. Then take the colors and mix them.
24
• The coordinates are in Cartesian form, but one dimension is fixed in each transformation.
• Convert from Cartesian to Polar, adjust the angle, then convert back.
Cartesian -> Polar Polar -> CartesianR=√(X2+Y2) X= R*cos(φ)φ=tan-1(Y/X) Y= R*sin(φ)
Bullet-Time Cow?
25
How-Now-Shader-Cow
“the lava cow” by William Brendel
Goal
• To create a “lava effect” shader, I need:– a noisy black-to-red-to-yellow texture
– some bump mapping on the cracks between lava and rocks
– a Phong illumination model
– a glow effect due to the lava heat diffusion
26
The lava texture
• First set the background to BLACK
• Then create an elliptical Polka dots pattern
• Displace the ellipses using Perlin noise
• Create a color ramp from RED on the edge to YELLOW on the center of each ellipse
Bump mapping
• On the edge of each ellipse, the normal should be almost tangent to the surface
• If equ = [(x-xcenter)/Ad]2 + [(y-ycenter)/Bd]2
• Normal = (1-equ)*Normal + equ*Tangent
• Use Gram-Schmidt equation to find the Tangent
27
Phong illumination model
• Illumination model based on Gouraud shading
Glow effect
• Multi pass in the shader to blur the silhouette
• Fake effect: add some lighting on the silhouette instead
• when dot(dirToEye,Normal) almost 0
28
ResultsGlow effect
on the silhouette
Phong illumination
Noisy “lava”procedural 3D texture
Bump mapping on
the edge
Russian Stacking Cow DollsJonathan Dodge
29
• First, noisify u,v coordinates• Compute an ellipse based on uv,vv• Do Noisy elliptical dots• … But only if a noise value is above a
threshold• Post-Processing (hooves/face/horns)• Lighting• Post-Post-Processing (slash a rectangular
hole in the side, using slightly noisy xyz)
Cow Coming Out of Warp
Ben Weiss
33
The Code
uniform sampler3D ascii_texture;uniform sampler2D image_texture;
uniform float size;uniform float inv_size;
void main(void){
vec3 lumRGB = vec3(0.3, 0.59, 0.11);
vec2 asciiBase = gl_TexCoord[0].ts * size;
vec4 image = texture2D(image_texture, (floor(asciiBase) + 0.5) * inv_size);
float luminance = dot(image.rgb, lumRGB);
vec3 index = vec3(luminance, asciiBase);
vec4 ascii = texture3D(ascii_texture, index);
vec4 result = ascii * image;
gl_FragColor = result;}
All The Other Stuff
• Convert 2D ASCII bitmap to 3D ASCII Texture
• Render Scene to Texture using Frame Buffer Objects http://www.gpgpu.org/developer/
34
Traditional Inventiveness
• Like many images, my cow was the result of a misunderstanding compounded by an accident shot through with typographic errors.
• But hey, it looked awesome.
Benjamin Brewster
Mistakes and Confessions
• My primary mistake was when I had programmed this line:
• noiseMagnitude = noise(xcomp(P) * 8.0) + noise(ycomp(P) * 8.0) + noise(zcomp(P) * 15.0)
• This causes noise, but is not “jaggy”– I tried everything I could do for jaggies.
35
Revelations
• Clearly, I was missing the concept of octaves.
• It’s the octaves that cause high detail, high resolution noise on top of the low detail curviness that is first octave noise.
Pretty Errors
Islands are results of Z component
36
Recriminations
• My final cow shot is not exactly the same shader… because I threw it away as a (pretty) mistake.
• The end result I found, though, looks like a circuit board, especially when colored correctly.
Proverbial proof-proving pudding
38
Procedural wooden texture applied over the cow.The wood is composed of light and dark areas alternating in concentric cylinders with noise added to warp the cylinders to create a more natural looking pattern.Pattern of the wooden texture is different in each rectangular piece as noise generated is dependent on the texture co-ordinates of each piece.
How Now Holo-cow
Will Dillon
39
Normal map; rgb = xyzapply the normal
matrixuse it as a color! ☺
Discard TheseDiscard These
Put the hologram herePut the hologram here
color = normalize( gl_NormalMatrix * textureColor );
Environment map Environment map reflectionsreflectionsnormal map normal map ““hologramhologram””
40
Nadia PayetTexture-based Bump-mapped cows
• Compute normal map of texture• Get texture coords of neighboring pixels
vec2 st1 = vec2(s+ds,t);
• Get corresponding colorvec4 c1 = texture2D(TexUnit,st1);
• Compute intensity of texture therefloat h1 = 0.299*c1.r + 0.587*c1.g + 0.114*c1.b;
• Normal is thenvec3 normal = vec3(20.*(h1-h2),20.*(h3-h4),1.);
h4
h1h2
h3
41
How to apply texture to cow• Used a sin function with frequency and phase
x = 0.5*(sin(x*Freq+Phase)+1.);y = 0.5*(sin(y*Freq)+1.);vec2 st = vec2(x,y);
• Still stretched around the head
Now apply bump-mapping • Read normals from normal map• Convert them to WC• Apply lighting with these
42
Wine Cow
William &
Nadia
First step – Glass cow
• Use Mike’s code of refractive cow• Add Phong illumination• Red reflection from wine on silhouette• Tune alpha value
– When shiny spot, alpha is close to 1.– When far from specular spot, alpha close to 0.
43
Second step – Wine
• Thought of doing the level with slider but– Setting vertex.y = level– Discarding when vertex.y > level
• So we chose to fix the level and use this model for the inside
Add red spot in the middle
• Use ellipse equation• Add noise• Mix colors according to distance from the
center of ellipse (fog equation)