void Tracer::evaluate_alpha( const Material& material, const ShadingPoint& shading_point, Alpha& alpha) const { // Init to fully opaque. alpha.set(1.0f); // Evaluate the alpha map at the shading point. if (const Source* alpha_map = material.get_alpha_map()) { alpha_map->evaluate( m_texture_cache, shading_point.get_uv(0), alpha); } #ifdef WITH_OSL if (const ShaderGroup* sg = material.get_osl_surface()) { if (sg->has_transparency()) { Alpha a; m_shadergroup_exec.execute_transparency( *sg, shading_point, a); alpha *= a; } } #endif }
void process_transparency_tree(const OSL::ClosureColor* ci, Alpha& alpha) { // Convert from transparency to opacity. float transp = luminance(do_process_closure_id_tree(ci, TransparentID)); alpha.set(1.0f - clamp(transp, 0.0f, 1.0f)); }
void process_transparency_tree(const OSL::ClosureColor* ci, Alpha& alpha) { // Convert from transparency to opacity. const float transparency = saturate(luminance(do_process_closure_id_tree(ci, TransparentID))); alpha.set(1.0f - transparency); }