gameknife / gkNextRenderer

A Modern gkRenderer
15 stars 2 forks source link

import glbs #23

Open tigrazone opened 4 days ago

tigrazone commented 4 days ago

I'm importing glb to another raytracer and glass not imported ok. image how to support these glass? can you change scene with extra: "glass"?

For luxball scene I find in code https://github.com/gameknife/gkNextRenderer/blob/b90eb1324c4d8c98cece9128641ad0f1c388fc24/src/Assets/Model.cpp#L245-L248 and do in my renderer code

    if(tmat.extras.Has("glass"))
    {
      gmat.ior.ior = 1.46f;
      gmat.transmission.factor = 1.0f;
    }

image image

tigrazone commented 4 days ago

maybe is more correct way is set ior and transmissionFactor? https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_ior/README.md https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_transmission/README.md

gameknife commented 4 days ago

my source scene is edit in blender, I will check if it can export ior and transmission

gameknife commented 4 days ago

updated three glb to export ior & transmission, and update the model.cpp

tigrazone commented 4 days ago

Thank you!

tigrazone commented 4 days ago

For which purposes you plan to use RefractionIndex2? Why not RefractionIndex?

gameknife commented 3 days ago

For which purposes you plan to use RefractionIndex2? Why not RefractionIndex?

specific for qx50 scene, the car glass is single layered, ior2 make the refraction ray pass through directly~ a trick, with extra

tigrazone commented 2 days ago

looks like thinwalled https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_volume/README.md thicknessFactor

  // Thin film approximation
  if(mat.thicknessFactor == 0.0F && mat.roughness > 0.0F)
  {
    refractedDir = sampleThinTransmission(data, mat);
  }
  else
  {
    refractedDir = sampleSolidTransmission(data, mat, refracted);
  }

https://github.com/nvpro-samples/nvpro_core/blob/a3990a04a9769f3bc6b59a915b0078c32e786d34/nvvkhl/shaders/bsdf_functions.h#L197-204

tigrazone commented 2 days ago

better way to set bool thinWalled = material.thicknessFactor < 0.011; because precission issues and I rewrite in by fork repo if(mat.thinWalled && mat.roughness > 0.0F)

tigrazone commented 2 days ago

maybe dielectrics works wrong. because when I just open qx50.glb and start to render by https://github.com/nvpro-samples/vk_shaded_gltfscene and glass rendered w/o issues. q50

I use previous version of vk_shaded_gltfscene and nvpro_core bacause new version have issues

tigrazone commented 2 days ago

kitchen scene has strange glass material kitchen1