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

Reflection MirrorTexture is not affected by PBRMaterial's roughness #5146

Closed
fsmorygo opened this issue Sep 14, 2018 · 8 comments
Closed

Reflection MirrorTexture is not affected by PBRMaterial's roughness #5146

fsmorygo opened this issue Sep 14, 2018 · 8 comments

Comments

@fsmorygo
Copy link

  • Bug repro on playground:
  • Expected result:
    Reflected ball is affected by material's roughness and become blurres as it's value comes to 1
  • Current result:
    Reflected ball is constantly sharp no matter what metallic or roughness values the mirror material has
@sebavan
Copy link
Member

sebavan commented Sep 14, 2018

As we are trying to work towards a real time solution for prefiltering cube texture from probes or mirror, we fixed some default setup of prefiltreing but it unfortunately impacted the mirror.

As a workaround you can set manually the lod generation offsets and scale in your application. I will update the reflection probe to their default previous setup:

mirrorTexture.lodGenerationOffset = 0;
mirrorTexture.lodGenerationScale = 0.8;

In order for it to work you also need to generate mipmap of the mirror

http://www.babylonjs-playground.com/#06UJB4#1

I am closing the issue for now as real time prefiltered texture is in already in our list of future potential candidates.

@sebavan sebavan closed this as completed Sep 14, 2018
@fsmorygo
Copy link
Author

@sebavan i see that blurred reflection is creating in the grid (due to the mipmaps i guess) Is there a way to achieve blurring without those steps. this looks awkward in motion.

@sebavan
Copy link
Member

sebavan commented Sep 14, 2018

Nope, for PBR to work accurately, the environment needs to be prefiltered in a special way hence the use of Prfiltered Cube Map form external tools.

This step being slow... pretty slow a few techniques with lower quality but still rather expensive (GPU wise) exists. These are the one we are plannning to add to our toolset.

Relying on MipMaps (hardware generated) without the extra setup is totally not accurate and usually blocky for high roughness. This is why we will give a shot to the other techniques.

More info available here: https://learnopengl.com/PBR/IBL/Specular-IBL

@fsmorygo
Copy link
Author

@sebavan The issue is back with 4.1.0, i've lost all roughness in mirrors, having mipmaps, lod scale and everythis set. It was working in 4.0.3

@sebavan
Copy link
Member

sebavan commented Mar 22, 2020

Could you provide a playground with the issue ?

@fsmorygo
Copy link
Author

@sebavan
Copy link
Member

sebavan commented Mar 23, 2020

It is because there was a bug with mipmaps generated for bilinear sampling before, the mode now needs to be forced to a filtering mode requiring mipmaps:

https://www.babylonjs-playground.com/#1YAIO7#90

@fsmorygo
Copy link
Author

Thanks @sebavan, this seems to work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants