View
216
Download
2
Tags:
Embed Size (px)
Citation preview
Realistic RenderingRealistic Rendering
Pavel ZemčíkPavel ZemčíkDepartment of Computer Science and Engineering,Department of Computer Science and Engineering,
Faculty of Electrical Engineering and Computer Faculty of Electrical Engineering and Computer Science,Science,
Technical University of Brno,Technical University of Brno,
Czech RepublicCzech Republic
[email protected]@dcse.fee.vutbr.cz
What is realistic What is realistic rendering?rendering?
Realistic (photo-realistic) rendering Realistic (photo-realistic) rendering is the process of production of is the process of production of photograph-like images from a 3D photograph-like images from a 3D modelmodel
• Measure of “realism” is humanMeasure of “realism” is human
• Affected by wide range of factorsAffected by wide range of factors
The realistic rendering The realistic rendering needsneeds
• Models of objects, environment, and Models of objects, environment, and lightlight
• Light features (particle and wave Light features (particle and wave effects)effects)
• Fine structure of objectsFine structure of objects’’ surface surface
• The material features (e.g. for glass)The material features (e.g. for glass)
Is realistic rendering Is realistic rendering possible?possible?
NO!!! True realism is not possibleNO!!! True realism is not possible
• Accurate models not availableAccurate models not available
• Light features impossible to modelLight features impossible to model
• Any close approximation very Any close approximation very demandingdemanding
• Very rough approximations usedVery rough approximations used
Rough realistic renderingRough realistic rendering
The approximations usually assumeThe approximations usually assume
• empty space between objectsempty space between objects
• no particle or wave light effectsno particle or wave light effects
• simple scene geometry and lightssimple scene geometry and lights
• simple materials and surfacessimple materials and surfaces
Models of 3D scenesModels of 3D scenes
Constructive Solid Constructive Solid GeometryGeometry
Constructive Solid Geometry (CSG) Constructive Solid Geometry (CSG) is a method for representing the 3D is a method for representing the 3D objectsobjects
• tree structure (binary or n-ary)tree structure (binary or n-ary)
• primitive objects in the leavesprimitive objects in the leaves
• CSG (set) operations in other nodesCSG (set) operations in other nodes
CSG - exampleCSG - example
CSG operationsCSG operations
CSG operations are generally set CSG operations are generally set operations on 3D objectsoperations on 3D objects’ volumes’ volumes
• unary operation unary operation (not) (not)
• binary operations binary operations (intersection, and) (intersection, and) (union, or) \ (difference) (union, or) \ (difference)
• operations can be extended to n-aryoperations can be extended to n-ary
CSG surface exclusionCSG surface exclusion
CSG objects sometimes do not CSG objects sometimes do not include the surface (for include the surface (for mathematical purity)mathematical purity)
In such case, e.g. CSG union can be In such case, e.g. CSG union can be defined as:defined as:
}),,(,0|{
),(
YtXtxotx
YXCSG
CSG - 3D exampleCSG - 3D example
CSG - 3D rendered CSG - 3D rendered exampleexample
CSG - 3D simple exampleCSG - 3D simple example
CSG - 3D fractal exampleCSG - 3D fractal example
CSG - 3D glass exampleCSG - 3D glass example
CSG - 3D complex CSG - 3D complex exampleexample
Rendering methods - Rendering methods - objectsobjects
• The objects are processed in a The objects are processed in a sequencesequence
• No objects interaction - no shadowsNo objects interaction - no shadows
Rendering methods - Rendering methods - pixelspixels
• The pixels are processed in a The pixels are processed in a sequencesequence
• No global interaction - no half-No global interaction - no half-shadowsshadows
Rendering methods - Rendering methods - scenescene
• The complete scene is processedThe complete scene is processed• Very complex - no sharp shadowsVery complex - no sharp shadows
Rendering methods Rendering methods comparisoncomparison
Object Pixel Scene
Z-buffer -3D boards
Ray tracingray casting
Radiationparticle tracing
low realism high realism highest realism
very fast (0.01-0.1s) slow (100-1000s) very slow (hours)
no shadows sharp shadows only smooth shadows
CAD drawings,games, virtual reality,3D modelling
realistic images ofgeometrical objects,
medical imaging
realistic images, pre-calculation forgames, etc.
Radiosity principleRadiosity principle
• Get form factorsGet form factors• Assign lightsAssign lights• Solve equationSolve equation• Render usingRender using
a pixel methoda pixel method
nn
n
nn l
l
l
x
x
x
x
x
f
f
fff
ff
0
0
10
00
2
1
1
3
2
1
32
232221
1211
Ray tracing principleRay tracing principle The image is created by evaluation of The image is created by evaluation of
content of each of the picture elementscontent of each of the picture elements
Durer A.: The Art of Measurement, Volume IV, The Netherlands, 1538Durer A.: The Art of Measurement, Volume IV, The Netherlands, 1538
Ray tracing algorithmRay tracing algorithm
For each pixelFor each pixel
• send a ray eye send a ray eye pixel pixel scene scene
• calculate what can be seencalculate what can be seen
• calculate the value of the pixel -calculate the value of the pixel -
• if necessary, proceed recursivelyif necessary, proceed recursively
Ray tracing - secondary Ray tracing - secondary raysrays Secondary rays are necessary for Secondary rays are necessary for
evaluation of shadows and mirrorsevaluation of shadows and mirrors
Sending a raySending a ray
• Simple task, involves 3D projective Simple task, involves 3D projective transformationtransformation
Geometry - what can be Geometry - what can be seenseen
• Very complex task, in naive approach it Very complex task, in naive approach it involves calculation of intersection of the involves calculation of intersection of the ray with all objects in the sceneray with all objects in the scene
(intersection often involves quadratic (intersection often involves quadratic equation solution, or similar task)equation solution, or similar task)
Estimated complexity: (P+S)*NEstimated complexity: (P+S)*N
e.g. (256x256+3*256x256)*1024=256Me.g. (256x256+3*256x256)*1024=256M
Calculation of pixel valueCalculation of pixel value
• Depends on the local light modelDepends on the local light model
Basic models include e.g.Basic models include e.g.
• flat modelflat model
• diffusiondiffusion
• Phong modelPhong model
• mirrormirror
Geometry - sphereGeometry - sphere
Geometry - sphere Geometry - sphere equationsequations
• DefinitionDefinition
• Intersection (note that |d|=1)Intersection (note that |d|=1)
oror
• Normal vectorNormal vector
}0)(|{=S 22 rpxx
0)( 22 rt pds
0))(())((2 222 rtt pspsd
dsy 1t
pyn
dsy 2t
Geometry - halfspaceGeometry - halfspace
Geometry - halfspace Geometry - halfspace equationsequations
• Definition (note that p·n is constant)Definition (note that p·n is constant)
• IntersectionIntersection
• Normal vector (already in definition)Normal vector (already in definition)
}0p|{H nnxx
0p)( nnds t
ndnsn
p
t
dsy t
n
Geometry - cylinderGeometry - cylinder
Geometry - cylinder Geometry - cylinder equationsequations
• DefinitionDefinition
• Intersection (substitution l=s-p, |d|=1)Intersection (substitution l=s-p, |d|=1)
• Normal vector (intersection reused)Normal vector (intersection reused)
}))(()(|{=C 222 r pxvpxx
222 ))(()( rtt pdsvpds
0))(())())((())(1( 22222 rtt ldlldlvvdvd
])()))((()())(([ 222 ddvdvldvdvln r
Geometry - Quadric Geometry - Quadric equationsequations
• DefinitionDefinition
• Intersection (dIntersection (d’’, s, s’ are d, s in 4D)’ are d, s in 4D)
• NormalNormal
}0 |{G xQxx t
0) )(() )((2) )(( 2 sQsdQsdQd ttt tt
)]) (
,) (
,) (
[(dzdydx
ttt xQxxQxxQxn
Geometry - CSGGeometry - CSG
Geometry - CSG algorithmGeometry - CSG algorithm
• Shoot a ray & Convert sets to Shoot a ray & Convert sets to intervalsintervals
• Apply CSG operations to intervalsApply CSG operations to intervals
• or Convert to simpler list operationsor Convert to simpler list operations
• Get the “realGet the “real” intersection” intersection
ReferencesReferences
• Gouraud H: Continouous Shading of Curved Surfaces, IEEE Gouraud H: Continouous Shading of Curved Surfaces, IEEE Transactions on Computer Graphics, n. 6, vol. C-20, june Transactions on Computer Graphics, n. 6, vol. C-20, june 1971, USA, pp. 623-6291971, USA, pp. 623-629
• Foley J D, Van Dam A: Fundamentals of Interactive Computer Foley J D, Van Dam A: Fundamentals of Interactive Computer Graphics, Addison-Wesley 1983, USAGraphics, Addison-Wesley 1983, USA
• Goral C M, Torrance K E, Greenberg D P, Battaile B: Goral C M, Torrance K E, Greenberg D P, Battaile B: Modelling The Modelling The Interaction of Light Between Diffuse Interaction of Light Between Diffuse Surfaces, sborník SIGGRAPH '84, ACM Computer Graphics, Surfaces, sborník SIGGRAPH '84, ACM Computer Graphics, USA, 1984USA, 1984
• Watt A, Watt M: Advanced Animation and Rendering Watt A, Watt M: Advanced Animation and Rendering Techniques, Addison-Wesley 1992, USA, str. 33-64Techniques, Addison-Wesley 1992, USA, str. 33-64
The The endend