godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.17k stars 19.16k forks source link

The issue of transmittance and refractive index of glass materials for mobile devices #93417

Open jianliang-li opened 1 week ago

jianliang-li commented 1 week ago

Tested versions

4.0,4.0.4,4.2

System information

14.4 (23E214)

Issue description

Does Godot 3D Shader Script have transmission and ior parameters for materials like Threejs? I only found (subsurf_scatter_transmittance_boost) and (vec3 extract (vec3 I, vec3 N, float eta)), The previous one has no effect on the mobile end, and the latter one has no instructions on how to use it. I don't know how to use it. The transmission and ior parameters of threejs are two float parameters that can be easily set to module glass materials.

Threejs: image image

Blender: image

Steps to reproduce

Use transmission and IOR to control the transparency of glass

Minimal reproduction project (MRP)

none

Calinou commented 1 week ago

There is a refraction strength parameter available if you enable refraction in BaseMaterial3D, but it's defined as an arbitrary factor as opposed to IOR.

Exposing an IOR value is feasible if there's a reliable conversion formula.