Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: clean up #26678

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/webgl_tonemapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@
renderer.toneMapping = toneMappingOptions[ params.toneMapping ];
renderer.toneMappingExposure = params.exposure;


// Set CustomToneMapping to Uncharted2
// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/

THREE.ShaderChunk.tonemapping_pars_fragment = THREE.ShaderChunk.tonemapping_pars_fragment.replace(

'vec3 CustomToneMapping( vec3 color ) { return color; }',

`#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )

float toneMappingWhitePoint = 1.0;

vec3 CustomToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );

}`

);

scene = new THREE.Scene();
Expand Down Expand Up @@ -138,6 +143,7 @@
render();

} );

const backgroundFolder = gui.addFolder( 'background' );

backgroundFolder.add( params, 'blurriness', 0, 1 )
Expand Down