To create an ORM texture, an incorrect value is passed
AndreyPrakhov opened this issue · 2 comments
AndreyPrakhov commented
Description of the bug
The gbuffer-metalness.frag chunk uses 'metalness'
#ifdef out_ORM
out_ORM.z = metalness;
#endif
In the THREE shader chunk the code looks like this (metalnessmap_fragment.glsl.js):
float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
metalnessFactor *= texelMetalness.b;
#endif
In theory, the correct code to fill the buffer should look like this:
#ifdef out_ORM
out_ORM.z = metalnessFactor;
#endif
Library versions used
- Three: [162]
- Post Processing: v7.0.0-alpha.3
vanruesc commented
Thanks for pointing this out! It will be fixed in the next release via cdd1558.
Until then you can use the following snippet to patch it right after instantiating the RenderPipeline
:
const pipeline = new RenderPipeline(...);
ShaderChunk.metalnessmap_fragment = ShaderChunk.metalnessmap_fragment.replace(
"out_ORM.z = metalness;",
"out_ORM.z = metalnessFactor;"
);
vanruesc commented
Fixed in postprocessing@7.0.0-alpha.4
.