f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.88k stars 207 forks source link

Non-PBR materials do not support HDRI #533

Open Meakk opened 1 year ago

Meakk commented 1 year ago

Describe the bug When using a HDRI file, reflections are not visible on Non-PBR materials (like OBJ and some Assimp formats)

To Reproduce Steps to reproduce the behavior:

  1. Open the file using f3d --hdri=/path/to/hdri.hdr example.obj
  2. Notice reflections are not visible

Expected behavior Reflections should be visible (especially at high specular coefficient)

mwestphal commented 1 year ago

This one is becoming very very obvious since we have a default HDRI. Do you think it can be adressed ?

Meakk commented 1 year ago

It can be addressed of course, but it will take time

mwestphal commented 9 months ago

Care to develop a bit the issue and possible solution ?

Meakk commented 9 months ago

It requires a rework of the VTK polydata mapper to sample the HDRI (aka IBL) based on some magic tricks.
With PBR, we use the computed specular term to sample the HDRI at the right roughness level.
Without PBR, the user gives the specular value directly, but there are no roughness parameters, so maybe we can just use a random value.
Alternatively, we could override all non-PBR importers to force PBR and translate the legacy diffuse-specular materials to metallic-roughness, but again there is no magic translation.

mwestphal commented 9 months ago

Indeed not trivial.