void UniversalMaterial::setShaderArgs(Args& args) const {
    args.appendToPreamble(m_macros);
    static const bool OPTIONAL = true;

    if (m_bsdf->lambertian().notBlack() || m_bsdf->lambertian().nonUnitAlpha()) {
        if (m_bsdf->lambertian().texture()) {
            args.setUniform(SYMBOL_lambertianMap,            m_bsdf->lambertian().texture(), OPTIONAL);
            if (m_bsdf->lambertian().constant() != Color4::one()) {
                args.setUniform(SYMBOL_lambertianConstant,   m_bsdf->lambertian().constant(), OPTIONAL);
            }
        } else {
            args.setUniform(SYMBOL_lambertianConstant,       m_bsdf->lambertian().constant(), OPTIONAL);
        }
    }

    if (m_bsdf->glossy().notBlack()) {
        if (m_bsdf->glossy().texture()) {
            args.setUniform(SYMBOL_glossyMap,                m_bsdf->glossy().texture(), OPTIONAL);
            if (m_bsdf->glossy().constant() != Color4::one()) {
                args.setUniform(SYMBOL_glossyConstant,       m_bsdf->glossy().constant(), OPTIONAL);
            }
        } else {
            args.setUniform(SYMBOL_glossyConstant,           m_bsdf->glossy().constant(), OPTIONAL);
        }
    }

    if (m_customConstant.isFinite()) {
        args.setUniform(SYMBOL_customConstant,               m_customConstant, OPTIONAL);
    }

    if (m_customMap) {
        args.setUniform(SYMBOL_customMap,                    m_customMap->texture(), OPTIONAL);
    }

    if (m_emissive.notBlack()) {
        args.setUniform(SYMBOL_emissiveConstant,             m_emissive.constant(), OPTIONAL);

        if (m_emissive.texture()) {
            args.setUniform(SYMBOL_emissiveMap,              m_emissive.texture(), OPTIONAL);
        }
    }

    if (m_bump && (m_bump->settings().scale != 0)) {
        args.setUniform(SYMBOL_normalBumpMap,               m_bump->normalBumpMap()->texture(), OPTIONAL);
        if (m_bump->settings().iterations > 0) {
            args.setUniform(SYMBOL_bumpMapScale,            m_bump->settings().scale, OPTIONAL);
            args.setUniform(SYMBOL_bumpMapBias,             m_bump->settings().bias, OPTIONAL);
        }
    }

    if (m_numLightMapDirections > 0) {
        // LightMap or first RNM
        args.setUniform(SYMBOL_lightMapConstant, m_lightMap[0].constant().average());
        args.setUniform(SYMBOL_lightMap0, m_lightMap[0].texture(), OPTIONAL);

        if (m_numLightMapDirections == 3) {
            alwaysAssertM
            ((m_lightMap[1].constant() == m_lightMap[0].constant()) &&
             (m_lightMap[2].constant() == m_lightMap[0].constant()),
             "All light maps must use the same constant");

            // Radiosity Normal Map
            args.setUniform(SYMBOL_lightMap1, m_lightMap[1].texture(), OPTIONAL);
            args.setUniform(SYMBOL_lightMap2, m_lightMap[2].texture(), OPTIONAL);
        }
    }

    debugAssert(isNull(m_bump) || m_bump->settings().iterations >= 0);
}