You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using these tools to rebuild Kingpin (Quake2 engine) maps. I've found that the lighting is much less saturated than the lighting in the original maps.
Kingpin maps heavily rely on surface lights and radiosity, so a fix for this issue is to increase the saturation of those surface lights, and bounced lighting, which is what -tex_saturation_boost is supposed to do. The problem is that the way the saturation is adjusted also drastically changes the overall brightness of textures which messes up other aspects of lighting. The description for the -tex_saturation_boost option says increase texture saturation to match original Q2 tools. Is the current implementation really how the original quake 2 tools worked? I wasn't able to get good results with it.
I was able to get good results by changing the implementation of increase_saturation in imglib.cc like this:
#if1// NEW// add amount argument.staticqvec3bincrease_saturation(constqvec3b&color, floatamount)
#elsestaticqvec3bincrease_saturation(constqvec3b&color)
#endif
{
qvec3fcolor_float=qvec3f(color);
color_float /= 255.0f;
#if1// NEW// scale channels around their average intensity.floataverage= (color_float[0] +color_float[1] +color_float[2])/3.0f;
color_float[0] -=average;
color_float[1] -=average;
color_float[2] -=average;
color_float *= amount;
color_float[0] +=average;
color_float[1] +=average;
color_float[2] +=average;
#else// square it to boost saturationcolor_float *= color_float;
// multiply by 2, then scale back to avoid clipping if neededcolor_float *= 2.0f;
floatmax_comp=qv::max(color_float);
if (max_comp>1.0f) {
color_float /= max_comp;
}
#endifqvec3bcolor_int;
for (inti=0; i<3; ++i) {
color_int[i] =static_cast<uint8_t>(std::clamp(color_float[i] *255.0f, 0.0f, 255.0f));
}
returncolor_int;
}
#if1// NEWtex_saturation_boost{this, "tex_saturation_boost", 0.0f, 0.0f, 10.0f, &game_group,
"increase texture saturation to match original Q2 tools"}
#elsetex_saturation_boost{this, "tex_saturation_boost", 0.0f, 0.0f, 1.0f, &game_group,
"increase texture saturation to match original Q2 tools"}
#endif
I think it would be advantageous to change the behavior of -tex_saturation_boost to something like this (or maybe a proper RGB > HSV, adjust > RGB conversion).
If the current behavior is desired, then maybe a new option could be added that more naturally adjusts saturation and preserves color intensity?
The text was updated successfully, but these errors were encountered:
I'm using these tools to rebuild Kingpin (Quake2 engine) maps. I've found that the lighting is much less saturated than the lighting in the original maps.
Kingpin maps heavily rely on surface lights and radiosity, so a fix for this issue is to increase the saturation of those surface lights, and bounced lighting, which is what
-tex_saturation_boost
is supposed to do. The problem is that the way the saturation is adjusted also drastically changes the overall brightness of textures which messes up other aspects of lighting. The description for the-tex_saturation_boost
option saysincrease texture saturation to match original Q2 tools
. Is the current implementation really how the original quake 2 tools worked? I wasn't able to get good results with it.I was able to get good results by changing the implementation of
increase_saturation
inimglib.cc
like this:And adjust its usage:
And adjust its max value so it can be set > 1:
I think it would be advantageous to change the behavior of
-tex_saturation_boost
to something like this (or maybe a proper RGB > HSV, adjust > RGB conversion).If the current behavior is desired, then maybe a new option could be added that more naturally adjusts saturation and preserves color intensity?
The text was updated successfully, but these errors were encountered: