Skip to content

Commit

Permalink
Implements approach agreed to here: mrdoob#10691 Support Substance Oc…
Browse files Browse the repository at this point in the history
…clusionRoughnessMetallic maps.
  • Loading branch information
bhouston committed Feb 1, 2017
1 parent a4e4b18 commit 602a981
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/renderers/shaders/ShaderChunk/aomap_fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef USE_AOMAP

// reads channel R, intended to be used with a combined OcclusionRoughnessMetallic (RGB) texture
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;

reflectedLight.indirectDiffuse *= ambientOcclusion;
Expand Down
4 changes: 3 additions & 1 deletion src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP

vec4 texelMetalness = texture2D( metalnessMap, vUv );
metalnessFactor *= texelMetalness.r;

// reads channel B, intended to be used with a combined OcclusionRoughnessMetallic (RGB) texture
metalnessFactor *= texelMetalness.b;

#endif
4 changes: 3 additions & 1 deletion src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP

vec4 texelRoughness = texture2D( roughnessMap, vUv );
roughnessFactor *= texelRoughness.r;

// reads channel G, intended to be used with a combined OcclusionRoughnessMetallic (RGB) texture
roughnessFactor *= texelRoughness.g;

#endif

0 comments on commit 602a981

Please sign in to comment.