demo reel

portfolio

resume

links

contact

 


Texture Mapping & Edge Detection

 

Image with Edge Detection and Aliased (Zoom)
The popping is very noticeable here, especially in the finer details of the image.

Original Image
(Background painting by Dutch artist Pieter Claesz, 1624.)
With Edge Detection
Sampling 2 Neighboring Pixels

  When only 2 neighboring pixels are sampled the edge is noticeably dimensional and we loose part of the edge.
With Edge Detection
Sampling 8 Surrounding Pixels
With Edge Detection
Sampling 8 Surrounding Pixels
With 8 sampled surrounding pixels the edge is better defined.


Code

/* simple shader for use in finding 
the edge for a texture map */
surface edge_mapper( float Kd = 1, s_offset = .005, t_offset = .005, sensitivity = .1, blur =.02, mixValue = .3, mixValue2 = .3, sampleRate = 1, lightness = 1; string texname = "") /*texture to apply to
object*/ { color edgeDetect = color(1, 1, 1); color surfcolor = color(1, 1, 1); float total = 0; float c1, c2, i, j, diff; /* Use the texture function if user specifies
a texture file*/
if(texname != "") { color textureMap = texture(texname,s,t)
* lightness; c1 = float texture(texname, s, t); /* Grab a surrounding sampling of pixels */ for(i = -sampleRate; i <= sampleRate;
i = i + 1) { for(j = -sampleRate; j <= sampleRate;
j = j + 1) { c2 = float texture(texname, s +
(i*s_offset), t + (j*t_offset)); diff = abs(c1-c2); total += diff; } } /*surfcolor = smoothstep(-blur, blur, 1 -
sqrt(total) - sensitivity);*/ edgeDetect = 1 - smoothstep(-blur, blur, 1 -
sqrt(total) - sensitivity); /* Mix the edge with the original image*/ surfcolor = mix(edgeDetect,textureMap,mixValue); } normal n = normalize(N); normal nf = faceforward(n, I); /* */ Oi = Os; color diffusecolor = Kd * diffuse(nf); Ci = Oi * Cs * surfcolor * diffusecolor; }

 





 

 

 

Portfolio


rendering
& shading


projects     

programming     

fine art    

model concepts     

studies     


                             

 

                                   © 2004-2008 by Carrie Jones. All Rights Reserved.