A script for visual style shaders

UkyuuUkyuu Posts: 182

Since I am applying that shader to the entire sci-fi set, I would love to save myself some time by doing a script that apply it to every damn object in my scene.

For that I guessed it would need to make a script.

/* Update */

Since it seems a huge work I'm getting on, I guess I have to chop it down in bits. I would like to understand how to store the current's objects maps & colors for the diffuse. I'll try to do go one step at a time !

/* old post */
Franckly, it will be my first script ever, so I hope I will be able to do it.

I need to store the following variable :

the file used for the diffuse, and the color of the diffuse;
the file used for the specular, and the color of the specular,
the spec's strenght and gloss,
the bump map, strenght, min and max,

then I would need to apply the visual shader,

and after, to restitute those variables where applicable in the viusal style shader.

I hope you can help me to know where to start to do that !

What I am looking for are clues, web pages, whatever can indicate me how to start this.

For example, telling me how to store the variable (just one example) so I can begin from there would be greatly appreciated.

Uky.

Post edited by Ukyuu on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,886
    edited December 1969

    I'd start by saving a deprecated .dsa shader preset and looking to see how that works, alongside the DAZ Studio 3 scripting docs available here http://docs.daz3d.com/doku.php/public/software/dazstudio/3/start

  • UkyuuUkyuu Posts: 182
    edited December 1969

    Okay, so I am digging through it.

    I get that after I have found how to store the current variables, I will have to loop through each object and do something like :

    g_oPresetHelper.setTargetElement( this.m_oElement );
     g_oPresetHelper.setNumericProperty( "Smooth On",  [ 1 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Smooth Angle", true, 0, 180, [ 89.9 ] );
     g_oPresetHelper.setNumericProperty( "Accept Shadows",  [ 1 ] );
     g_oPresetHelper.setNumericProperty( "Multiply Specular Through Opacity",  [ 1 ] );
     g_oPresetHelper.setNumericProperty( "min2",  [ 0.3 ] );
     g_oPresetHelper.setNumericProperty( "max2",  [ 0.4 ] );
     g_oPresetHelper.setNumericProperty( "min3",  [ 0.25 ] );
     g_oPresetHelper.setNumericProperty( "max3",  [ 0.75 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "strength2", true, 0, 1, [ 1 ] );
     g_oPresetHelper.setNumericProperty( "maxdist",  [ 1000 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "coneangle", true, 0, 180, [ 65 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "samples", true, 1, 512, [ 20 ] );
     g_oPresetHelper.setNumericProperty( "bias",  [ -1 ] );
     g_oPresetHelper.setColorProperty( "color52",  [ 192, 192, 192 ] );
     g_oPresetHelper.setColorProperty( "color6",  [ 255, 255, 255 ] );
     g_oPresetHelper.setColorProperty( "color4",  [ 128, 128, 128 ] );
     g_oPresetHelper.setColorProperty( "color5",  [ 128, 128, 128 ] );
     g_oPresetHelper.setColorProperty( "color2",  [ 192, 192, 192 ] );
     g_oPresetHelper.setColorProperty( "Diffuse Color",  [ 255, 255, 255 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Opacity Strength", true, 0, 1, [ 1 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Displacement Strength2", true, 0, 1, [ 0 ] );
     g_oPresetHelper.setNumericProperty( "Minimum Displacement2",  [ -0.1 ] );
     g_oPresetHelper.setNumericProperty( "Maximum Displacement2",  [ 0.1 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Displacement Strength", true, 0, 1, [ 0 ] );
     g_oPresetHelper.setNumericProperty( "min",  [ -0.1 ] );
     g_oPresetHelper.setNumericProperty( "max",  [ 0.1 ] );
     g_oPresetHelper.setColorProperty( "color7",  [ 255, 255, 255 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Glossiness", true, 0, 1, [ 0.25 ] );
     g_oPresetHelper.setNumericPropertyWithAttributes( "Specular Strength", true, 0, 1, [ 0.3 ] );
     g_oPresetHelper.setNumericProperty( "Specular Sharpness",  [ 0 ] );
     g_oPresetHelper.setNumericProperty( "Multiply Specular Through Opacity3",  [ 1 ] );
     g_oPresetHelper.setColorProperty( "Specular Color",  [ 192, 192, 192 ] );
     g_oPresetHelper.setColorProperty( "color",  [ 255, 255, 255 ] );
    }

    Where I will pass on every variable I have stored at the begining.

    I am unsure of how to store the current objects in my scene, so that I can reattribute the correct maps afterward.

Sign In or Register to comment.