gameknife / gkNextRenderer

A Modern gkRenderer
15 stars 2 forks source link

Why you do texColor * texColor ? #21

Closed tigrazone closed 1 week ago

tigrazone commented 1 week ago

https://github.com/gameknife/gkNextRenderer/blob/cbbfc8dfb4c2ef040903dd37bb33d35786865fac/assets/shaders/Scatter.glsl#L200

tigrazone commented 1 week ago

If it is srgb2linear approximation is better to use

// sRGB to linear approximation, see http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html
vec4 srgbToLinear(in vec4 sRgb)
{
  //return vec4(pow(sRgb.xyz, vec3(2.2f)), sRgb.w);
  vec3 rgb = sRgb.xyz * (sRgb.xyz * (sRgb.xyz * 0.305306011F + 0.682171111F) + 0.012522878F);
  return vec4(rgb, sRgb.a);
}

https://github.com/nvpro-samples/nvpro_core/blob/163809b8e92324b338b11ba4f39fde368bb941c3/nvvkhl/shaders/pbr_mat_eval.glsl#L64-L70

gameknife commented 1 week ago

make a pr, plz 😄

tigrazone commented 1 week ago

Ok