Understanding the HDR option for DefaultRenderingPipeline

In the DefaultRenderingPipeline constructor we have an optionnal hdr property, which is true by default. I often turn it to false, to get my raw RGB value for my background, example:

hdr

As you can see, nothing change on my 3D materials (playground available: hdr on, hdr off, line 28, results are the same when in standard materials [on - off]).

And for now, all we have in the documentation about this property is Do you want HDR textures? and If high dynamic range textures should be used (default: true) from the API, and I think this should be clarified (I will make the PR ;)) : on which kind of textures/properties this HDR value is applied exactly?

My guesses:

  • backgroundMaterials
  • scene environmentTexture when in PBR? (but it seems not, because why my materials rendering doesn’t change?)

After looking at the sources, what does hdr = true:

  • First note that hdr is set back to false if your GPU does not support one of the half float or float texture type (meaning hdr remains true only if the GPU supports at least half float or float textures)
  • [EDIT] Forgot to say that if hdr remains true, texture types used by the post process effects are half float textures if supported, else float textures
  • The image processing post process is done after bloom and before sharpen and is not applied on a per mesh basis as it is by default

That’s the only things I noticed…

1 Like

Nice spots, it’s already useful information to add to the doc.
So in short, this hdr value only apply on the post-process texture used by the pipeline that’s it?

('will also wait for Deltakosh, sebavan or trevor feedbacks, who are the code contributors)

I just had another issue (imageProcessing not applied on background layer, and so the vignette [hdr on - hdr off]), and these points have also to be saved into the doc’ IMO:

And by the way ^^

OK so after some tries I haven’t find a way to use a BABYLON.Layer as background without having it “gammaized” (or linearized?) :’( (cf https://www.babylonjs-playground.com/#ECI2Q0#16).

And it seems that doing the trick by settings scene.clearColor transparent, and simply using CSS to set a background works well… but not on iOS (scene clear… isn’t cleared on our devices)

The Layer uses this shader:

It is fast but does not take in account Gamma or linear
The idea could be to simply add":

#ifdef LINEAR
		color = toGammaSpace(color);
	#endif

And jsut set the LINEAR define from the texture linear info

That’s could be great!

fancy doing a PR? Or maybe @Evgeni_Popov?

I will do the PR about the documentation for HDR property, but I’m scared about the shader :smiley:

It is a good exercise :slight_smile:

1 Like

For me it’s the other way around, when HDR is enabled image processing is performed in a post process in another render pass, whereas if it is disabled it is performed during rendering of meshes

Then I will let @Vinc3r do it, as I have already worked on shader related code ;).

Also, I’m working on something else that I would like to finish before the holidays, so trying to stay focus!

I can do it @Vinc3r so do not feel any pressure;)

Well actually I will do it and show you so next time you will be able to do it :wink:

1 Like

Ahah ok.
It’s just that for the documentation, I’m now used to grunt build & serve, so I’m able to know if I broked something, but I never tried to check if my Babylon fork is broke after a change (all I have done in /src/ is just for API comments for now, so that’s safe).

ok will be in next nightly (you will have to flag the texture used with the layer with texture.gammaSpace = false

2 Likes

So here my modifications:

(current version)

have I missing something or misunderstanding a point?

(edit: notice I wrote to use HDR texture? instead of to use HDR textures?, is it wrong?)

1 Like

Seems perfect to me!

So, PR on its way! :slight_smile:

1 Like