Skip to content

Commit

Permalink
re-add normal scale and bias
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Jul 26, 2023
1 parent 3711cd1 commit b36098b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {

}

const needsNormalScaleAndBias = mapType === 'normal';
const normalScaleValueString = material instanceof THREE.MeshStandardMaterial
? (material.normalScale ? material.normalScale.x * 2 : 2).toFixed( PRECISION )
: "1";

return `
def Shader "PrimvarReader_${ mapType }"
{
Expand All @@ -515,6 +520,10 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' }
token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
${needsNormalScaleAndBias ? `
float4 inputs:scale = (${normalScaleValueString}, ${normalScaleValueString}, ${normalScaleValueString}, 1)
float4 inputs:bias = (-1, -1, -1, 0)
` : `` }
token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
float outputs:r
Expand Down

0 comments on commit b36098b

Please sign in to comment.