Stenciling. 5 th Week, Reflection without Using the Stencil Buffer

Similar documents
The sphere of radius a has the geographical form. r (,)=(acoscos,acossin,asin) T =(p(u)cos v, p(u)sin v,q(u) ) T.

One of the common descriptions of curvilinear motion uses path variables, which are measurements made along the tangent t and normal n to the path of

Viewing in 3D. Viewing in 3D. Planar Geometric Projections. Taxonomy of Projections. How to specify which part of the 3D world is to be viewed?

Cameras and World Geometry

Department of Chemical Engineering University of Tennessee Prof. David Keffer. Course Lecture Notes SIXTEEN

ENGI 4430 Advanced Calculus for Engineering Faculty of Engineering and Applied Science Problem Set 9 Solutions [Theorems of Gauss and Stokes]

Fresnel Dragging Explained

Physics 232 Exam I Feb. 13, 2006

The Production of Polarization

Lecture 22 Electromagnetic Waves

Optical flow equation

Available online at J. Math. Comput. Sci. 2 (2012), No. 4, ISSN:

Lecture 15: Three-tank Mixing and Lead Poisoning

Sections 3.1 and 3.4 Exponential Functions (Growth and Decay)

The Non-Truncated Bulk Arrival Queue M x /M/1 with Reneging, Balking, State-Dependent and an Additional Server for Longer Queues

Control Volume Derivation

ECSE Partial fraction expansion (m<n) 3 types of poles Simple Real poles Real Equal poles

BINOMIAL THEOREM OBJECTIVE PROBLEMS in the expansion of ( 3 +kx ) are equal. Then k =

2012 GCE A Level H2 Maths Solution Paper Let x,

Camera Models class 8

Physics 232 Exam I Feb. 14, 2005

FINITE DIFFERENCE APPROACH TO WAVE GUIDE MODES COMPUTATION

Lecture 4. Electrons and Holes in Semiconductors

Time-Space Model of Business Fluctuations

Dividing Algebraic Fractions

The universal vector. Open Access Journal of Mathematical and Theoretical Physics [ ] Introduction [ ] ( 1)

Math 2414 Homework Set 7 Solutions 10 Points

ME 3210 Mechatronics II Laboratory Lab 6: Second-Order Dynamic Response

2-d Motion: Constant Acceleration

Physics 232 Exam II Mar. 28, 2005

PRICING AMERICAN PUT OPTION WITH DIVIDENDS ON VARIATIONAL INEQUALITY

Comparing Different Estimators for Parameters of Kumaraswamy Distribution

2 f(x) dx = 1, 0. 2f(x 1) dx d) 1 4t t6 t. t 2 dt i)

Institute of Actuaries of India


Supplementary Information

Projection of geometric models

The Nehari Manifold for a Class of Elliptic Equations of P-laplacian Type. S. Khademloo and H. Mohammadnia. afrouzi

On a problem of Graham By E. ERDŐS and E. SZEMERÉDI (Budapest) GRAHAM stated the following conjecture : Let p be a prime and a 1,..., ap p non-zero re

Lecture 4. Electrons and Holes in Semiconductors

LIPSCHITZ ESTIMATES FOR MULTILINEAR COMMUTATOR OF MARCINKIEWICZ OPERATOR

Reinforcement learning

( ) c(d p ) = 0 c(d p ) < c(d p ) 0. H y(d p )

Lecture 5. Chapter 3. Electromagnetic Theory, Photons, and Light

P a g e 5 1 of R e p o r t P B 4 / 0 9

Section 8. Paraxial Raytracing

Solutions to selected problems from the midterm exam Math 222 Winter 2015

Representing Knowledge. CS 188: Artificial Intelligence Fall Properties of BNs. Independence? Reachability (the Bayes Ball) Example

H STO RY OF TH E SA NT

Physics 201, Lecture 5

A L A BA M A L A W R E V IE W

2007 Spring VLSI Design Mid-term Exam 2:20-4:20pm, 2007/05/11

Relative and Circular Motion

Physics 201 Lecture 15

CHATTERJEA CONTRACTION MAPPING THEOREM IN CONE HEPTAGONAL METRIC SPACE

700 STATEMENT OF ECONOMIC

Zero Level Binomial Theorem 04

Online-routing on the butterfly network: probabilistic analysis

Topic 4a Introduction to Root Finding & Bracketing Methods

