iimachines / Maya2glTF

Maya to glTF 2.0 exporter
MIT License
326 stars 49 forks source link

can't assign textures to PBR on MacOS #174

Open psql opened 2 years ago

psql commented 2 years ago

Picked the shader glTF_PBR.ogsfx, then went to select my textures and this error returned:

/Users/pasquale/maya/maya2glTF/PBR/shaders/glTF_PBR.ogsfx
// Warning: file: /Users/Shared/Autodesk/maya/2022/scripts/maya2glTF_assignPbrShader.mel line 94: Plug-in, "glslShader.bundle", is already loaded.  Skipped. // 
// Error: Error loading effect file "/Users/pasquale/Documents/Maya2glTF/maya/renderData/shaders/glTF_PBR.ogsfx":

Failed to compile --> PIXEL SHADER <-- 
Errors:
=========================
ERROR: 0:248: '' : syntax error: #extension must always be before any non-preprocessor tokens
WARNING: 0:248: extension 'GL_ARB_texture_query_levels' is not supported

246: // Pixel shader block:PS
247: 
248: #extension GL_ARB_texture_query_levels : enable
249: 
250:  const float c_MinRoughness = 0.04;
 // 
connectAttr -f GLSLShader1.outColor GLSLShader1SG.surfaceShader;
// Connected GLSLShader1.outColor to GLSLShader1SG.surfaceShader. // 
sets -e -forceElement GLSLShader1SG;
// GLSLShader1SG // 
// Created shader GLSLShader and assigned to the selected objects. //
Using '/Users/pasquale/MO Labs Dropbox/production/3d/maya/props/tomb-stone/gltf-out' as next texture folder
'/users/pasquale/mo labs dropbox/production/3d/maya/props/tomb-stone/gltf-out/pxrsurface4sg_basecolor.png' matched texture pattern 'basecolor'
shadingNode -asTexture -isColorManaged file;
// file1 // 
shadingNode -asUtility place2dTexture;
// place2dTexture1 // 
connectAttr -f place2dTexture1.coverage file1.coverage;
// Connected place2dTexture1.coverage to file1.coverage. // 
connectAttr -f place2dTexture1.translateFrame file1.translateFrame;
// Connected place2dTexture1.translateFrame to file1.translateFrame. // 
connectAttr -f place2dTexture1.rotateFrame file1.rotateFrame;
// Connected place2dTexture1.rotateFrame to file1.rotateFrame. // 
connectAttr -f place2dTexture1.mirrorU file1.mirrorU;
// Connected place2dTexture1.mirrorU to file1.mirrorU. // 
connectAttr -f place2dTexture1.mirrorV file1.mirrorV;
// Connected place2dTexture1.mirrorV to file1.mirrorV. // 
connectAttr -f place2dTexture1.stagger file1.stagger;
// Connected place2dTexture1.stagger to file1.stagger. // 
connectAttr -f place2dTexture1.wrapU file1.wrapU;
// Connected place2dTexture1.wrapU to file1.wrapU. // 
connectAttr -f place2dTexture1.wrapV file1.wrapV;
// Connected place2dTexture1.wrapV to file1.wrapV. // 
connectAttr -f place2dTexture1.repeatUV file1.repeatUV;
// Connected place2dTexture1.repeatUV to file1.repeatUV. // 
connectAttr -f place2dTexture1.offset file1.offset;
// Connected place2dTexture1.offset to file1.offset. // 
connectAttr -f place2dTexture1.rotateUV file1.rotateUV;
// Connected place2dTexture1.rotateUV to file1.rotateUV. // 
connectAttr -f place2dTexture1.noiseUV file1.noiseUV;
// Connected place2dTexture1.noiseUV to file1.noiseUV. // 
connectAttr -f place2dTexture1.vertexUvOne file1.vertexUvOne;
// Connected place2dTexture1.vertexUvOne to file1.vertexUvOne. // 
connectAttr -f place2dTexture1.vertexUvTwo file1.vertexUvTwo;
// Connected place2dTexture1.vertexUvTwo to file1.vertexUvTwo. // 
connectAttr -f place2dTexture1.vertexUvThree file1.vertexUvThree;
// Connected place2dTexture1.vertexUvThree to file1.vertexUvThree. // 
connectAttr -f place2dTexture1.vertexCameraOne file1.vertexCameraOne;
// Connected place2dTexture1.vertexCameraOne to file1.vertexCameraOne. // 
connectAttr place2dTexture1.outUV file1.uv;
// Connected place2dTexture1.outUV to file1.uvCoord. // 
connectAttr place2dTexture1.outUvFilterSize file1.uvFilterSize;
// Connected place2dTexture1.outUvFilterSize to file1.uvFilterSize. // 
defaultNavigation -force true -connectToExisting -source file1 -destination GLSLShader1.u_BaseColorTexture;
// Error: line 0: No object matches name: GLSLShader1.u_BaseColorTexture // 
ziriax commented 2 years ago

GL_ARB_texture_query_levels is supported on very old hardware, so that is odd...

What hardware do you have?

What is selected in the preferences for Rendering Engine?

image

psql commented 2 years ago

image image

Is it supposed to ask for the location of the shader each time? Would be nice if this could be specified in a field so it remains sticky/default.

btw something weird just happened. I reloaded the scene when hopping around across a few files, and now it works flawlessly. 🤣

psql commented 2 years ago

...and now it's busted again. trying to work out how to recreate my fix. I'm getting the same error again in a new scene. it honestly felt like a random fluke that it worked again. I don't recall changing anything, but I did open my script editor and noticed the shader compile error was gone the time it worked.

ziriax commented 2 years ago

Since I don't have a recent Mac it is very hard for me to find out what is going on unfortunately.

This project desperately needs Mac developers 😉

ziriax commented 2 years ago

You could try putting the viewport rendering engine on something else, like OpenGL Legacy, and see what happens.

I find it weird that you GPU doesn't support the required extension, every modern card should have that I guess?

psql commented 2 years ago

@Ziriax what's weirder is that it randomly worked one time and now I can't recreate it for the life of me. You got any Mac dev friends? Would happily fund a few hours to crack this :)