Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Improve rendering quality when model color is pure black
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Jan 2, 2024
1 parent 8d5bb6c commit 9e443ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/slic3r/GUI/3DScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,18 @@ std::vector<Slic3r::ColorRGBA> get_extruders_colors()
}
float FullyTransparentMaterialThreshold = 0.1f;
float FullTransparentModdifiedToFixAlpha = 0.3f;
float FULL_BLACK_THRESHOLD = 0.18f;

Slic3r::ColorRGBA adjust_color_for_rendering(const Slic3r::ColorRGBA &colors)
{
if (colors.a() < FullyTransparentMaterialThreshold) { // completely transparent
return {1, 1, 1, FullTransparentModdifiedToFixAlpha};
}
return colors;
else if(colors.r() < FULL_BLACK_THRESHOLD && colors.g() < FULL_BLACK_THRESHOLD && colors.b() < FULL_BLACK_THRESHOLD) { // black
return {FULL_BLACK_THRESHOLD, FULL_BLACK_THRESHOLD, FULL_BLACK_THRESHOLD, colors.a()};
}
else
return colors;
}

namespace Slic3r {
Expand Down

0 comments on commit 9e443ba

Please sign in to comment.