=================
Reflection Planes
=================

You can create reflections in your scene by enabling the "simple reflection" rendering option. This option gives you the ability to specify not only the coordinates of the reflection plane but the fading and opacity as well. When fading is enabled, the reflection plane fades when viewed from a very shallow angle.

.. csv-table::

	.. image:: images/6311aBeforeFade.png, .. image:: images/6311aFade.png

*A scene rendered with a reflection plane and the fade option enable. On the right, the reflection is fading as the camera moves away from it.*

You can use the opacity parameter to specify the transparency of the reflection plane. Setting the opacity to 1 creates a completely opaque reflection plane while setting the opacity to 0 creates an entirely translucent plane. In most cases, you will want the opacity to be somewhere in between. The default value is 0.5.

In addition to these two parameters, HOOPS provides blurring and attenuation under the DirectX driver. When blurring is on, the entire reflection is softened uniformly. You can set a blurring value that ranges from 1 to 31. This value determines the size of the blur region.

On the other hand, attenuation is an effect where the model's reflection fades as it moves away from the reflection.  With attenuation, you set the hither and yon planes (also known as near and far planes) which are defined as orthogonal distances from the reflection's location.  At the hither plane, the image is the most opaque.  As it moves toward the yon plane, attenuation is applied linearly until the model is no longer visible beyond that distance.  Each pixel's overall alpha value is calculated by multiplying the model's alpha, the reflection's opacity, fading (if enabled) and the attenuation value (if enabled).

.. tabs::

	.. group-tab:: C++
	
		.. literalinclude:: ../../../../demo/common/sanity/0700_docs_0025.cpp
		   :start-after: //! [reflection1]
		   :end-before: //! [reflection1]
		   
The above code snippet uses the "simple reflection" rendering option to create a reflection plane with fading, opacity and blur turned on.  The attenuation is enabled with hither and yon distances defined as well.

.. image:: images/6311bHitherYon.png

*An urn rendered with a reflection plane with attenuation enabled such that the top of the urn fades away in the reflection.*

Prior to Release 17, the reflection plane rendered exactly what was set to visible in the model. Thus, if lines were visible, then lines would be rendered in the reflection plane.  Now, the "simple reflection" feature has its own visibility suboption that allows you to control what is rendered in the reflection plane.  As a result, you can use the visibility suboption to independently control whether edges, faces, lines, text, polygon, images, vertices and markers are rendered.  The default setting is "visibility= (everything=off, faces=on, lights=on)".

.. image:: images/0608c_visibilityreflection.png

*The figure shows a model rendered with edges visible while the model in the reflection plane has the visiblity for edges turned off.*
