高级计算机图形学ACG_第1页
高级计算机图形学ACG_第2页
高级计算机图形学ACG_第3页
高级计算机图形学ACG_第4页
高级计算机图形学ACG_第5页
已阅读5页,还剩95页未读, 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Spheremapping

alightprobe

http:〃/HDRShop/tutorial/tutorial5.html

Frameofreference

•Accessthespheremap&hyhz0、

U

"xy"z°

fXfyfy0

(0001,

•Transformthesurfacenormalnandvectorefromthe

currenteyepositionusingthismatrix

•nand/inthespheremap5space

r-ey-2(〃

Spheremapping

n/

(QA1)t

rhy/h\toeye加="+-;+(「+1)2

G「+1)

n——,—,---

、mmm

^rigin_________________________y

Spheremapping

•Ifthesphereisatoriginanditsradiusis1

-theunitnormal'scoordinates=the

locationh

-Noneedforhz

•也,4)describeapointonasphere

image,intherange[-1,1].

•Mapthecoordinateto[0,1]

u=-^-+0.5;v=—^-+0.5

2m2m

Spheremapping

•SpheremappingisanimprovementoverBlinnand

NewelPsmethodinanumberofways

-Notextureseamtointerpolateacross

-canbeimplementedonanygraphicshardwarethatsupports

texturemapping

•DisadvantagestotheSpheremapping

-movingbetweentwopointsonthespheremapisnotlinear

-Sphereisvalidforonlyasingleviewdirection.

Paraboloidmapping

•Paraboloidmapping

-ByHeidrichandSeidel

-usingtwoenvironmenttextures

-Eachparaboloidcreatesacirculartexture

similartoaspheremap

•coveranenvironmenthemisphere

Dualparaboloidapproach

Parabolicbasis

Requirestwotextureimages

DualParaboloidMap

Whichofthetwotexturetoaccess?

Signoftherz

Paraboloidmapping

•Paraboloidmapping

-Hardwareshouldsupport

•properprojectivetexturecoordinatetransformation

yA

•interpolation011fX

0111ry

u=——-----F0.5;v=-----------b0.500001

