Ready! - mcjSkinLikeThis - Script to obtain skin that looks like the skin in a reference photo

mCasualmCasual Posts: 4,604
edited March 2015 in Freebies

Tis Ready ! ! !

https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis

and if you have triuble downloading it from my google site

here's a direct link to the zip file

https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis/mcjSkinLikeThis.zip?attredirects=0&d=1

you specify a reference skin image
you select the figure's torso material
you bring your view-camera until the torso skin fills the view

the script will make up to 40 ( but often less ) tiny ( 256x256 ) software or hardware renders
until your rendered material looks like the one in the reference photo

what it does actually is to
- find pixels with the median lightness in the reference image
- notes the average color of those pixels,
- then finds a median-lightness pixel in your rendered image
- notes its location.
- tweaks of your surface diffuse strength
- renders
- it does up to 10 tweak/render cycles until the rendered pixel lightness is the same as the reference image pixels
- for the red, green and blue components of the diffuse color, it does up to 10 tweak/render cycles until the color is just right

initial.jpg
1920 x 1080 - 679K
Post edited by mCasual on
«1

Comments

  • mCasualmCasual Posts: 4,604
    edited December 1969

    using Kim Kardashian's famous photo from Paper magazine

    kimK2.jpg
    900 x 900 - 210K
  • cedarwolfcedarwolf Posts: 64
    edited December 1969

    This looks really useful. Will it be able to work with a photograph for actual skin tones? If so, can you then save them some how for future use?

  • mCasualmCasual Posts: 4,604
    edited December 1969

    very tan skin came out a bit too dark i think

    tanskinout.jpg
    1920 x 1920 - 1M
  • mCasualmCasual Posts: 4,604
    edited March 2015

    cedarwolf said:
    This looks really useful. Will it be able to work with a photograph for actual skin tones? If so, can you then save them some how for future use?

    the target hue and lightness is taken from any jpg image

    you supply any jpg image
    ideally an image showing only skin
    the script goes through ( many ) all the pixels in the jpg image/photo
    and computes the average lightness

    then for all the pixels in the image with that lighness, it computes the average hue

    then through a series of renders and tweaks it attempts to make the skin of the rendered figure
    have the same average lighness, then through a series of renders and tweaks it attempts to make
    the skin of the rendered figure have the same hue

    Daz Studio has 2 ways to save material settings, the old material presets and the newer .duf format
    this is found in the File menu

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    skin tones from a Ball-joint-doll

    ( googled this http://bjd-shop.com/blog/wp-content/uploads/2015/01/tan-skin-ipleshouse-carina-bjd-1.jpg )

    still looks too dark

    i think i'll display the reference image color palette on-screen
    and let you pick from it

    bjd.jpg
    1920 x 1920 - 1M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited December 1969

    there ya go

    balljointdoll.jpg
    1920 x 1080 - 728K
  • cedarwolfcedarwolf Posts: 64
    edited December 1969

    Excellent. I like the option of using either one, but I don't write code (got lost at HTML3) so I have no idea how difficult this is on your end. You've got a great concept here, and it's exciting to watch as you work through it.

    One of the applications I can see immediately is that modellers never seem to get skin tones for Native Americans quite right. Living in the capital of the Cherokee Nation, I can get skin sample pictures pretty easy with a couple of phone calls. There are good physical models that need minimum tweaking, but the skin tones are off. I'm hoping your program can help in that.

    This is going quite well, and it's exciting to watch. Keep up the great work.

    Tony O'seland
    aka
    Cedarwolf

  • kaotkblisskaotkbliss Posts: 2,914
    edited December 1969

    This is really looking pretty interesting :)

  • mCasualmCasual Posts: 4,604
    edited March 2015

    today's test software render will be this image ( fig.1) and ...

    searching for an outdoorsy skin reference

    ---

    Fig 2 - the Lynda figure map

    Fig 3 - when it starts, the script sets the
    diffuse color 192 192 192
    ambient color 128 128 128

    here the ambient strength is at 20%

    the first thing the script will do is adjust the ambient strength so that
    the average brightness of the reference and rendered image match

    Fig4 the rendered area - i also changed the glossiness to have more bright spots

    Fig 5 the Hardware Render ( OpenGL results )
    the matching process was forced to use too much "ambient",
    i'll have both the diffuse and the ambient color contribute to the match



    technical note - in a perfect world the script would adjust the lighting and the surface specular
    wowo5.jpg
    856 x 618 - 258K
    initialwowo3.jpg
    618 x 618 - 70K
    initialwowo2.jpg
    618 x 618 - 200K
    Lynda.jpg
    350 x 350 - 65K
    initialwowo.jpg
    1280 x 800 - 474K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    Still a Hardware-Render skin matching experiment

    This time i rely more on the diffuse color strength and less on the ambient strength

    we probably keep more shadows ( and contrast ) this way

    Next i'll see if i can also match the gold accessories!

    ------

    i'll work on it some more today , still on the Hardware-Render version of it

    tomorrow i want to get back to the midi project

    and next week get back to the kinect-face-mocap project

    then the kinect body mocap project

    then i guess the mcjBuilder and the free Gothic music video decor that comes with it and the mcjCastle stairs

    then i think it's the physics engine

    then the wrapper project, the cage-deformer project

    etc etc etc

    typical.jpg
    1212 x 542 - 134K
    initialwowo4g.jpg
    420 x 618 - 155K
    initialwowo4e.jpg
    420 x 618 - 115K
    initialwowo4c.jpg
    800 x 800 - 278K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    first skin-matching test using the software renderer

    not very good result

    technically speaking the result is correct

    i.e. the rendered middle skin tone is the same as the reference image

    but .... well i have to push the script to make different decisions

    maybe the strong glossiness is the problem, it tricks the script into thinking the skin is lighter

    -------
    Fig 2 - the trial-error method uses a Lo-Hi method to minimize the number of renders needed ( always less than 10 i think )
    the renders are kept at 256x256 pixels. Note that the script launches the renders you don't have to touch anything.
    and indeed when i removed the specular component of the skin, i get better results which we will discover together in fig. 3

    hi-lo.jpg
    783 x 321 - 69K
    temporaryforskinlikethis.jpg
    800 x 800 - 273K
    Post edited by mCasual on
  • cedarwolfcedarwolf Posts: 64
    edited December 1969

    Skin is a bit oily/plastic looking, but the skin tone is much better. The gold looks good.

  • mCasualmCasual Posts: 4,604
    edited December 1969

    cedarwolf said:
    Skin is a bit oily/plastic looking, but the skin tone is much better. The gold looks good.

    when i turn the specularity / glossiness / wetness off
    before the skin-tone-matching process
    i get acceptable results

    i guess the release will be Sunday

    temporaryforskinlikethi2.jpg
    900 x 900 - 304K
  • mCasualmCasual Posts: 4,604
    edited March 2015

    the skin-matched render above used the ball-joint-doll skin image

    this one below uses the tan-skin image

    and the Lynda skin tone

    Lynda.jpg
    76 x 104 - 5K
    lyndasoft.jpg
    900 x 900 - 320K
    balljointdoll.jpg
    242 x 270 - 14K
    tanskin.jpg
    288 x 321 - 45K
    tan.jpg
    1000 x 1000 - 366K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    and the last software-render skin-tone match, the Kim Kardashian skin tone

    fig 2 - all of them together, hardware and software

    allovemso.jpg
    1920 x 1080 - 1M
    censo.jpg
    112 x 73 - 4K
    limksoft.jpg
    800 x 800 - 250K
    Post edited by mCasual on
  • cedarwolfcedarwolf Posts: 64
    edited December 1969

    This is excellent. Turning off those options seems to be just the right step. Tones look good, btw. Well done. Let me know when you are ready for "destructive testing."

  • mCasualmCasual Posts: 4,604
    edited December 1969

    cedarwolf said:
    This is excellent. Turning off those options seems to be just the right step. Tones look good, btw. Well done. Let me know when you are ready for "destructive testing."

    it should be ready this evening

    the only issue left is to find why sometimes it makes too many trial/error passes before being satisfied with the color match

    shown below, it was used to obtain exact rendered clothes colors

    colors.jpg
    1280 x 720 - 105K
  • mCasualmCasual Posts: 4,604
    edited March 2015

    using it to get perfect ( software rendered ! ) target colors for clothes

    mocappppp.jpg
    1067 x 600 - 47K
    rezu.jpg
    1534 x 546 - 149K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited December 1969

    posting the script in the next 30 minutes !

    mcjSkinLikeThis.dsa_.png
    91 x 91 - 7K
  • mCasualmCasual Posts: 4,604
    edited March 2015

    Tis Ready ! ! !

    https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis

    and if you have triuble downloading it from my google site

    here's a direct link to the zip file

    https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis/mcjSkinLikeThis.zip?attredirects=0&d=1

    daymo.jpg
    810 x 504 - 129K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited December 1969

    i added the version for DS1 DS2

    ( and i realised DS2.3-the-meanie had attempted to destroy my DS1.8 recently but i was able to revive it )


    https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis

  • MilosGulanMilosGulan Posts: 1,953
    edited December 1969

    Thank You, this looks like a very nice thing. Will have to try it :)

  • mCasualmCasual Posts: 4,604
    edited March 2015

    Attention, attention, there will be an update

    i did all my development tests on surfaces using the Daz Default Material ( shaders )

    but, Genesis figures, for example, use non-default shaders

    and this probably prevents the script from working

    ---

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    Our colleagues, Azura ( Genesis2 ) and the Kinect stickman will be assisting us

    for the script repair

    note that you can see this Kinect mocap scene in this Youtube video:

    https://www.youtube.com/watch?v=UIJellHPrmQ

    -----
    oops it's Genesis ( 1 ? ) and the default shader

    first test result i get warnings like "QColor::setHsv: HSV parameters out of range"
    but it worked anyway , see fif 2 - using the LyndaCarter skin tone, software mode matching
    ------
    Fig 3 - a hardware render match - i discovered little bugs not related to shaders, so you will want version 2
    note that the images are filenamed posessed as in "posessed by the kinect"
    ---
    Fig 4 - matched the boots color to the dress

    fig 5 - skin matching - software renders ( tip - make everything else in the screen invisible to speed up the renders

    posessed6.jpg
    1920 x 1080 - 747K
    posessed5.jpg
    888 x 888 - 405K
    posessed4.jpg
    960 x 960 - 444K
    posessed2.jpg
    960 x 540 - 257K
    posessed.jpg
    1920 x 1080 - 789K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited March 2015

    well i had to spend some time on the test scene didnt i? of course!

    ---
    version 2 will be released in the next half hour !

    now should work fine with all shaders

    though you'll have to manually activate the ambient effect for some shaders like HumanSurface

    posessed7.jpg
    1920 x 1080 - 1M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited December 1969

    - Update - - Update - - Update - New Version compatible with shaders - Update - - Update - - Update - - Update -

    March 16th 2015 5 pm - new version compatible with non-DzDefaultMaterials ( shaders )

    in case you don't know, when you create a cube for example, the material applied to its surface is a Daz Default Shader

    and Figures like Genesis often have non-default shaders applied to their surfaces

    the first version of mcjSkinLikeThis was only able to do business with old-school DazDefaultMaterials

    https://sites.google.com/site/mcasualsdazscripts5/mcjskinlikethis

    posessed8.jpg
    1920 x 1080 - 1M
  • mCasualmCasual Posts: 4,604
    edited March 2015

    getting this skin-tone took a few trials and errors
    but it was worth the effort

    one important tip is that the specularity ( shiny reflections must be turned off before the skin-tone matching tests

    also, the lighting and/or the ambient strength/color must sometimes be turned up for the script to reach the objectives,
    so in your view-camera try to get a range of lighting that is similar to the reference skin tone image
    ----

    and i got to use the free marble textures from DigiDotz
    http://www.daz3d.com/forums/discussion/54019/#783841
    mixed with Marianne's Supershine shader
    http://www.sharecg.com/v/31573/Material-and-Shader/Super-Shine-Shader

    the round-cornered blocks are the free very morphable mcjRoundBox props
    https://sites.google.com/site/mcasualsdazscripts2/mcjhole-mcjbox-props

    the Doric columns are props too and include a stretch morph
    https://sites.google.com/site/mcasualsdazscripts5/mcjdoric

    the swimsuit for Aiko3 is the mcjA3Maillot
    https://sites.google.com/site/mcasualsdazscripts2/mcja3

    plus the cutout map
    https://sites.google.com/site/mcasualsdazscripts4/maillottoswim

    plus the normal map
    https://sites.google.com/site/mcasualsdazscripts4/mcjneoprene

    plus Marianne's supershine shader
    http://www.sharecg.com/v/31573/Material-and-Shader/Super-Shine-Shader

    marble.jpg
    1920 x 1080 - 1M
    Post edited by mCasual on
  • MilosGulanMilosGulan Posts: 1,953
    edited December 1969

    I am planning to try it soon, I have worked with Shape Magic today, had a nice progress. Next is Replictaor script then I will try this. I hope I can learn to use it :)

  • amy_aimeiamy_aimei Posts: 139
    edited December 1969

    I tried it to match my skintone. It works very well. See the result with Genesis 2 default textures.
    Thank you!

    untitiled-5-DS.png
    1024 x 768 - 127K
  • mCasualmCasual Posts: 4,604
    edited December 1969

    amy_aimei said:
    I tried it to match my skintone. It works very well. See the result with Genesis 2 default textures.
    Thank you!

    welcome! glad it worked for someone other than me :)

Sign In or Register to comment.