3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository 3D graphics eBook - Course Materials Repository

courses.essex.ac.uk
from courses.essex.ac.uk More from this publisher
07.01.2013 Views

Procedural texture 123 } for (scale = 1; scale > twice; scale /= 2) turbulence += scale * noise(PP/scale); /* Gradual fade out of highest-frequency component near limit */ if (scale > pixelsize) { } /* weight = (scale / pixelsize) - 1; weight = clamp(weight, 0, 1); turbulence += weight * scale * noise(PP/scale); * Magnify the upper part of the turbulence range 0.75:1 * to fill the range 0:1 and use it as the parameter of * a color spline through various shades of blue. */ csp = clamp(4 * turbulence - 3, 0, 1); Ci = color spline(csp, color (0.25, 0.25, 0.35), /* pale blue */ color (0.25, 0.25, 0.35), /* pale blue */ color (0.20, 0.20, 0.30), /* medium blue */ color (0.20, 0.20, 0.30), /* medium blue */ color (0.20, 0.20, 0.30), /* medium blue */ color (0.25, 0.25, 0.35), /* pale blue */ color (0.25, 0.25, 0.35), /* pale blue */ color (0.15, 0.15, 0.26), /* medium dark blue */ color (0.15, 0.15, 0.26), /* medium dark blue */ color (0.10, 0.10, 0.20), /* dark blue */ color (0.10, 0.10, 0.20), /* dark blue */ color (0.25, 0.25, 0.35), /* pale blue */ color (0.10, 0.10, 0.20) /* dark blue */ ); /* Multiply this color by the diffusely reflected light. */ Ci *= Ka*ambient() + Kd*diffuse(Nf); /* Adjust for opacity. */ Oi = Os; Ci = Ci * Oi; /* Add in specular highlights. */ Ci += specularcolor * Ks * specular(Nf,V,roughness); This article was taken from The Photoshop Roadmap [5] with written authorization

Procedural texture 124 References [1] http:/ / www. spiralgraphics. biz/ gallery. htm [2] Ebert et al: Texturing and Modeling A Procedural Approach, page 10. Morgan Kaufmann, 2003. [3] Ebert et al: Texturing and Modeling A Procedural Approach, page 135. Morgan Kaufmann, 2003. [4] Ebert et al: Texturing and Modeling A Procedural Approach, page 547. Morgan Kaufmann, 2003. [5] http:/ / www. photoshoproadmap. com Some programs for creating textures using Procedural texturing • Allegorithmic Substance • Filter Forge • Genetica (program) (http:/ / www. spiralgraphics. biz/ genetica. htm) • DarkTree (http:/ / www. darksim. com/ html/ dt25_description. html) • Context Free Art (http:/ / www. contextfreeart. org/ index. html) • TexRD (http:/ / www. texrd. com) (based on reaction-diffusion: self-organizing textures) • Texture Garden (http:/ / texturegarden. com) • Enhance Textures (http:/ / www. shaders. co. uk) 3D projection 3D projection is any method of mapping three-dimensional points to a two-dimensional plane. As most current methods for displaying graphical data are based on planar two-dimensional media, the use of this type of projection is widespread, especially in computer graphics, engineering and drafting. Orthographic projection When the human eye looks at a scene, objects in the distance appear smaller than objects close by. Orthographic projection ignores this effect to allow the creation of to-scale drawings for construction and engineering. Orthographic projections are a small set of transforms often used to show profile, detail or precise measurements of a three dimensional object. Common names for orthographic projections include plane, cross-section, bird's-eye, and elevation. If the normal of the viewing plane (the camera direction) is parallel to one of the primary axes (which is the x, y, or z axis), the mathematical transformation is as follows; To project the 3D point , , onto the 2D point , using an orthographic projection parallel to the y axis (profile view), the following equations can be used: where the vector s is an arbitrary scale factor, and c is an arbitrary offset. These constants are optional, and can be used to properly align the viewport. Using matrix multiplication, the equations become: . While orthographically projected images represent the three dimensional nature of the object projected, they do not represent the object as it would be recorded photographically or perceived by a viewer observing it directly. In particular, parallel lengths at all points in an orthographically projected image are of the same scale regardless of whether they are far away or near to the virtual viewer. As a result, lengths near to the viewer are not foreshortened as they would be in a perspective projection.

Procedural texture 123<br />

}<br />

for (scale = 1; scale > twice; scale /= 2)<br />

turbulence += scale * noise(PP/scale);<br />

/* Gradual fade out of highest-frequency component near limit */<br />

if (scale > pixelsize) {<br />

}<br />

/*<br />

weight = (scale / pixelsize) - 1;<br />

weight = clamp(weight, 0, 1);<br />

turbulence += weight * scale * noise(PP/scale);<br />

* Magnify the upper part of the turbulence range 0.75:1<br />

* to fill the range 0:1 and use it as the parameter of<br />

* a color spline through various shades of blue.<br />

*/<br />

csp = clamp(4 * turbulence - 3, 0, 1);<br />

Ci = color spline(csp,<br />

color (0.25, 0.25, 0.35), /* pale blue */<br />

color (0.25, 0.25, 0.35), /* pale blue */<br />

color (0.20, 0.20, 0.30), /* medium blue */<br />

color (0.20, 0.20, 0.30), /* medium blue */<br />

color (0.20, 0.20, 0.30), /* medium blue */<br />

color (0.25, 0.25, 0.35), /* pale blue */<br />

color (0.25, 0.25, 0.35), /* pale blue */<br />

color (0.15, 0.15, 0.26), /* medium dark blue */<br />

color (0.15, 0.15, 0.26), /* medium dark blue */<br />

color (0.10, 0.10, 0.20), /* dark blue */<br />

color (0.10, 0.10, 0.20), /* dark blue */<br />

color (0.25, 0.25, 0.35), /* pale blue */<br />

color (0.10, 0.10, 0.20) /* dark blue */<br />

);<br />

/* Multiply this color by the diffusely reflected light. */<br />

Ci *= Ka*ambient() + Kd*diffuse(Nf);<br />

/* Adjust for opacity. */<br />

Oi = Os;<br />

Ci = Ci * Oi;<br />

/* Add in specular highlights. */<br />

Ci += specularcolor * Ks * specular(Nf,V,roughness);<br />

This article was taken from The Photoshop Roadmap [5] with written authorization

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!