2(1+h2(1+c)

<0022八'z/

•Themaindrawbackofparaboloidmapping

-makingthemapsthemselvesisdifficult

•bywarpingimages

•byusingraytracing

LightingUsingEnvironmentMapping

•Animportantuseofenvironmentmappingtechniquesis

generatingspecularreflectionsandrefractions.

•Environmentsmappingcansolvethehighlightingbyrepresenting

thelightsinthetexture.

Per-pixelspecularLightingusingEnvironmentmappingof

highlightenvironmentmappingentiresurroundingscene

Recursivereflections

•Recursivereflectionsdonewithenvironmentmapping

StumblingblockofEM

•Flatsurfaceusuallydonotworkwell

-raysreflectedoffofitusuallydonotvarybymorethanafew

degrees

-SmallpartofEMtexture'sbeingmappedontoarelativelylarge

surface

-Asmallpartoftextureismagnified

Diffuse,GlossandReflectionMapping

•TousereflectionmappingwithGlossandDiffuse

colortexturing

•TheLightingmodel

o=t1

diff®diff+gloss「spec

RGBtextureMonochrome

glosstexture

Pearexample

Multi-textureexample

RGBdiffuseRGBreflection

texturemaptexture

•Thelightingmodelcanbe

computedusingtwotexture

「specstages

-2RGBcolorinputs

-upto2alphainputs

RGBRGB

StageI"Stage2v•Stage1

diffuselightARGB-Theinterpolateddiffusecolor

'diff------reflectionmap

Xtextureresult

RGBRGBXglossandthepearskin'sRGB

+diffuseRGBtexturearethetwocolorinputs

retrievegloss

alphataffXidiff

alpha-Glossmaptexurevalueinthe

alphachannel

•Stage2:

lglossspecXtgios.

singlechannelo=diff区'diff+'gloss丫spec

glossmap

Bumpmapping

•Bumpmapping

-byBlinnin1978

-Inexpensivewayofsimulatingwrinklesandbumpsongeometry

•Tooexpensivetomodelgeometrically

-letatexturemodifythenormalateachpixel

•usethisnormaltocomputelighting

7/7/

Bumpmappedgeometr

Height-fieldbumpimageanditsuseonasphere

OffsetmapHeight-fieldmap

•Normalvectorn

-modifiedintheuandvdirections

-bythebufbvvaluestakenfromthebumptexture

Offsetvectorbumpmap

•Offsetmap

-Storesinatexturetwosigned

values,bandb,ateach

uv

point

-Correspondtotheamountto

varythenormalalongtheu

andvimageaxes

-Usedtoscaletwovectors

thatareperpendiculartothe

normal

Height-fieldbumpmap

•Height-fieldbumpmap

Eachmonochrometexture

valuerepresentasurface

height

•whitetoahigharea

•blacktoalowone

Theheightfieldisusedto

deriveuandvsignedvalues

•Thedifferencesbetween

neighboringcolumnstogetthe

slopesforuandbetween

neighboringrowsforv

ArtifactofusingBumpmap

•Bumpmapping

-Per-pixelbumpmappingisextremelyconvincing

-offersaninexpensivewaytoaddtheeffectofgeometricdetail

•Artifact

-Atthesilhouettesaroundtheobjects,norealbump,justsmooth

outlines

-Thebumpsdonotcastshadowsontotheownsurface

EmbossBumpMapping

•Embossing

-Oneofthefirstmethodsusedforrealtimebumpmapping

-employsatechniqueborrowedfromtwodimensionalimage

processing

EmbossBumpMapping

Steps

•Renderthesurfacewiththeheightfield

-adiffusemonochrometexture

•Shiftallthevertex(u,v)coordinatesinthedirectionofthe

light

•Renderthissurfacewiththeheightfieldagainappliedasa

diffusestexture,subtractionfromthefirstpassresult

•Renderthesurfaceagainwithnoheightfield,diffusedly

illuminatedandGouraudshaded.Addthisshadedimage

totheresult

DiffuseLightingCalculation

C=(£•?/)XDzXDm

-Lislightvector

-Nisnormalvector

-Dzislightdiffusecolor

-Dmismaterialdiffusecolor

-BumpmappingchangesNperpixel

-Embossbumpmappingapproximates(L,N)

ApproximatediffusefactorL・N

•Texturemaprepresentheightfield

-(Fd+m)approximates(L・N)perpixel

-Firstderivativerepresentsslopem

-mincreases/decreasesbasediffusefactorFd

Approximatederivative

•Embossingapproximatesderivative

-LookupheightHoatpoint(u,v)

-LookupheightH1atpointslightlyperturbedtowardlight

source(u+Au,v+Av)

-subtractoriginalheightHofromperturbedheightH1

-differencerepresentsinstantaneousslopem-HrHg

ComputetheBump

OriginalbumpOriginalbump(Ho)overlaid

(HQwithsecondbump("Jperturbed

towardlightsource

brightensimage

darkensimage

Subtractoriginalbump

fromsecond(H/-H。)

Coordinatesystematavertex

•n

-Retrievetheshadingnormalnatthevertex

•t

-Findsurfacevectortthatfollowsoneofthetwotexture

coordinateaxesuorv

-tisperpendiculartonandtangenttothesurface

•b

-thebinormal

-ismutuallyperpendiculartonandtandrunsinthedirection

oftheothertexturecoordinateaxis

Ztytz0、

久久b二0

&a生0

10001/

(%v)£soffset

ThelightdirectionIistransformed

Thelightdirectioniscastuponthetriangle'splanebysetting/.ztozero

Theresultingvectorisscaledandaddedtothevertex5stexturecoordinates

EmbossBumpMapping

•TransformthelightdirectionI

-Lightvectorsistheninthevertex5stangentspace

n

LimitationstoEmbossBumpMapping

•Appliesonlytodiffusesurface

-Specularhighlightsarenotpossible.

•Whenthelightisdirectlyoverasurface,nooffsetoccurs

-thebumpsdisappearentirely

•Thebasicembossingalgorithmdoesnothandlebumps

thatfaceawayfromthelightonsurfacesthatare

illuminated

DotProductBumpMapping

•Dot3bumpmapping

一Primarymethodofperformingbumpmappingonmodern

graphicshardware

-Theactualnormalsforthesurfacearestoredas(x,y,z)

vectorsinthenormalmaps

-The8-bitsvaluesaremappedto[-1,1]

-Tocomputetheeffectofalightsource,thepositionallight

source'slocationistransformedtothesurface'stangent

spacebasisateachvertex

Normalmap

Diffuseandspecularbumpmapping

EnvironmentMapBumpMapping(EMBM)

•EMBM

-Perturb(u,v)environmentmappingcoordinatesbyuandv

differentialsfoundinthebumptexture

-IntroducedwithDirectX6

-Allowonlyasingleplanarenvironmentmaptobedefined

•somethinglikedefiningacubemapwithonlyoneface.

-auserdefined2X2matrixisappliedinordertorotateandscale

thedifferentialsbeforetheyareadded.

-Thismatrixcontrolstheperceivedbumpinessofthemap

EnvironmentMapBumpMapping(EMBM)

bumpmapaccesswhichisandthenaddedtothe

Bumpmappingofenvironmentmap

Bumpmappingofenvironmentmap

CombineNormalmappingandcubicenvironment

mapping

w

d

d

cEc

d

E

n

m

/support/vpwebsamples2.shtml

Displacementmap

•Displacementmap

-Modifygeometry

BumpmapDisplacementmap

Displacementmap

Theheightfieldontheleftisusedtodisplacetheverticesofamesh

VisualAppearance

Lightmakesright.

AndrewGlassner

Introduction

•Imagerenderingofthreedimensionalmodels

-Lookcorrectgeometrically

-Havearealisticvisualappearance

-Withcombinationoftechniques

•Associatingamaterialwitheachsurface

•Applyingvariouskindsofliahtsources

•Addingtextures

•Usingfog

•Transparency

•Antialiasingtechniques

Outline

Light

Material

Antialiasing

Fog

Gammacorrection

Transparency

LightSources

-photonsbounceoffthesurfaceofobjectandreachtheeyesof

theviewer

•Lightsources

-Directionallights

-Pointlights

-Spotlights

•Directionallights:positionedessentiallyinfinitelyfarawayfrom

theobjectsthatarebeinglit

-Sun

n

•Positionallight(Pointlightandspotlight)

一Singlepointthatemitsphotons

•Lightparameters

Intensityandcolor

-

Squaresubdividedinto100X100X2triangleislitby

AdirectionallightsourceApointlightsourceAspotlight

•Lightintensityandcolor

-ambient,diffuse,specularintensity

•Lightsourceparameters

NotationDescription

SambAmbientintensitycolor

$diffDiffuseintensitycolor

Q

2specSpecularintensitycolor

Q

2PosLightSourceposition

Spotlight.Sdir,Scut>Sexp

SpotLight

Lightattenuation

•Lightdropoffwiththedistance

•Intheareaofrealtimerendering,lightdonotdropoff

withdistance

-Easiertocontrol

•Noneedtoworryabouttheeffectofdistance

•Effectsmaybecomputedmorequickly

Lightattenuation

Lanp=Spot

ReoderTine=15Sec

SpotBi=.150

Light-sourceSpotSi=80

iera

<-helper-lamp

http://www.ru.is/kennarar/hannes/useful/BlenderManual/htmll/ch28sO2.html

Light

MaterialMaterial

Fog

Gammacorrection

Transparency

•Materialconsistsofanumberofparameters

-ambient,diffuse,specular,shininessandemissive

•Thecolorofsurfaceisdeterminedby

-Materialparameters

-Lightsourcesparameters

-Lightmodel

Tableofmaterialparameters

NotationDescription

^ambAmbientmaterialcolor

m防Diffusematerialcolor

m$pecSpecularmaterialcolor

^shiShininessparameter

m

111ermEissmivematerialcolor

LightingandShading

•Lighting

-Designatetheinteractionbetweenmaterialandlightsources

-Interactionwiththegeometryoftheobjecttoberendered

•Shading

-Performinglightingcomputations

-Determinepixelscolors

FlatGouraudPhong

Perpolygonpervertexperpixel

LightingandShading

•FlatShading

-Coloriscomputedforatriangleandthetriangleisfilledwiththe

color

•GouraudShading

一lightateachvertexisdetermined,andlightsamplesare

interpolatedoverthesurface

•PhongShading

一shadingnormalsstoredattheverticesareusedtointerpolate

theshadingnormalateachpixelinthetriangle

LightingandShading

FlatShadingGouraudShadingPhongShading

•FlatShading:

-Fastandsimpletoimplement

-Doesnotgiveasmoothlooktocurvedsurface

•GouraudShading:

-Speedandimprovedquality

-dependentonthelevelofdetailofobjectsthatarerendered

GouraudShading

256102416384triangles

GouraudShading

•GouraudShading

-Missinghighlight

-Failuretocapturespotlighteffects

•Usingtexturetorepresenteffects

Phongshading

GouraudShading

•Gouraudshadingcanachieveessentiallythesameshading

resultasPhongshading

-subdividingasurfaceintotrianglessmallerthanapixel

-Slowinpractice

-Rarelyusedinrealtimesystems

•LightingModel:ambient,diffuse,specular

ambientdiffusespecular

DiffuseComponent

•Lambert'sLaw

-Ideallydiffusereflectlightdeterminedbysurfacenormalnandlight

vectorI

DiffuseComponent

•Viewindependent

•Tomakeuseofdiffusecoloroflightsourceanddiffusecolor

ofmaterial

idiff=Wmdiff®sdifr®

血),-R

idiff=max((®sdiffJ

s的=(1.0,1.0,1.0)m助=(1.0,0.0,0.0)

mdiffsdiff(1.0,0.0,0.0)

SpecularComponent

•Makeobjectlookshinybycreatinghighlights

-Surfacecurvature

-Directionandlocationoflightsource

WithouthighlightWithhighlights

SpecularLighting

i-(rDr)"""二(cosp)”而

Reflectionvectorr

r=2(n•l)n—I

r=2(n-l)n-l

n-l

2(n4)n

LightFormulaofOpenGLandDirectX

以"(〃“产”二(cos8产,

h—'+'(rQ^)m-s,/7/p(〃必)4"无

Z+v

LightFormulaofOpenGLandDirectX

•Withspecularcoloroflightsourceandmaterial

区)

ispec—'(〃»),"""mspecsspec

•Iftheanglebetweennandhgreaterthan90°,thespecular

contributionis0

〃〃)加

Lsnpe”c=max\((%)""90js5pe"c0spec

o8

•

□

s.o6

gu•

Ic

J

Eo4

W•

O

U

d

so2

•

0

-n/2-K/40K/4兀/2

angle

Asthe/77s/7/increases,thecurveispulledin,makingforatighter

highlightandashinierimpression

ArtifactsinPhongshading

GouraudShadingGouraudShadingPhongshading

LittletessellationHightessellationPer-pixelShading

Otherspecularhighlightfunctions

•Schlick5sapproximation

t-cosp

spec-~~~^spec凶spec

mshi-tmshi+t

Simplefunctions

・)卯比

specmax(nh,0—

•Tisthresholdvalue

-max(c力,0)>T,1;

-Otherwise,0.

•Taffectstheapparentsizeofthelightbeingreflected

AmbientComponent

•Lightemanatingfromsourcemightbounceoffwall

andthenreachobject

•Notaccountedbydiffuseorspecularcomponent

dmb=marnb⑤

LightingEquation

•Locallightingmodel

Kot-1amb+Idiff+'spec

ambientdiffusespecularresult

LightingEquation

•Lightintensityintherealworldisinverselyproportionaltothe

squareofthedistancefromthelightsource

•Diffuseandspecularcomponentsareaffected

+3/SpLP+%Sp°s-p

Lightingattenuation

i.=a,®mh+m.+\ik+dk\ik+ik)I

totglobhambemiN」spott\amb}\drifffspecJI

k=l

=aglob®marnb+merni

«k

5expk

+£max(—〃Dy*,0)(mamb®samb

后二1

।max((疝%),0)加的㊈学疗+max((〃*),0产'加印用㊁

kk

s:+s;spos-p+s:spos-p

AliasingandAntialiasing

Musing

Sampling&filteringprocess

Pixels

Texture

Time

Samplingandreconstruction

•Sampling:

-fromcontinuoussignaltodiscrete

•Reconstructionrecoverstheoriginalsignal

-Caremustbetakentoavoidaliasing

•Nyquisttheorem

一thesamplingfrequencyshouldbeatleast2timesthemax

frequencyinthesignal

Samplingtheorem

•Nyquisttheorem

-thesamplingfrequencyshouldbeatleast2timesthemax

frequencyinthesignal

1cmTP]1sampleperrevolution

0GAlittlemorethan1sample/revolution

2samplesperrevolution

>2samplesperrevolution

OGG。。

Reconstruction

•Assumewehaveabandlimitedsignal(e.g.,atexture)

•Usefiltersforreconstruction

0---1---1---1_b

-101

Reconstructionwithboxfilter

Reconstructionwithtentfilter

32x32

texture

Reconstructionwithsinefilter

•Intheory,theidealfiltersin(zix)

•Notpracticalsinc(x)=

7DC

Resampling

•Enlargingordiminishingsignals

•Assumesamplesareatunit-intervals,i.e.,

•Resamplesothattheyareaapart

-a<1givesmagnification

-a>\givesminification

Magnification

•Halfsampledistance

Minification

•Doublethedistancebetweensamples

Screen-basedAntialiasing

•Supersampling

»usemorethanonesampleperpixel

Formulaandexamplesofdifferentschemes

n

p(x/)=Zw,c(Qxj)

i=l

•wzaretheweightsin[0,1]

•c(zj,y)isthecolorofsampleiinsidepixel

2x2RGSS

1sample4x4checker

1x2sample8rooks

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论