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

Thin-film interference #2347

Open
hhhhkrx opened this issue Aug 20, 2024 · 3 comments
Open

Thin-film interference #2347

hhhhkrx opened this issue Aug 20, 2024 · 3 comments
Assignees
Labels
glTF Rendering Rendering related functions shader Shader related functions
Milestone

Comments

@hhhhkrx
Copy link
Contributor

hhhhkrx commented Aug 20, 2024

GLTF

https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_iridescence

UNITY HDRP

https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@14.0/manual/Material-Type.html
image

Babylon

https://github.com/BabylonJS/Babylon.js/blob/baf64330206f50880ae5bc874affbfd0f85f67ea/packages/dev/core/src/Shaders/ShadersInclude/pbrBRDFFunctions.fx#L188
uniform 和 gltf2.0一一对应
20240830140758

three.js

https://threejs.org/examples/#webgl_loader_gltf_iridescence
image

技术对比

  • 在计算第一层 薄膜折射率 的算法中这几个引擎都大差不差,基本框架是一样的,只是算法的小细节不太一样,babylon和three.js的算法重叠度较高,完全一致
  • 虽然unity hdrp管线是针对pc端,但是关于iridescence的算法其实是做了简化

总结

  • unity的算法更简化,算法中避免了大量的临时变量的创建,尤其是向量的操作,相对来说更节省内存,但和gltf的uniform无法对应,参考意义不大
  • 相较于unity,gltf官方/babylon/thress.js基本都是类似的算法,并未做太多简化

方案

目前我们已有的:
basetexture 对应 薄膜干涉颜色纹理,iridescence 对应 强度,iridescent ior 对应 折射率,厚度仅输出了 iridescence Thickness
需要增加的:
针对gltf2.0的标准补充 薄膜干涉厚度纹理,薄膜干涉最小厚度,薄膜干涉最大厚度

@zhuxudong
Copy link
Member

@zhuxudong
Copy link
Member

pow 和 square 这个不算差异,只是语法不同

@zhuxudong
Copy link
Member

调研一下这个默认参数,折射率1.3,厚度400,有什么讲究没,我看我们目前是2和0.1,相差有点大

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
glTF Rendering Rendering related functions shader Shader related functions
Projects
None yet
Development

No branches or pull requests

3 participants