Executive Committee and Officers ( )

ÖRNEK 1: THE LINEAR IMPULSE-MOMENTUM RELATION Calculate the linear momentum of a particle of mass m=10 kg which has a. kg m s

Projection of geometric models

CIRCUITS AND ELECTRONICS. The Impedance Model

of Manchester The University COMP14112 Hidden Markov Models

CSE590B Lecture 4 More about P 1

Reinforcement learning

I M P O R T A N T S A F E T Y I N S T R U C T I O N S W h e n u s i n g t h i s e l e c t r o n i c d e v i c e, b a s i c p r e c a u t i o n s s h o

Wave Motion Sections 1,2,4,5, I. Outlook II. What is wave? III.Kinematics & Examples IV. Equation of motion Wave equations V.

Physics 201 Lecture 18

ECE 340 Lecture 15 and 16: Diffusion of Carriers Class Outline:

Chapter 1 Electromagnetic Field Theory

Chapter 7. Interference

6.2 Improving Our 3-D Graphics Pipeline

ABSOLUTE INDEXED SUMMABILITY FACTOR OF AN INFINITE SERIES USING QUASI-F-POWER INCREASING SEQUENCES

, on the power of the transmitter P t fed to it, and on the distance R between the antenna and the observation point as. r r t

Algebra 2A. Algebra 2A- Unit 5

An Open cycle and Closed cycle Gas Turbine Engines. Methods to improve the performance of simple gas turbine plants

Probabilistic number theory : A report on work done. What is the probability that a randomly chosen integer has no square factors?

Computer Propagation Analysis Tools

T h e C S E T I P r o j e c t

SHINGLETON FOREST AREA Stand Level Information Compartment: 44 Entry Year: 2009

K owi g yourself is the begi i g of all wisdo.

Ideal Amplifier/Attenuator. Memoryless. where k is some real constant. Integrator. System with memory

On The Estimation of Two Missing Values in Randomized Complete Block Designs

Chapter 3: Vectors and Two-Dimensional Motion

CMSC 425: Lecture 5 More on Geometry and Geometric Programming

xp (X = x) = P (X = 1) = θ. Hence, the method of moments estimator of θ is

Falls in the realm of a body force. Newton s law of gravitation is:

ECE 340 Lecture 19 : Steady State Carrier Injection Class Outline:

Vector autoregression VAR. Case 1

A PATRA CONFERINŢĂ A HIDROENERGETICIENILOR DIN ROMÂNIA,

TELEMATICS LINK LEADS

Secure Chaotic Spread Spectrum Systems

Exercise 3 Stochastic Models of Manufacturing Systems 4T400, 6 May

N! AND THE GAMMA FUNCTION

David Randall. ( )e ikx. k = u x,t. u( x,t)e ikx dx L. x L /2. Recall that the proof of (1) and (2) involves use of the orthogonality condition.

Algebra-based Physics II

ECE 145B / 218B, notes set 5: Two-port Noise Parameters

Non-Linear Dynamics Homework Solutions Week 2

Today - Lecture 13. Today s lecture continue with rotations, torque, Note that chapters 11, 12, 13 all involve rotations

Transcription:

Secilig 5 h Week, 9 Reflecio wihou Usig he Secil Buffe

Blockig he Reflecio Usig he Secil Buffe Secil Buffe A off-scee buffe fo secial effecs Haig same esoluio as he back buffe a eh buffe To block eeig o ceai as of he back buffe Simle ieface offes a fleible a oweful se of caabiliies like bleig Alicaios: mios, laa shaows

Objecies To gai a uesaig of how he secil buffe woks, how o ceae a secil buffe, a how we ca cool he secil buffe To lea how o imleme mios a usig he secil buffe o ee e eflecios fom beig aw o o-mio sufaces To iscoe how o ee shaows a ee ouble bleig b usig he secil buffe Usig he Secil Buffe Eablig he secil buffe g3deice->sereesae(d3drs_stencienabe, ue);... // o secil wok g3deice->sereesae(d3drs_stencienabe, false); Cleaig he secil buffe o a efaul alue g3deice->clea(,, D3DCEAR_TARGET D3DCEAR_ZBUFFER D3DCEAR_STENCI, ff, 1.f, );

