Skip to content

MeshPhysicalMaterial should use the thin surface model when thickness is zero #23448

@WestLangley

Description

@WestLangley

The thin-surface model and the volume model should be separate models in the MeshPhysicalMaterial shader.

Currently, only the volume model is implemented, and if thickness is 0, all components of attenuation color must be non-zero, otherwise the material renders black. A properly-implemented thin-surface model would prevent that.

Maybe define USE_VOLUME if ( .thickness > 0 ). Then something like:

#ifdef USE_TRANSMISSION

	#ifdef USE_TRANSMISSIONMAP

		transmissionFactor *= texture2D( transmissionMap, vUv ).r;

	#endif

	#ifdef USE_THICKNESSMAP

		thicknessFactor *= texture2D( thicknessMap, vUv ).g;

	#endif

	#ifdef USE_VOLUME

		vec4 transmission = getIBLVolumeRefraction( ... );

	#else

		vec4 transmission = getIBLThinSurfaceRefraction( ... );

	#endif

	totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );

#endif

three.js version: r.137

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions