surface detail and non-photorealistic rendering lecture 3 (rendering)

15
Surface Detail and Surface Detail and Non-PhotoRealistic Rendering Non-PhotoRealistic Rendering Lecture 3 (Rendering)

Upload: shanon-reynolds

Post on 30-Dec-2015

224 views

Category:

Documents


1 download

TRANSCRIPT

Surface Detail and Surface Detail and Non-PhotoRealistic RenderingNon-PhotoRealistic Rendering

Lecture 3 (Rendering)

Section I: Surface DetailSection I: Surface Detail

So far, we have assumed perfectly smooth, uniformly coloured surfaces.

This is unrealistic. In reality surfaces are: Multi-coloured (e.g. a painting, bottle label, page in a book), bumpy

(e.g. almost every surface, few things are perfectly smooth), and textured (e.g. wood, leaves)

Without Surface Detail With Surface Detail

Surface Detail PolygonsSurface Detail Polygons

Overlay co-planar polygons (e.g. doors, windows) onto a base polygon (e.g. a wall).

In visible surface determination, surface-detail polygons are ignored.

In rendering, the surface-detail polygons take precedence over the base.

Not a serious contender. Only good for broad scale detail.

Basic Texture MappingBasic Texture Mapping

A texture is simply an image (or a procedure for generating an image), with a 2D co-ordinate system.

Each 3D object is parametrized in 2D texture space. Pixels map to part of an object’s surface. That part of the surface maps to a portion of the texture. Can be visualized as wrapping an image around an object.

),( vu

Parametrizing a PrimitiveParametrizing a Primitive

Parametrization: Polygon: Assign co-ordinates to each vertex Plane: Give -axis and -axis directions in the plane. Cylinder: One axis goes up the cylinder, the other axis around. Surface: Assign each parameter of a surface to and .

(e.g. )

Other Issues: Sliding: The texture can be translated, rotated and scaled relative to a

surface by an affine co-ordinate transformation of . Seams: If the texture joins without visual discontinuity across opposite

edges then repetition can be used to cover an entire object with a single small texture.

Interpolation: During polygon scan conversion care must be taken in interpolating texture co-ordinates. Have to compensate for perspective projection so that the texture is correctly foreshortened.

),( tsQvtus ,

),( vu

),( vu

v

u v

u

Sampling IssuesSampling Issues

Basic approach assumes square texel (texture element) geometry. This produces poor visual results.

Alternative: Treat each texel (texture element) in a texture map as an (r,g,b) value at a point.

A projected pixel may:

Cover Several Texels Fall between Texels (oversampling) (undersampling)

Handling UnderSamplingHandling UnderSampling

The texture co-ordinates of the pixel’s centre are found.

The value at this point in the texture map is a combination of surrounding texels.

Interpolation Methods:1. Nearest neighbour: the pixel value is that of the nearest texel.

[Fast with many artefacts]

2. Bilinear reconstruction: the pixel value is the weighted mean of the surrounding texels. [Reasonably fast but blurry]

3. Biquadratic reconstruction: use a quadratic function of distance to weight the mean [slower, good results]

4. Bicubic reconstruction [even slower, slightly better results]

Handling OverSamplingHandling OverSampling

There are several solutions if the pixel covers a large area of the texture:1. Basic Area: Texels are treated as rectangles. Their contribution is

weighted by the texel area covered by a pixel.

2. Filters: A filter (e.g. Gaussian) is used, centred on the pixel centre. Can be very expensive if a single pixel covers a large area of the texture map.

3. Multi-resolution Textures: Store multiple versions of the same texture at different resolutions. Use interpolation between maps to get pixel values. MIP Maps (Multum in Parvo – many things in a small space) are an efficient way to store these textures.

SummarySummary

What can a texture map modify? Any, or all, of the colour components Transparency reflectivity

Problems:1. Veneer Effect: textures appear to be wall-papered onto

the surface. Looks unrealistic in carved objects.

2. Seams: The match between the shape of a texture (rectangular) and object may cause visible distortion and seams. Classic case: a globe.

3. Bumpy surfaces: A lot of texture is caused by bumps on the surface.

Bump MappingBump Mapping

The surface normal is used in calculating both diffuse and specular reflection.

Bump mapping modifies the direction of the surface normal so that the surface appears more or less bumpy.

A 2D function (bump map) can be used to vary the surface normal smoothly across the plane.

But bump mapping doesn’t change the object’s silhouette. Displacement mapping fixes this by actually adjusting the

position of vertices in polygonal fragments but it is very expensive.

Solid TexturesSolid Textures

Texture mapping applies a 2D texture to a surface

Solid textures have colour defined for every point in space

Permits the modelling of objects that appear to be carved from a solid material (e.g. wood, marble).

Simplifies the mapping to texture space.

However, creating 3D texture maps cannot be done by hand. It requires procedural textures (e.g. fractals).

From Perlin, K. “An Image Synthesizer”, SIGGRAPH 1985

Exercise: Procedural TexturesExercise: Procedural Textures

Given the following functions:

Design the following procedural texture functions, taking a point and returning a colour :1. A marble texture

Marble consists of heterogeneous layers. The marble look derives from turbulent forces which create deformations before these layers solidify. Given: a colour ramp

2. A water texture Create a spherical wave front which emenates from a centre and perturbs the normal at a point towards the centre using a cycloidal function. Given: a specular water shader

CPT )(

PPRandom )(cossin,

CWPT ),(]1,0[,)( sCsmarble

P C

WP

CVwater )(

Solution: Procedural TexturesSolution: Procedural Textures

1. Marble

2. Water

marble(s)PPsPrandomP

PT

xx

return 0.2/)0.1)(sin(

)()(

))sin(*()(

)(

),(

lNwaterreturnVlengthl

VnormalizeNWPV

WPT

Section II: Non-PhotoRealistic Section II: Non-PhotoRealistic Rendering and AnimationRendering and Animation

Computer Graphics has generally striven for heightened realism.

An alternative: concentrate on the aesthetics of the image. Artistic effects: loosely simulate oil or pastel paintings, or

pen and ink illustrations. Achieve artistic effects:

Variations in brush stroke size, direction, colour and texture allow abstraction (downplay artistically unimportant aspects), rhythm (sense of energy), focus (emphasize artistically important aspects) and mood.

But must avoid: Introducing too much noise or loosing coherence between frames of

an animation.

‘‘What Dreams May Come’What Dreams May Come’

‘Painted world’ relying on 19th C. art ranging from Germanic Romanticism to Stained Glass Impressionism.

Requirements:1. Needed to allow interaction between actor and painted

environment.

2. Didn’t want an image-based technique prone to a shower-door effect.

Before VFX Post-Production After VFX Post-Production