+1 tag for Google+

Tuesday, 28 October 2014

Setting Maya Viewport's Texture Resolution Above 256x256

While working on a project that required me to display map features in very fine detail, I ran into the problem of Maya's limited ability to show texture maps at higher than 256x256 in the viewport.

On the left is the source image supplied as a texture on the plane in the Maya scene, displayed from Window's image viewer. On the right inside of Maya is the same map that's loaded as a lower resolution map.

In the hardware texturing setting for that shader (I'm using a surface shader), we soon find out that 256x256 is the highest resolution we can choose to show our texture at.

Searching through the Internet I had the good fortune to come across this very useful tip on a blog that solved the problem for my situation:

To find out the current hardware texture resolution for the shader of this object, we have to find out the name of the shader. For me it is "mapFullLinesShader".
So if I open up my script editor and type in the following in an empty MEL tab and execute this line of script:
getAttr mapFullLinesShader.resolution;

This would get us the current texture resolution that mapFullLinesShader is displaying in the viewport. For me it was 256x256, so MEL returns "result: 256".

Therefore to set it to 1024x1024, I would have to enter the MEL command:
setAttr mapFullLinesShader.resolution 1024;

Thereafter the resolution displayed through the viewport is high enough to display the details needed for my work in the Maya scene.

Of course if 512 x 512 is sufficient for the situation we would change the script accordingly to:
setAttr mapFullLinesShader.resolution 512;

In some cases you may still be unable to see the resolution increase. In this case, check the shader's Textured Channel in the hardware texturing section. Switch between the different channels a bit, that may refresh the texture display. I usually find myself going back to the Combined Texture mode, and that works for me.

I hope it helps you if you run into the same situation :)