Texture in png

mishranitish1301
Participant
Participant

Texture in png

mishranitish1301
Participant
Participant

I Applied an Ai standard surface on a mesh in the scene.

I use ramp shader in basecolor.

i want ramp  shader as an .png map images, how do i export the shader in png image map?Screenshot (323).png 

0 Likes
Reply
842 Views
10 Replies
Replies (10)

Kahylan
Advisor
Advisor

Hi!

 

You can use the "Convert to File Texture" command.

 

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/Maya-Lig...

 

This command is geometry based, if you want the ramp texture the same way you see it in the preview image you would first need to assign it to a square plane. But if you just want the result to look like what you have, you can just use the designated geometry and it will create a texture specific to those UV's instead.

 

I hope it helps!

0 Likes

mishranitish1301
Participant
Participant
it shows error
"// Error: file: D:/AUTODESK/MAYA/Maya2019/scripts/others/copyConvertSolidTx.mel line 826: No surfaces selected, unable to continue // "
0 Likes

Kahylan
Advisor
Advisor

As I said. It's geometry specific, so the geometry you want to convert your shader from needs to be selected.

0 Likes

mishranitish1301
Participant
Participant
can you please guide me how do this ?
0 Likes

Kahylan
Advisor
Advisor

Sure thing. I attached a video of how I do it.
I don't have software on my computer that displays keys when they are pressed. So in order to get to the "Assign new Material" Menu, I used Rightclick. And in order to add the shader to the selection in the Hypershade I held down Shift when I clicked it.

But if you already have an existing Ramp, you can use the Hypershade or the Node Editor to connect it to the shader you create.

 

I hope it helps!

0 Likes

mishranitish1301
Participant
Participant
No its not working
0 Likes

Kahylan
Advisor
Advisor

Did you have both the object that the shader is applied to and the shader (the shader not the ramp texture) selected when you ran the command?

0 Likes

mishranitish1301
Participant
Participant
Yes but still same error is showing
0 Likes

Kahylan
Advisor
Advisor

Thats weird, because this error should only be showing if there is no geometry selected...

Anyways, try selecting your ramp and then running this script from a python tab in the Script Editor:

import maya.cmds as mc

def exportRamp(name = ""):
    ramp = mc.ls(sl = True)[0]
    pl = mc.polyPlane(n = "standinPlane")[0]
    
    shader = applyMaterial(pl)
    mc.connectAttr('{}.outColor'.format(ramp),'{}.color'.format(shader) )
    
    mc.convertSolidTx( ramp,pl,sp = True,fur = True, rx=1024, ry=1024, fil = 'png', fin = name, f = True )
    mc.delete(pl)
    mc. delete(shader)
    

def applyMaterial(node):
    if mc.objExists(node):
        shd = mc.shadingNode('lambert', name="%s_lambert" % node, asShader=True)
        shdSG = mc.sets(name='%sSG' % shd, empty=True, renderable=True, noSurfaceShader=True)
        mc.connectAttr('%s.outColor' % shd, '%s.surfaceShader' % shdSG)
        mc.sets(node, e=True, forceElement=shdSG)
        return shd

exportRamp(name = "exportedRamp.png")
0 Likes

mishranitish1301
Participant
Participant
It's work
Before i only selected shader not mesh.

Thanks for the help