mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-04-28 12:27:59 +03:00
Fixed fromLinear
Some checks failed
GenerateBuilds / generate-port-o2r (push) Has been cancelled
GenerateBuilds / build-linux (push) Has been cancelled
GenerateBuilds / build-windows (push) Has been cancelled
GenerateBuilds / build-macos (push) Has been cancelled
GenerateBuilds / build-switch (push) Has been cancelled
Some checks failed
GenerateBuilds / generate-port-o2r (push) Has been cancelled
GenerateBuilds / build-linux (push) Has been cancelled
GenerateBuilds / build-windows (push) Has been cancelled
GenerateBuilds / build-macos (push) Has been cancelled
GenerateBuilds / build-switch (push) Has been cancelled
This commit is contained in:
parent
916e4b53a2
commit
1793c7a0ad
1 changed files with 9 additions and 5 deletions
|
@ -148,10 +148,14 @@ float random(float3 value) {
|
|||
}
|
||||
|
||||
float4 fromLinear(float4 linearRGB) {
|
||||
bool3 cutoff = linearRGB.xyz < float3(0.0031308, 0.0031308, 0.0031308);
|
||||
float3 higher = 1.055 * pow(linearRGB.xyz, float3(1.0 / 2.4, 1.0 / 2.4, 1.0 / 2.4)) - float3(0.055, 0.055, 0.055);
|
||||
float3 lower = linearRGB.xyz * float3(12.92, 12.92, 12.92);
|
||||
return float4(lerp(higher, lower, cutoff), linearRGB.w);
|
||||
float3 threshold = float3(0.0031308);
|
||||
float3 gamma = float3(1.0 / 2.4);
|
||||
float3 scale = float3(12.92);
|
||||
float3 offset = float3(1.055);
|
||||
float3 subtract = float3(0.055);
|
||||
float3 higher = offset * fast::pow(linearRGB.xyz, gamma) - subtract;
|
||||
float3 lower = linearRGB.xyz * scale;
|
||||
return float4(select(higher, lower, linearRGB.xyz < threshold), linearRGB.w);
|
||||
}
|
||||
|
||||
fragment float4 fragmentShader(ProjectedVertex in [[stage_in]], constant FrameUniforms &frameUniforms [[buffer(0)]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue