41
03/28/03 © 2005 University of Wisc onsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly Rendering with Curved Brush Strokes of Multiple Sizes”, Aaron Hertzmann, SIGGRAPH 98 “An Algorithm For Automatic Painterly Rendering Based On Local Source Image Approximation”, Michio Shiraishi and Yasushi Yamaguchi, NPAR 2000

03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Embed Size (px)

Citation preview

Page 1: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/28/03 © 2005 University of Wisconsin

NPR Today

• “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990

• “Painterly Rendering with Curved Brush Strokes of Multiple Sizes”, Aaron Hertzmann, SIGGRAPH 98

• “An Algorithm For Automatic Painterly Rendering Based On Local Source Image Approximation”, Michio Shiraishi and Yasushi Yamaguchi, NPAR 2000

Page 2: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Comprehensible Rendering of 3-D Shapes

Takafumi Saito and Tokiichiro Takahashi

SIGGRAPH 1990

Page 3: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Comprehensible Rendering

• Focus on conveying information, rather than realism

• Goal: A range of enhancements to “standard” shaded models– Edge enhancement, contour lines,

hatching, …

Page 4: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

G-buffers

• Extend color and depth buffers with additional images– Objects identifiers

– Parameters

– World coordinates

– Normal vectors

– …

normals z & uv

Page 5: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Getting G-buffers

• Almost any algorithm can be modified to produce G-buffers– Ray-tracing – get info from hit points

– Hardware – use programmable shaders

• Common technique now, but done here first

• PBRT has almost all the required information available

Page 6: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Algorithms

• Shading

• Edges/Silhouettes– Find discontinuities in depth

• Hatching– Trace parameter lines

• Contours– Trace lines of constant depth

Page 7: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Finding Edges

• Use edge detection filters on the depth image– Look for places with rapid change in

depth

– Tuning the filters provides control of extracted edges

• Then just draw edges, or add back into result

Page 8: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Contours and Hatching

• Trace lines of constant z to get screen-space contours

• Or, use world coordinate image to get world-space contours

• Control spacing to get hatching

z=xy

Page 9: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Shading

• World coordinates and normals enable shading

• Or, use any procedural shading algorithm

• Note meta-information is required– e.g. Materials associated with polygon

IDs

Shading & contours

Page 10: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

More Results

Page 11: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

More Results

Page 12: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Limitations

• All results to image precision– May lose contour lines, or they may be hard to track

– Use floating point images to help resolve this

– Use layered images (multiple surfaces at each pixel)

• Not all algorithms are amenable to fast hardware implementation

Page 13: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Future Work

• The ideas from this paper re-emerged in many different algorithms– Generating an image of visible surface IDs was most common

(could be done on earliest hardware)

• Hardware fragment shaders have made much of this redundant– For example, can easily get contour images or false-color

Page 14: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Page 15: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Painterly Rendering with Curved Brush Strokes of Multiple Sizes

:Aaron Hertzmann(SIGGRAPH 98 paper)

Presented by: Arup Dutta

Page 16: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Painterly rendering

• Objective: Creating an image with a hand-painted appearance from a photograph

• Pictorially:

From this: Produce this:

Page 17: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Key Concept

• Painters use varying brush sizes to capture detail:

Page 18: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Algorithm equivalent

• Procedure:– Build painting one layer at a time, from biggest to smallest radius

brushes

– At each layer, add detail missing from previous layer

• Source image= Original photograph

• Reference image= Gaussian blurred image

• 3 functions cover this algorithm

Page 19: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

function paint(sourceImage, R1…Rn)

Page 20: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

procedure paintLayer(canvas, referenceImage, R)

• canvas is the image we are updating layer by layer. referenceImage is the Gaussian blurred form of source image

• Determine grid size for given radius

• For each pixel of referenceImage calculate area error for grid size. If it is above a certain value, find pixel within grid with largest difference between canvas and referenceImage– Apply makeStroke() algorithm for this point and store the stroke returned.

• After exiting above ‘for loop’, paint all strokes on the canvas.

Gaussian blurred reference image

Eucledean difference of r,g,b distances

Page 21: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

function makeStroke(x0,y0,R,refImage)

• Generic procedure for placing stroke on canvas

• Places a circle of radius R at the location x0,y0

• Disadvantage: Circles very visible

Page 22: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

function makeSplineStroke(x0,y0,R,refImage)

• makeSplineStroke(x0,y0,R,refImage): Makes image closer to what a typical painting would look like, by:– Placing long, curved brush strokes, thus eliminating a regular uniform

stroke appearance

– Placing many small brush strokes in high frequency information region, and placing large brush strokes over areas with little detail.

Page 23: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

function makeSplineStroke(x0,y0,R,refImage)

• Brush strokes of constant color

• Stroke placement normal to image gradient

• Stroke stops when – color deviates from control point by more than specified threshold

OR

– predetermined stroke length is reached

• Stroke points are separated by brush radius distance R.

• E.g.

Image gradient

Stroke direction

Page 24: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

function makeSplineStroke(x0,y0,R,refImage)

Page 25: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Examples

• Style can be changed by changing parameters of the algorithm such as brush radius, thresholds, adding random jitter etc.

