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

Howto render without shadows in custom gui built using python binding #4329

Open
hernot opened this issue Nov 21, 2021 · 5 comments
Open

Howto render without shadows in custom gui built using python binding #4329

hernot opened this issue Nov 21, 2021 · 5 comments

Comments

@hernot
Copy link

hernot commented Nov 21, 2021

When setting lightning to NO_SHADOWS than all surfaces are black even when enabling indirect light.
In visualization/Open3DVisualizer.cpp also the FillamentScene.GemoetryShadows function is called when displaying a TriangleMesh without shadows, which is not available through python binding of o3d.visualization.rendering.Scene Is there an other trick to get surfaces properly rendered when turning off shadows. With sun enabled and any other shadow settings surfaces are rendered with colors visible but the down is shadows make it hard to interpret the data encoded by surface colors.

System Mint 20., Python 3.8 Open3D 0.13.x

BTW:
I also get in my installation the following warnings from python:

[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx
[Open3D WARNING] Resource request for path /usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx failed:
* Code: 2
* Error: Failed to read spherical harmonics from ktx

Could these be related. And how to resolve them as the files and the related skybox files do exist. and are writeable for owner and readable for owner,group,others.

Open3d was installed from pypi wheel globally as superuse so that all users can use.

@yxlao yxlao added build/install Build or installation issue visualization and removed build/install Build or installation issue labels Nov 22, 2021
@hernot
Copy link
Author

hernot commented Nov 22, 2021

Seems as would the missing harmonics error prevent loading any ibl files and thus no indirect light is set at all. Do you see any chance to get at least a working default_ibl.ktx or brightday_ibl.ktx for manual installation as proper as shadow free rendering as possible is crucial to us and we do not have the resources (especially man power) to install filament just for ibl.ktx file generation but need the results timely from now. Therefore if you could point to a link or resource where to find and download sutiable *_ibl.ktx files would be apriciated as an intermediate workaround until solved on the next open3d release pypi-wheel.

@hernot
Copy link
Author

hernot commented Nov 23, 2021

Cracy I found it after downloading binary filament package and trying to convert my own ibl file. Which did not work either. Reading carefully the code behind of filament::KtxBundle::getSphericalHarmonics it turned out that they are using std::strtof function to parse the ascii encoded spherical harmonics. And std::strtof is causing all the problems cause it is locals sensitive. And as our computers are set to German/Austrian locals std::strtof expects , for decimal separator compared to English based locals which use . for decimal separator. By modifying the spherical harmonics list inside for example derfault_ibl.ktx file accordingly, replacing . by , all errors (warnings) related to spherical harmonics are gone and SOFT_SHADOWS as well as NO_SCHADOWS lightning works as expected even without FillamentScene.GemoetryShadows beeing available through python interface.

Not sure if as a quick-fix within open3d it would be a wise idea to temporarily switch locals (at least on linux, mac, android and alike) to default or C or en before calling `bundle.getSphericalHarmonics function and back to what user has set for his system.

The final fix anyway has to be done on filament sources (see filament issue #4883 ).

@hovren
Copy link

hovren commented Mar 4, 2022

It seems like the issue was fixed in Filament, but the error is still present in Open3D 0.15.2.
A work around until the issue is fixed is to change the locale before performing the visualization:

# Set the locale to 'C' to allow default_ibl.ktx to load
import locale
loc = locale.getlocale()
locale.setlocale(locale.LC_ALL, 'C')

app = gui.Application.instance
app.initialize()

# Visualization goes here
...

app.run()

# Reset the locale
locale.setlocale(locale.LC_ALL, loc)

@hernot
Copy link
Author

hernot commented Oct 5, 2022

Yes it was, after i have reported it. Without this fix in fillament all surfaces are just black.

A rather annoying fix is edit all affected *.kblfiles eg.:
/usr/local/lib/python3.8/dist-packages/open3d//resources/default_ibl.ktx

Replace at top of the file the '.' in all float numbers by ',' or whatever decimal separator is used by your locals.

A proper fix is only possible through open3D project updating fillament version.

@hernot
Copy link
Author

hernot commented Mar 13, 2023

Are there any plans to update to newer fillament version to finally fix this really anyoing issue as it persists since at least 2 if not even more versions of open3d, reducing the value of open3d for all which have not set their locals to english and either are not allowed to change or have other reasons preventing them to change. Fillament download cmake file has not be changed since 2 years while compilation cmake has been change 4 month ago.

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

No branches or pull requests

4 participants