I observe a conflict between scene.fog, scene.imageProcessing and waterMaterial

See in this playground (https://www.babylonjs-playground.com/#1SLLOJ#616), if I set a contrast different from 1, the waterMaterial become visible behind the fog.

This is because the water material does not write content in linear mode. Only standard and PBR material can do it.

Pinging @julien-moreau to see if he wants to add it to his material :wink:

The relevant code is here:

Hello @julien-moreau, nice to meet you! I love the waterMaterial since I used it for the first time in https://wazana.io game. It really improves the quality of the game experience.

Do you think what @Deltakosh suggest is doable? :wink:

Hey @PichouPichou !
Sure it is doable, will update ASAP :slight_smile:

I’m finalizing a request feature on the editor to release ASAP. Then, will update the water material :slight_smile:
Will let you know once done!


Still in my TODO, will find some time really soon!!

Haha, thanks to keep us in touch @julien-moreau !

Hi @julien-moreau, I don’t want to bother but just a message to know if this done so that I can test it?

Cheerz :wink:

so just:

// Composition
vec4 color = vec4(finalDiffuse + finalSpecular, alpha);


	color.rgb = toLinearSpace(color.rgb);
		color.rgb = toLinearSpace(color.rgb);
		color = applyImageProcessing(color);

	gl_FragColor = color;

On the water fragment right?

I think I need to make the constructor flag if there is image processing or not now though on the scene and make it push that define.

I guess @Deltakosh is the one who can answer your question.
But it maches with the example he sent already so that must be it :wink:

@Pryme8 Yes but you could take a look how it is embedded in standardMaterial for instance as you also require the includes and all the different bindings/uniforms and so on.

kk, Ill take a look at getting us a PR to fix this then. I know julien is busy.

I am not at the house so I did this on the inline browser. Not sure if it has everything but I think it might.


@PichouPichou finally added the feature. I’m creating the PR soon :slight_smile:


PR here: Fixed VolumetricLightScattering post-process to use a custom vertex s… by julien-moreau · Pull Request #6640 · BabylonJS/Babylon.js · GitHub !

Awesome, thank you very very much @julien-moreau! :wink:

Thank you @julien-moreau I forgot I had an unfinished PR for this. I appreciate you remembering that we needed to fix this and doing the PR.