Skip to content

Commit

Permalink
USDZExporter: Add basic texture.colorSpace support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed May 8, 2023
1 parent 1fc687f commit 18b0428
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,6 @@ function buildMaterial( material, textures ) {

const uv = texture.channel > 0 ? 'st' + texture.channel : 'st';

const rawTextureExtra = `(
colorSpace = "Raw"
)`;

return `
def Shader "PrimvarReader_${ mapType }"
{
Expand All @@ -486,12 +482,12 @@ function buildMaterial( material, textures ) {
float2 inputs:translation = ${ buildVector2( texture.offset ) }
float2 outputs:result
}
def Shader "Texture_${ texture.id }_${ mapType }"
{
uniform token info:id = "UsdUVTexture"
asset inputs:file = @textures/Texture_${ id }.${ isRGBA ? 'png' : 'jpg' }@ ${mapType === 'normal' ? rawTextureExtra : ''}
asset inputs:file = @textures/Texture_${ id }.${ isRGBA ? 'png' : 'jpg' }@
float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
token inputs:wrapS = "repeat"
token inputs:wrapT = "repeat"
float outputs:r
Expand Down

0 comments on commit 18b0428

Please sign in to comment.