Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#if SAMPLE_COUNT == 1 Texture2D <float4> hdr; #else Texture2DMS <float4, SAMPLE_COUNT> hdr; #endif float exposure; float3 main(PsIn In) : SV_Target { int3 texCoord = int3((int2) In.position, 0); float3 color = 0.0; [unroll] for (int i = 0; i < SAMPLE_COUNT; i++){ float3 sample = hdr.Load(texCoord, i).rgb; // Tonemapping each sample individually color.rgb += 1.0 - exp2(-sample * exposure); } // Average color *= (1.0 / SAMPLE_COUNT); // We're outputting to an sRGB framebuffer, so this code is not needed. // However, for regular non-sRGB framebuffers this would be neccesary. //color = pow(color, 1.0 / 2.2); return color; } |
Werbeanzeige