Top Banner
Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics Sanja Roksandi´ c, Marija Borisov FIT 2009, Novi Sad June 26, 2009 Sanja Roksandi´ c, Marija Borisov (FIT 2009, Novi Sad) Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics June 26, 2009 1 / 15
28

Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Jul 27, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Assignment #2 - Reflection of an Object in a Mirror;3D Graphics

Sanja Roksandic, Marija Borisov

FIT 2009, Novi Sad

June 26, 2009

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 1 / 15

Page 2: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Outline

1 Assignment

2 Motivation

3 Our solutionExamplesGeneral SolutionThe Limitations of our Solution

4 ConclusionFurther Work

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 2 / 15

Page 3: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Assignment

Assignment

Global illumination phenomena, such as reflections, are not computedby the local lighting model used by the 3D graphics rasterization -based pipeline.

Our goal is to develop a way to visualize, given a large quadrilateral(a mirror) on the plane y=0, and an object near the quadrilateral, thereflection of the object in the mirror.

We need to verify that our method is correct by building a X3D sceneas above, where we apply our method to visualize the objectreflection on the mirror.

In the end we are supposed to write down all the limitations of oursolution, and think about possible ways to improve it (e.g. what to dowhen the mirror is not on the y=0 plane?)

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 3 / 15

Page 4: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Motivation

Motivation

Physics - the Law ofReflection.

Basic computer graphicsconcepts.

In order to create reflectedobject in a scene, it isnecessary to understandthe transformations whichwill be applied.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 4 / 15

Page 5: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Motivation

Motivation

Physics - the Law ofReflection.

Basic computer graphicsconcepts.

In order to create reflectedobject in a scene, it isnecessary to understandthe transformations whichwill be applied.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 4 / 15

Page 6: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Motivation

Motivation

Physics - the Law ofReflection.

Basic computer graphicsconcepts.

In order to create reflectedobject in a scene, it isnecessary to understandthe transformations whichwill be applied.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 4 / 15

Page 7: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Our Solution

All we can do is to draw all the objects in front of the mirror andtheir mirror reflections, but not the objects behind the mirror.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 5 / 15

Page 8: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Our Solution

A simple example of using reflections is to reflect the scene in amirror on y = 0 plane. In this type of application it is reasonably toassume that the remainder of the scene lies above the y = 0 plane.

To get the reflection it is necessary to render the scene as if it wasbelow (−y direction) the y = 0 plane.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 6 / 15

Page 9: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Our Solution

A simple example of using reflections is to reflect the scene in amirror on y = 0 plane. In this type of application it is reasonably toassume that the remainder of the scene lies above the y = 0 plane.

To get the reflection it is necessary to render the scene as if it wasbelow (−y direction) the y = 0 plane.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 6 / 15

Page 10: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Our Solution

To do this the y-coordinates of model need to be negated. Weachieved this by scale transformation with value ′1,−1, 1′.

Note that this is independent of where the viewer is located.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 7 / 15

Page 11: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Our Solution

To do this the y-coordinates of model need to be negated. Weachieved this by scale transformation with value ′1,−1, 1′.

Note that this is independent of where the viewer is located.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 7 / 15

Page 12: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Examples

Examples

Examples are made with X3D.

First example - Reflection of the arbitrary (freeform) object.

Second example - Reflection of several objects.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 8 / 15

Page 13: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Examples

Examples

Examples are made with X3D.

First example - Reflection of the arbitrary (freeform) object.

Second example - Reflection of several objects.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 8 / 15

Page 14: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

Examples

Examples

Examples are made with X3D.

First example - Reflection of the arbitrary (freeform) object.

Second example - Reflection of several objects.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 8 / 15

Page 15: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

General Solution

General Problem

General case is when a mirror is not in y = 0 plain - the case whenthe mirror is allowed to have any position and orientation within thespace.

In this case, solution is to transform scene so that mirror istransformed to y = 0 plane, reflect and transform back (i.e., reducingto our case).

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 9 / 15

Page 16: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

General Solution

General Problem

General case is when a mirror is not in y = 0 plain - the case whenthe mirror is allowed to have any position and orientation within thespace.

In this case, solution is to transform scene so that mirror istransformed to y = 0 plane, reflect and transform back (i.e., reducingto our case).

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 9 / 15

Page 17: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

General Solution

General Problem

Let us have one vertex of the planar reflector (P) and the vector ofthe plane where the mirror is (it is the vector normal to the reflectingplane, vector V).

Now we can determine the matrix of transformation which will createthe reflected objects:

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 10 / 15

Page 18: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

General Solution

General Problem

Let us have one vertex of the planar reflector (P) and the vector ofthe plane where the mirror is (it is the vector normal to the reflectingplane, vector V).

Now we can determine the matrix of transformation which will createthe reflected objects:

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 10 / 15

Page 19: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

The Limitations of our Solution

The Limitations of Our Solution

Problem with the objects behind the mirror.

Our application runs slower due to the drawing objects even whenthey can not be seen from current viewpoint.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 11 / 15

Page 20: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Our solution

The Limitations of our Solution

The Limitations of Our Solution

Problem with the objects behind the mirror.

Our application runs slower due to the drawing objects even whenthey can not be seen from current viewpoint.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 11 / 15

Page 21: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Conclusion

This is a straightforward solution of the given problem.

We enjoyed working on it!

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 12 / 15

Page 22: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Conclusion

This is a straightforward solution of the given problem.

We enjoyed working on it!

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 12 / 15

Page 23: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Further Work

Rendering a 2d reflection, a more appropriate model of the real world.

Multiple mirrors rendering - render the normal view, then do othertransformations for each mirror.

Recursive reflections between mirrors - After rendering the reflectedarea inside the mirror surface, render the mirrors inside the mirrorsurface, and so on.

Reflection in curved surface mirrors.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 13 / 15

Page 24: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Further Work

Rendering a 2d reflection, a more appropriate model of the real world.

Multiple mirrors rendering - render the normal view, then do othertransformations for each mirror.

Recursive reflections between mirrors - After rendering the reflectedarea inside the mirror surface, render the mirrors inside the mirrorsurface, and so on.

Reflection in curved surface mirrors.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 13 / 15

Page 25: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Further Work

Rendering a 2d reflection, a more appropriate model of the real world.

Multiple mirrors rendering - render the normal view, then do othertransformations for each mirror.

Recursive reflections between mirrors - After rendering the reflectedarea inside the mirror surface, render the mirrors inside the mirrorsurface, and so on.

Reflection in curved surface mirrors.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 13 / 15

Page 26: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Further Work

Rendering a 2d reflection, a more appropriate model of the real world.

Multiple mirrors rendering - render the normal view, then do othertransformations for each mirror.

Recursive reflections between mirrors - After rendering the reflectedarea inside the mirror surface, render the mirrors inside the mirrorsurface, and so on.

Reflection in curved surface mirrors.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 13 / 15

Page 27: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Thank you for your attention.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 14 / 15

Page 28: Assignment #2 - Reflection of an Object in a Mirror; 3D ...cms.uns.ac.rs/fit2009/roksandic_borisov.pdf · Assignment #2 - Re ection of an Object in a Mirror; 3D Graphics Motivation

Assignment #2 - Reflection of an Object in a Mirror; 3D Graphics

Conclusion

Further Work

Thank you for your attention.

Sanja Roksandic, Marija Borisov (FIT 2009, Novi Sad)Assignment #2 - Reflection of an Object in a Mirror; 3D GraphicsJune 26, 2009 15 / 15