KhronosGroup / glTF-Sample-Assets

To store all models and other assets related to glTF
256 stars 30 forks source link

IOR test model? #29

Closed bhouston closed 7 months ago

bhouston commented 9 months ago

I was looking for a model that shows the effect of different IORs (KHR_material_ior) in a very clear fashion. I could not find one. I think we link our IOR for the specularity with the IOR for volume effects, thus maybe we should show both effects in a clear fashion in the normal range of 1.0 to 2.5 ior? And maybe we could combine it with specular color as well?

I was thinking maybe a grid of 4 x 4 spheres. in front of a checkered background (like the current transmission test.)

And from left to right, the sphere ior is 1.0, 1.5, 2.0, 2.5.

In the top column, we can do a black roughness=0 metal=0 transmissive=0, specular=0.25 In the second column, we can do a black roughness=0 metal=0 transmissive=0, specular=1 In the third column, we can do a white roughness=0 metal=0 transmissive=1, specular=0.25 In the forth column, we can do a white roughness=0 metal=0 transmissive=1, specular=1

This would test both transmission as well as specular in coordination with IOR.

emackey commented 8 months ago

@bhouston How about this one? TransmissionRoughnessTest

echadwick-artist commented 7 months ago

How does this look? If it's acceptable as-is I'll submit to the repo, otherwise let me know if it needs work.

2023-11-12 17_35_37-glTF Preview  IORTestGrid gltf  - Visual Studio Code

IORTestGrid.zip

emackey commented 7 months ago

@echadwick-artist That's a nice model. Also it tests something that I've been meaning to test, but never actually built before: What happens if KHR_materials_transmission JSON exists but the transmission parameter is the default zero?

This is off-topic on this thread, but I always love when a test model can expose inconsistencies and issues. Here's the bottom row rendered with BabylonJS:

BabylonJS image

And Filament:

Filament image

And ThreeJS:

ThreeJS image

The correct behavior is: "Transmission" effects should be enabled by the transmissionFactor value, not by the presence or absence of any JSON structure in the glTF. This model contains an explicit extension that sets transmission to 0.0, meaning the effects of transmission should be disabled. ThreeJS is doing this correctly, as we can see the black spheres are part of the opaque pass being sampled by the transmissive spheres. The other two sample renders show parts of the black spheres missing, even though they should be opaque.

But back on topic, I think this is a good test model. If I could add a suggestion, maybe add a white background behind the label text? Overall this model will be a great addition to sample assets.

echadwick-artist commented 7 months ago

I think it's good we have a test for "transmissionFactor":0

I'll add a white backdrop for the labels, and extend the checker backdrop a bit too.

echadwick-artist commented 7 months ago

@emackey I looked through the specification for KHR_materials_transmission but I couldn't find any mention of the rule you stated:

This model contains an explicit extension that sets transmission to 0.0, meaning the effects of transmission should be disabled.

Is this codified somewhere?

echadwick-artist commented 7 months ago

Done!