Xameva opened this issue on Jul 06, 2011 · 25 posts
Xameva posted Wed, 06 July 2011 at 11:17 AM
Hi!
I was wondering if it's possible to have a MAT pose that loads a texture on top of a figure via the pose library? So that I can load it over top of the character's actual skin texture.
For example I want to have claw marks that I can load onto M4, and have it overlay on top of his skin. I want it to work any any character, one-click solution.. no having to go in and alter anything in the material room.
Any info would really be helpful. :) A tutorial, a link to a product that does this so I can learn, etc.
Thanks!!
BionicRooster posted Wed, 06 July 2011 at 11:38 AM Forum Moderator
Attached Link: BB's VSS
Only way I could think of being able to accomplish that would be thru a Python script. That is, unless you made a new texture with the claw marks alreay applied, then you could just make a MAT for that, but it would only work for the fugures that have same uv mapping.A product that does the Python script is BagginsBill's VSS. It has a prop with 'most' of the shader, then the Python script adds that shader to your figure, plugging in whatever main textures you already have loaded.
Poser 10
Octane Render
Wings 3D
hborre posted Wed, 06 July 2011 at 12:31 PM
That would be the way to go, as BR posted. Unfortunately, you would need to work out the node arrangement to add the additional image map.
vilters posted Wed, 06 July 2011 at 12:56 PM
Well you could use a blender node and a mask to do that once.
Then save as a material???
Depends on your workflow.
Poser 1, 2, 3, 4, 5, 7,
P8 and PPro2010, P9 and PP2012, P10 and PP2014 Game
Dev
"Do not drive
faster then your angel can fly"!
markschum posted Wed, 06 July 2011 at 2:19 PM
A python script for that is readily available if you want it. It just unhooks the diffuse channel and adds a blender node and image map and mask.
BionicRooster posted Wed, 06 July 2011 at 2:21 PM Forum Moderator
Quote - A python script for that is readily available if you want it. It just unhooks the diffuse channel and adds a blender node and image map and mask.
Link? Cuz I think I'd even be interested in having that handy little script.
Poser 10
Octane Render
Wings 3D
Xameva posted Wed, 06 July 2011 at 2:46 PM
Oh, I didn't realize it'd take scripting, which I have no idea how to do, lol.
The thing is I'm doing this as a product to sell in the store, for others to apply, so unless I can distribute that script, I'll just forget it and include the photoshop layers along with a tutorial on how to apply it to your own textures and how to postwork it too. Much less convenient, but what can ya do.
BionicRooster posted Wed, 06 July 2011 at 3:01 PM Forum Moderator
You wouldn't ahve to do much more than edit the script and adjust it to your needs.
And, if you're able to contact whoever wrote the script, they may have no problem with you including it with your product, as it's just there to help out, and it's not the main thing you're selling.
BB is that way with his shaders, you can have them part of your pack, they just can't be the main thing your selling.
Poser 10
Octane Render
Wings 3D
markschum posted Wed, 06 July 2011 at 5:37 PM
I wrote the script, I just have to find it. :)
BionicRooster posted Wed, 06 July 2011 at 6:17 PM Forum Moderator
Oh, so would you allow Xameva to include a modifed version in the product? I'm positive it's the best way to go.
SnarlyGribbly wrote me a few scripts for my bicycle, and one is included. It brings up a color palette so the person can choose any color they want that's not included in the 90 MATs included. Extremely handy those little scripts can be.
...And btw... May I get it too when ya locate it? I would be most obliged :o)
Poser 10
Octane Render
Wings 3D
Xameva posted Wed, 06 July 2011 at 6:26 PM
I'm sure it could help a lot of content creators. For example someone is selling a sword prop, and as a bonus there's a MAT pose to load a flesh wound onto their character.
I'm assuming DAZ users would be out of luck though?
markschum posted Wed, 06 July 2011 at 6:54 PM
import poser, string
myimg = ":Runtime:Textures:myimgs:myimg.jpg"
mymask = ":Runtime:Textures:myimgs:mymask.jpg"
fig = poser.Scene().CurrentFigure()
mat = fig.Material("2_SkinTorso")
nod = mat.ShaderTree().NodeByInternalName("PoserSurface")
inp = nod.InputByInternalName("Diffuse_Color")
mynode = inp.InNode()
if mynode:
inp.Disconnect()
blndnode = mat.ShaderTree().CreateNode(poser.kNodeTypeCodeBLENDER)
blndnode.SetName("Overlay Blender")
blndnode.SetPreviewCollapsed(0)
blndnode.SetInputsCollapsed(1)
blndnode.SetLocation(231,80)
inpdif = blndnode.Input(0)
inpimg = blndnode.Input(1)
inpmask = blndnode.Input(2)
blndnode.Input(2).SetFloat(1)
imgnode = mat.ShaderTree().CreateNode(poser.kNodeTypeCodeIMAGEMAP)
imgnode.SetName("Overlay Image")
imgnode.SetPreviewCollapsed(0)
imgnode.SetInputsCollapsed(1)
imgnode.SetLocation(231,111)
#imgnode.Input(0).SetString(myimg) # remove comment to enable <<<<<<<<<<<<<
masknode = mat.ShaderTree().CreateNode(poser.kNodeTypeCodeIMAGEMAP)
masknode.SetName("Overlay Mask")
masknode.SetPreviewCollapsed(0)
masknode.SetInputsCollapsed(1)
masknode.SetLocation(231,141)
#masknode.Input(0).SetString(mymask) # remove comment to enable <<<<<<<<<<<<<
mynode.ConnectToInput(inpdif) # connect diffuse map original to blender
imgnode.ConnectToInput(inpimg) # connect overlay map to blender
masknode.ConnectToInput(inpmask) # connect mask to blender
blndnode.ConnectToInput(inp) # connect blender to diffuse
mat.ShaderTree().UpdatePreview()
poser.Scene().DrawAll()
it finds and detaches the node plugged into Diffuse color
creates a blender and two image nodes
myimg is the overlay image
mymask is the overlay mask
plugs the node from the diffuse color into blender
plugs the blender node into diffuse color
this may not be all thats needed but should be close
I may have to unplug and attach blender to specular as well ?
This is hardcoded to overlay onto 2_SkinTorso material , that is what I need to know or I can make it current selected material .
the script needs some changes , uncomment the two lines that set the image names , and edit the script to use the proper image names rather than my test names
rename it to a .py extension and put in the poser python folder. run from file menu.
markschum posted Wed, 06 July 2011 at 7:05 PM
Oh, yes , Daz Studio wont run a python script.
A daz version might be possible but not by me :)
And Yes , I could be convinced to allow distribution.
Xameva posted Wed, 06 July 2011 at 7:20 PM
I'm a complete novice with the scripting/material room, but I'll give it a try. That's awesome, thanks!!
Convinced eh? Should I send you a gift basket with chocolates? :) Or.. will written credit in the description and readme and the product for free be good? Or something else, let me know here or PM! :)
BionicRooster posted Wed, 06 July 2011 at 8:12 PM Forum Moderator
Thank you for the script!
Would it be hard to make this script for whatever material is seleted? That would make it more useful on other figures/props as well.
I'm a Poser user, so it's most useful to me :o)
Poser 10
Octane Render
Wings 3D
ima70 posted Wed, 06 July 2011 at 9:47 PM
You can do it with free Advanced shader by Semidieu
http://www.runtimedna.com/Advanced-Shaders.html
with it you can create a script that will load the overlay on every texture you want.
Xameva posted Wed, 06 July 2011 at 9:51 PM
That is absolutely awesome, thanks for the link ima70. Makes things much easier!!!
markschum posted Wed, 06 July 2011 at 10:13 PM
just change mat = fig.Material("2_SkinTorso")
to
mat = poser.Scene().CurrentMaterial()
lesbentley posted Thu, 07 July 2011 at 11:27 AM
Thanks markschum, the script is very handy. Is there also a way to set the scale and offset for the overlay images, and make them 'Clamped'?
lesbentley posted Thu, 07 July 2011 at 11:58 AM
What I'm trying to do is add a tattoo, and I would need the the nodes set up as in the above image. Can you tell me if it is possible to modify your script to do that please?
MistyLaraCarrara posted Thu, 07 July 2011 at 12:01 PM
for DS users you can use the LIE,
i'm not sure how it works, but I've seen wound and blood packs that use it.
oh, wait, i see one for poser, too.
http://www.daz3d.com/i.x/search/searchsub/?_m=d&sstring=wound+pack
♥ My Gallery Albums ♥ My YT ♥ Party in the CarrarArtists Forum ♪♪♪ 10 years of Carrara forum ♥ My FreeStuff
MistyLaraCarrara posted Thu, 07 July 2011 at 12:05 PM
Quote - You can do it with free Advanced shader by Semidieu
http://www.runtimedna.com/Advanced-Shaders.html
with it you can create a script that will load the overlay on every texture you want.
:b_drool:
♥ My Gallery Albums ♥ My YT ♥ Party in the CarrarArtists Forum ♪♪♪ 10 years of Carrara forum ♥ My FreeStuff
markschum posted Thu, 07 July 2011 at 5:25 PM
@les, yes of course. The crude way is to count inputs from the top
so in my script imgnode.Input(2).SetFloat(x) will set U_scale
ingnode.Input(7) is the clamped parameter and thats where you screw around to see what the settings are.
You can of course get the input by node.InputByInternalName("name") and thats better for documenting code but you have to recurse the node to get the internal names.
Look at Poser python methods manual ,Shader node and shader node input sections.
You probably want to duplicate this bit
np = nod.InputByInternalName("Diffuse_Color")
mynode = inp.InNode()
if mynode:
inp.Disconnect()
for specular
nps = nod.InputByInternalName("Specular_Color")
mynodes = inp.InNode()
if mynodes:
inp.Disconnect()
and then connect the blend node to specular. I will change those and repost the script later tonight
lesbentley posted Thu, 07 July 2011 at 6:26 PM
Quote - I will change those and repost the script later tonight
Thanks markschum, that would be a great help.
markschum posted Thu, 07 July 2011 at 7:02 PM
I have renamed the script to set_image_overlay.py
I have made the specular connect only if it was connected
the code to set the image nodes are commented out so remove the # to enable them
after setting the values and filenames
I added a comment line for setting the clamped or tiled setting , its not well documented and for reasons unknown they did not use 0 .
Thanks to Philc for pointing out in his book that the hide preview setting is wrong in the Poser methods manual.
I have commented some things to try to explain whats going on.