Requesig a Secil Buffe (1) Ceaig a secil buffe a he ime he eh buffe is ceae To secif he foma of he secil buffe also whe secifig he foma of he eh buffe E) hee eh/secil fomas D3DFMT_D4S8D4S8 D3DFMT_D4X4S4 D3DFMT_D15S1D15S1 cf) D3DFMT_D3 Requesig a Secil Buffe ()

The Secil Tes Decisio o block a aicula iel fom beig wie IF ef & mask alue & mask ue THEN acce iel ESE ejec iel Pefome fo ee iel ef-ha-sie oea (HS ef & mask) ANDig alicaio-efie secil efeece alue (ef) wih a alicaio-efie maskig alue (mask) Righ-ha-sie oea (RHS alue & mask) ANDig e i he secil buffe fo he aicula iel (ef) wih alicaio-efie maskig alue (mask) Comaiso oeaio : if ue, he iel is wie Cf) If a iel is wie o he back buffe, i is wie o he eh buffe eihe. Coollig he Secil Tes (1) Secifig he secil efeece alue, he mask alue, a he comaiso oeaio Secil efeece alue: ef Zeo b efaul Useful o see whe oig biwise oeaios g3deice->sereesae(d3drs >SeReeSae(D3DRS_STENCIREF D3DRS_STENCIREF, STENCIREF, 1); Secil mask: mask Maskig (Hiig) bis i boh he ef a alue aiables ffffffff b efaul g3deice->sereesae(d3drs_stencimask, ffff); Secil alue: alue Value i he secil buffe fo he cue iel

Coollig he Secil Tes () Comaiso oeaio: IF ef & mask alue & mask ue THEN acce iel ESE ejec iel g3deice->sereesae(d3drs_stencifunc, D3DCMP_AWAYS); eef eum _D3DCOMPFUNC { D3DCMP_NEVER 1, D3DCMP_ESS, D3DCMP_EQUA 3, D3DCMP_ESSEQUA 4, D3DCMP_GREATER 5, D3DCMP_NOTEQUA 6, D3DCMP_GREATEREQUA 7, D3DCMP_AWAYS 8, D3DCMP_FORCE_DWORD 7ffffff } D3DCOMPFUNC; C Coollig he Secil Tes (3) Comaiso oeaio: (co ) D3DCMP_NEVER: secil es alwas fails (he iel is alwas ejece) D3DCMP_ESS: elace wih < oeao D3DCMP_EQUA: elace wih oeao D3DCMP_ESSEQUA: elace wih oeao D3DCMP_GREATER: elace wih > oeao D3DCMP_NOTEQUA: elace wih! oeao D3DCMP_GREATEREQUA: elace wih oeao D3DCMP_AWAYS: secil es alwas succees (he iel is alwas aw)

Uaig he Secil Buffe (1) Defiig how he secil buffe e shoul be uae base o hee ossible cases: The secil es fails 3Deice->SeReeSae(D3DRS_STENCIFAI, SecilOeaio); The eh es fails 3Deice->SeReeSae(D3DRS_STENCIZFAI, SecilOeaio); The eh hes a secil iles succee 3Deice->SeReeSae(D3DRS_STENCIPASS, SecilOeaio); D3DSTENCIOP_KEEP D3DSTENCIOP_ZERO D3DSTENCIOP_ REPACE D3DSTENCIOP_INVERT D3DSTENCIOP_INCRSAT D3DSTENCIOP_DECRSAT D3DSTENCIOP_ INCR D3DSTENCIOP_DECR Uaig he Secil Buffe () SecilOeaio D3DSTENCIOP_KEEP: kee he secil buffe e D3DSTENCIOP_ZERO: se he secil buffe e o eo D3DSTENCIOP_REPACE: elace he secil buffe e wih he secil-efeece alue D3DSTENCIOP_INCRSAT: iceme he secil buffe e (clam he e o ha maimum) D3DSTENCIOP_DECRSAT: eceme he secil buffe e (clam he e o eo) D3DSTENCIOP_INVERT: ie he bis of he secil buffe e D3DSTENCIOP_INCR: INCR: iceme he secil buffe e (wa o eo) D3DSTENCIOP_DECR: eceme he secil buffe e (wa o he maimum)

Secil Wie Mask Maskig off bis of a alue we wie o he secil buffe ffffffff b efaul 3Deice->SeReeSae(D3DRS >SeReeSae(D3DRS_STENCIWRITEMASK D3DRS_STENCIWRITEMASK, STENCIWRITEMASK, ffff); Mio Demo

Imlemeig Mios o Plaa Sufaces Solig wo oblems Solig wo oblems How o eflec a objec abou a abia lae Aalical Geome Aalical Geome Dislaig he eflecio ol i a mio Secil Buffe Secil Buffe Aalical Geome Aalical Geome Secil Buffe Secil Buffe The Mahemaics of Reflecio (1) The Mahemaics of Reflecio (1) How o comue he eflecio oi ( ) How o comue he eflecio oi of a oi abou a abia lae ( ),, ( ),, ˆ ( ),, kˆ ( ) ˆ ˆ ˆ k q ˆ k kˆ ( ) Mai Mai Mai Mai ˆ ( ),, 1 1 1 1 1 R

The Mahemaics of Reflecio () D3DX liba oies he fucio o ceae he eflecio mai D3DXMATRIX *D3DXMaiReflec( D3DXMATRIX *Ou, CONST D3DXPANE *Plae ); The eflecios abou he hee saa cooiae laes he,, a laes R 1 1 1 1 R 1 1 1 1 R 1 1 1 1 Mio Imlemeaio Oeiew 1. Ree he eie scee as omal. Clea he secil buffe o Back Buffe Secil Buffe 3. Ree he imiies ha make u he mio io he secil buffe ol Secil es: alwas succeeig Secil oeaio: elacig wih 1 if he es asses Back Buffe Secil Buffe 4. Ree he eflece eao o he back buffe a secil buffe

Eablig he Secil Buffe Reeig he Mio

Peaig he Reflecio Comuaio of he Reflecio Mai

Disablig he Deh Buffe Cleaig u

Plaa Shaow Demo Plaa Shaow Shaows ha lie o a lae To ai i ou eceio of whee ligh is beig emie To make he scee moe ealisic Imlemeaio Fiig he shaow a objec cass o a lae a moelig i geomeicall 3D Mah Reeig he shaow wih a black maeial a 5% asaec To ee ouble bleig fom occuig Secil Buffe

Paallel igh Shaows Paallel igh Shaows A a/lae iesecio A a/lae iesecio Ra () Iesecio Poi Plae Iesecio Poi s ( ) s ( ) ( ) s ( ) s s Poi igh Shaows Poi igh Shaows A a/lae iesecio A a/lae iesecio Ra () ( ) Iesecio Poi Plae Iesecio Poi ( ) s ( ) ( ) s ( ) ( ) ( ) s ( ) s s

The Shaow Mai (1) Diecioal igh Shaows Paallel Pojecio Poi igh Shaows Pesecie Pojecio Tasfomaio mai ojecio lae 4D eco ( ),,, iecio o locaio of a ligh 4D eco if w, he is he iecio,,, w if w 1, he is he locaio k w k w S k w w k whee k,,,,,, ( ) ( ) ( w ) w The Shaow Mai () D3DX liba oies he fucio o buil he shaow mai D3DXMATRIX *D3DXMaiShaow( D3DXMATRIX *Ou, CONST D3DXVECTOR4 *igh, ); CONST D3DXPANE *Plae igh: a eco escibig a aallel ligh if w o a oi ligh if w1 Plae: he lae o ojec he shaow io

Usig he Secil Buffe o Pee Double Bleig (1) Double bleig Oelaig iagles will ge blee mulile imes a hus aea ake The shaow eee wih ouble bleig. The shaow eee coecl. Usig he Secil Buffe o Pee Double Bleig () Solig ouble bleig oblem usig he secil buffe To ee wiig oelaig iels Seig he secil es o ol acce iels he fis ime Whe eeig he shaow s iels o he back buffe, makig he coesoig secil buffe eies

Seig he Secil Ree Saes Comuaio of he Shaow Tasfomaio

Reeig he Shaow a Cleaig u Maeials

Dawig he Shaow Eecises (1) Moif he Shaow emo b alig he followig escibe fi. If ou u he Shaow emo a moe he eao (usig he A a D kes) such ha he shaow goes off he floo, ou will obsee ha he shaow sill aw. This ca be fie b emloig he secil echique use fo he Mio emo; ha is mak he secil buffe iels ha coeso wih he floo a he ol ee he shaow iels ha coicie wih he floo.

Eecises () Moif he Shaow emo ogam o ee a oi ligh shaow isea of a aallel ligh shaow.