Page 26: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Future Work

• No one ‘right’ algorithm. Future work should continue to extend strategies to rendering algorithms.

• Brush strokes could be further developed to convey physical as well as semantic elements

• Real time rendering where rendering style changes with mood or action

Page 27: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

© 2005 University of Wisconsin

Questions???

Source: UW Madison- CS 559 Spring ’04 Painterly Rendering Assignment sample solution software

Page 28: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/03 © 2005 University of Wisconsin

Page 29: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

03/15/0303/15/03 © 2005 University of Wisconsin© 2005 University of Wisconsin

An Algorithm For Automatic Painterly RenderingBased On Local Source Image Approximation

Authors Michio Shiraishi Yasushi Yamaguchi

Page 30: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Goals:Goals:

Automatic Painterly RenderingAutomatic Painterly Rendering Synthesize an image with a handcrafted Synthesize an image with a handcrafted

look from a source image like a look from a source image like a photograph.photograph.

Intensive use of local region of source Intensive use of local region of source image.image.

High emphasis on color information.High emphasis on color information.

Page 31: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Previous Work:Previous Work:

Paul Haeberli developed interactive system where Paul Haeberli developed interactive system where users could place strokes on a canvas.users could place strokes on a canvas.

Barbara Meier introduced 3D model support, Barbara Meier introduced 3D model support, painting order is based on depth.painting order is based on depth.

Aaron Hertzmann used brush strokes represented Aaron Hertzmann used brush strokes represented by spline curves. Composite image with several by spline curves. Composite image with several layers of strokes.layers of strokes.

Page 32: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Process:Process:

Vary stroke size over the canvas. Details are Vary stroke size over the canvas. Details are represented by small strokes, flat areas with represented by small strokes, flat areas with larger strokes.larger strokes.

Determine location, orientation, width and length Determine location, orientation, width and length of each stroke to approximate the local region of of each stroke to approximate the local region of source image.source image.

Paint strokes on order of size.Paint strokes on order of size.

Page 33: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Color Difference Image:Color Difference Image:

One value set by user is One value set by user is ss which is the length and width which is the length and width of the local region.of the local region.

Grayscale image based on how far local region image is Grayscale image based on how far local region image is from stroke color.from stroke color.

Intensity is larger the closer the image color is to the Intensity is larger the closer the image color is to the stroke color.stroke color.

Stroke color is white in this example.

Color image Resulting Gray-scale image

Page 34: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Brush Stroke Properties:Brush Stroke Properties:

Color: Color: The color The color CC in RGB of stroke. in RGB of stroke.

Location: Location: The location of The location of thethe stroke center stroke center (x(xcc,,yycc).).

Orientation: Orientation: The angle between the longest The angle between the longest axis of stroke and x-axis of canvas.axis of stroke and x-axis of canvas.

Size: Size: The size of stroke, length The size of stroke, length ll and width and width ww..

Page 35: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

How to find these values?:How to find these values?:

Image moments are used. Image moments are defined Image moments are used. Image moments are defined on a gray-scale image.on a gray-scale image.

Image moments of 0Image moments of 0thth, 1, 1stst, and 2, and 2ndnd degree are used. degree are used. Use these values to find the length, width, location, and Use these values to find the length, width, location, and

orientation of the stroke.orientation of the stroke.

The result is two images with the same image moments.

Gray-scale image Resulting Stroke

Page 36: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Stroke Painting ProcessStroke Painting Process

Scale texture image to fit length and width of Scale texture image to fit length and width of stroke.stroke.

Rotate scaled image by Rotate scaled image by θθ

Translate scaled and rotated image by Translate scaled and rotated image by (x(xcc,y,ycc).).

Paint the stroke with color Paint the stroke with color CC by alpha by alpha blending.blending.

Page 37: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Algorithm:Algorithm:

Stroke Area Stroke Area Estimation:Estimation: Calculate Calculate MM0000 for each for each

pixel with-in local pixel with-in local region region ss..

Page 38: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Algorithm:Algorithm:

Sampling Points Sampling Points Generation:Generation: Murray space filling Murray space filling

polygon to dither polygon to dither image.image.

For each pixel, 1/For each pixel, 1/MM0000 is is summed up until it summed up until it reaches a certain reaches a certain number.number.

Then that pixel is a Then that pixel is a sample pixel.sample pixel.

Page 39: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Algorithm:Algorithm:

For each sampling point, For each sampling point, calculate the color calculate the color difference image.difference image.

From color difference From color difference image, calculate the image, calculate the stroke values.stroke values.

Paint strokes on white Paint strokes on white canvas, largest ones first. canvas, largest ones first. Larger meaning greater Larger meaning greater area.area.

Page 40: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Results:Results:

2500 Strokes 5000 Strokes 7500 Strokes 10000 Strokes

Original s=25, 11048 Strokes s=15, 9673 Strokes

Page 41: 03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly

Future Work:Future Work:

Make the algorithm calculate the Make the algorithm calculate the ss value of the value of the local region size.local region size.

Calculate the minimum number of strokes to Calculate the minimum number of strokes to cover entire canvas.cover entire canvas.