Distorted HDR IBL Reflections

Ok now I see it lol
Thanks a lot

I don’t know why we have this difference (yet)

Let see on monday if @Evgeni_Popov has an idea. Seems like the way we sample the IBL is the problem here.

1 Like

OK, @Deltakosh thank you very much indeed for taking a look. @Evgeni_Popov was cc’d by @sebavan prior and he wasn’t quite sure why this was happening either, it would seem. I suppose a work around for now might be to attempt scale the IBL texture according to the current field of view something like (where the HDR Texture has already been set as the environment texture🤣):

// Calculate scale factor based on camera FOV
var scaleFactor = Math.tan(camera.fov / 2) * camera.position.subtract(camera.target).length();

// Apply scale factor to the IBL texture’s UV coordinates
this.scene.environmentTexture.uScale = scaleFactor;
this.scene.environmentTexture.vScale = scaleFactor;

But this doesn’t appear to work.

Yeah I want to dig more into it with @sebavan and @Evgeni_Popov

1 Like

Ok, no worries. Thanks. @Deltakosh

It sounds correct to me that reducing the fov is equivalent to a zoom effect as you would see a smaller portion of the environment on the same surface.

Yes this is also my feeling :wink: I’m even trying that with my phone lol

@sebavan I’m only doing this to allow for the close-up zooming of meshes in the scene. At the default setting of 0.8, the mesh is obviously clipped when the camera gets too close.

Why not adapting the camera range instead ?

@sebavan I wasn’t aware there was a “range” property. I’m using an ArcRotationCamera. I change the radius value to zoom in, however past a certain point the mesh is clipped. Supposedly because it falls outside the camera’s field of view. Just looking at the docs for the camera here: Babylon.js docs What properties or method can I use to adjust the range such that the mesh is not clipped when I zoom in?

1 Like

you can set the “range” by setting camera.minZ = 0.01 for instance

2 Likes

or maxZ of course depending on the clipping plane

1 Like

Thanks @Deltakosh I’ll do this instead and leave the FOV setting at it’s default setting.

1 Like

Happy we found a way:)

1 Like