Moved application of shader parameters to an own function to reduce code duplication.