####################
Rendering Priorities
####################


In HOOPS Luminate, the rendering pipeline renders the scene per material. All objects using the same material are grouped and rendered together. Every rendering pass (prelit, lit, postlit) is sorted by materials.

.. figure:: bk_bm_rendering_priorities_01.png
    :align: center
    
    **The shapes are sorted and rendered by materials for each pass**

.. note:: 
    
    The rendering order of shapes using the same material is done accordingly to their place in the scenegraph and more precisely to their child index under a transform shape. Sorting them is easy: just change their place in the graph.

Sometimes, it is important for the user to control the rendering order of his materials. Of course, HOOPS Luminate allows to do that by providing a priority system for materials.

A ``RED::IMaterial`` has a priority that can be changed with the ``RED::IMaterial::SetPriority`` method. The priority is a positive number. The materials with a lower priority index will be rendered before the ones with a higher priority index.

By default, all materials have a priority of -1. It is a particular case where they are rendered last.

.. figure:: bk_bm_rendering_priorities_02.png
    :align: center
    
    **An example of material priority rendering**

.. include:: /tasks/ta_ca/ta_ca_material/tk_modifying_a_material_priority.rst
