Forum: Poser - OFFICIAL


Subject: Modify Specular across all skin materials

3doutlaw opened this issue on Feb 29, 2012 · 8 posts


3doutlaw posted Wed, 29 February 2012 at 4:23 PM

Is there an easy way to just modify the specular across all the skin amterials of V4 at once?  I just want to set it 0.2, from 0


ashley9803 posted Thu, 01 March 2012 at 12:35 AM

I would also like to know that one. You can copy/paste materials between like zones, but how do you get the exact same specular from say, torso to limbs. It's always been hit and miss for me, but I'm sure there must be an easy way.


Medzinatar posted Thu, 01 March 2012 at 1:26 AM

I use simple python fragment, as below

sets specular value in all materials to chosen value for current figure

choose_val = 0.6   #  value

import poser
scn = poser.Scene()
fig = scn.CurrentFigure()
mats = fig.Materials()
if mats:
    print fig.Name()   
    for mat in mats:
        tree=mat.ShaderTree()
        n = tree.NodeByInternalName("PoserSurface")
        if n:
            i = n.InputByInternalName("Highlight_Value")
            if i:
                i.SetFloat(choose_val)
        tree.UpdatePreview()
scn.DrawAll()

 



3doutlaw posted Thu, 01 March 2012 at 7:26 AM

OK, I would try the below...if I had any clue what to do with a Python fragment?

 

Quote - I use simple python fragment, as below

sets specular value in all materials to chosen value for current figure

choose_val = 0.6   #  value

import poser
scn = poser.Scene()
fig = scn.CurrentFigure()
mats = fig.Materials()
if mats:
    print fig.Name()   
    for mat in mats:
        tree=mat.ShaderTree()
        n = tree.NodeByInternalName("PoserSurface")
        if n:
            i = n.InputByInternalName("Highlight_Value")
            if i:
                i.SetFloat(choose_val)
        tree.UpdatePreview()
scn.DrawAll()

 


basicwiz posted Thu, 01 March 2012 at 8:33 AM

Quote - # sets specular value in all materials to chosen value for current figure

choose_val = 0.6   #  value

import poser
scn = poser.Scene()
fig = scn.CurrentFigure()
mats = fig.Materials()
if mats:
    print fig.Name()   
    for mat in mats:
        tree=mat.ShaderTree()
        n = tree.NodeByInternalName("PoserSurface")
        if n:
            i = n.InputByInternalName("Highlight_Value")
            if i:
                i.SetFloat(choose_val)
        tree.UpdatePreview()
scn.DrawAll()

In Windows:

Create a new document by right clicking on the desktop, selecting "New", "Text Document".

Copy the above by highlighting it and pressing ctrl-C. Do not include the quotation mark at the top or the bottom.

Open the new document on your desktop by double clicking

Paste the code into the document using Ctrl-V

Close the document

Rename it to "Specular.py" Don't worry when Windows cries that you are changing the extention.

Copy this to your Poser Python folder, typically "C:/Program Files/Smith Micro/Poser Pro 2012/Runtime/Python/PoserScripts/ScriptsMenu

You can now access the script from the "Scripts" menu in Poser.

I know this sounds like a lot of steps, but it's very quick and will produce a working script from the posting text.


3doutlaw posted Thu, 01 March 2012 at 10:51 AM

Sounds good, I assume since it seems to set using the current scene, figure, materials, that I need to make sure that V4 is selected before doing this?  ...or does it give me a chooser?  Ah, heck, I'll just go try it.  Thanks!


3doutlaw posted Thu, 01 March 2012 at 11:10 AM

OK, so it worked!  Woohoo!

Now that I have a base, I can tweak it!  Where did you get that "highlight_value" is the specular_value?  The only doc I got is the Poser Python Methods manual, and it does not list either?


Medzinatar posted Thu, 01 March 2012 at 12:34 PM

When making this code, I looked inside a material file to find name Poser is using.
Rather than writing extra code, I just have script use internal name. 
Most of the internal name have same value as what you see in material room, but these have exception

   node "poser" "PoserSurface"
    {
    name "PoserSurface"
    pos 10 10
    showPreview 1
    nodeInput "Highlight_Color"
     {
     name "Specular_Color"
     value 1 1 1
     parmR NO_PARM
     parmG NO_PARM
     parmB NO_PARM
     node NO_NODE
     file NO_MAP
     }
    nodeInput "Highlight_Value"
     {
     name "Specular_Value"
     value 0 0 10
     parmR NO_PARM
     parmG NO_PARM
     parmB NO_PARM
     node NO_NODE
     file NO_MAP
     }