-
Notifications
You must be signed in to change notification settings - Fork 113
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
metallic not rendered well #62
Comments
The vk_gltf_renderer has the physically correct PBR, not an approximation like vk_raytrace, but the problem with the bolts seems to be the missing tangents. Unlike vk_raytrace, attributes are not always generated on scene load, but passed directly to the render engine. If the attribute is missing and requested, it uses a default value, or in the case of tangents, tries to create something on the fly. In this case, the tangents aren't created correctly and appear to be NULL. Thank you for reporting the problem with this scene. We'll see what we can do to fix this and still keep the amount of data generated to a minimum. |
is it good idea to calculate absent tangents with simple formula
code taken from https://github.com/DassaultSystemes-Technology/dspbr-pt/blob/e7cfa6e9aab2b99065a90694e1f58564d675c1a4/packages/lib/shader/utils.glsl#L119 |
The computation of tangent vectors is not problematic; however, the scene contains tangent data, some of which are represented as (0,0,0,1) vectors. The validity of such null tangents is uncertain with respect to the glTF specification. For example, the following as issues:
Note: vk_raytracing project goes over all the data and fixes invalid values, before uploading to the GPU. It would be possible for example to do the following in the get_hit
But I'm not sure if the renderer should fix. |
it helps. thank you |
I do it with precission fix
where isZERO() is
|
This is the version that might be committed
|
Maybe better to do this precalc on CPU side for faster rendering? |
The math is "free" on a fast GPU, but changing the scene on the fly bothers me. This could be a choice of the artist, even if a tangent of length != 1.0 is not legal. So basically there is no bug in the vk_gltf_renderer, it is just the scene that is not correct. I'm looking into the possibility of adding a tool to fix the scene, then the user could save it again to avoid having to fix it every time. |
Why not use only calculated tangents? |
To close this issue: There is now a tool in vk_gltf_renderer to create/fix tangents. Once fixed, the scene can be saved and does not need any further corrections. |
same scene rendered by vk_raytrace, Disney
![image](https://private-user-images.githubusercontent.com/3808839/358867161-216e0d02-3c8f-45e2-8102-3d5f0afa269a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMjIzMzQsIm5iZiI6MTcyNjEyMjAzNCwicGF0aCI6Ii8zODA4ODM5LzM1ODg2NzE2MS0yMTZlMGQwMi0zYzhmLTQ1ZTItODEwMi0zZDVmMGFmYTI2OWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTJUMDYyMDM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjRjMGE2Y2ZiZGE4YjE5YTAzZDNmZDE0MWYyMjBkOTY3OThhYTQxMTg3YmMwYTllZWQwNjUxOTIzMzU3MDA1NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.bT0Sku2GeUUqxskPwizZW52t3oYQsJt4ucO_uWmYTx8)
scene taken from https://github.com/h3r2tic/rtoy-samples/tree/main/assets/meshes/pica_pica_-_mini_diorama_01
which variant of brdf implementation is better and physically correct?
The text was updated successfully, but these errors were encountered: