Daz Uber Iray Instance Tiling - How to Change?

I am trying to make a script that will change the instance tiling (in the Image Editor) for a bump map image in an Iray shader. In my duf file the only things I see referring to it's tiling are these 2 lines:

                "url" : "name://@selection#materials:?extra/studio_material_channels/channels/Bump%20Strength/image_modification/horizontal_tiles",
                "keys" : [ [ 0, 5 ] ]

                "url" : "name://@selection#materials:?extra/studio_material_channels/channels/Bump%20Strength/image_modification/vertical_tiles",
                "keys" : [ [ 0, 5 ] ]

I have looked a long time for a way to do this but I just don't understand Daz Script well enough. I can get to the Bump Strength value but that's as far as I could get.

Any help is really appreicaited.

 

Comments

  • Can the instance tiling be changed in a script? I still can't figure out how to do this. I'm not sure if it's possible. 

  • zaz777zaz777 Posts: 115

    You can actually change the tiling via script, using undocumented methods.  I used a modified version of Rob's "self-discovery" script which you can find in this thread.  You can use the Script IDE in DS to find undocumented methods or variables.

    First, you need to call "getTextureModifier()" on at least a DzColorProperty or a DzFloatColorProperty (it maybe available on other properties also).  I think that's an undocumented method and the DzTextureModifier, which it returns, was undocumented last I checked.

    DzTextureModifier exposes getters/setters and/or variables for all the things you can modify in the Image Edit dialog.

    I wrote a script to allow one to edit various texture parameters on multiple texture slots, across multiple surfaces with one window.  It mostly seemed to work, but I haven't really used it or looked at the script in over a year.  There were a few gotchas with it, but I don't recall what they were and whatever idiosyncracies I was seeing a year ago may be gone or worse today, smiley.

  • EsemwyEsemwy Posts: 490

    This may have bugs since I can't test it right now (in the middle of a render), but if you're still having difficulties it should send you in the right direction. 

    (function() {
        var oNode = Scene.getPrimarySelection();
        if (!oNode) return;
        var oObj = oNode.getObject();
        if (!oObj) return
        var oShape = oObj.getCurrentShape();
        if (!oShape) return;
        var oMaterial = oShape.getMaterial(0);
    
        var nMat = oMaterial.getNumMaterials();
        for (var i = 0; i < nMat; i++) {
            var oMat = oMaterial.getMaterial(i);
            if (!oMat) continue;
            if (!oMat.isSelected()) continue;
            var oProp = oMat.findProperty("Diffuse Color");
            if (!oProp.isMapped()) continue;
            var oTexMod = oProp.getTextureModifier();
            if (!oTexMod) {
                oTexMod = DzTextureModifier();
                oTexMod.reset();
                oProp.setTextureModifier(oTexMod);
            }
            oTexMod.verticalTiles = 3.0;
            oTexMod.horizontalTiles = 3.0;
        }
    })();

     

  • Esemwy said:

    This may have bugs since I can't test it right now (in the middle of a render), but if you're still having difficulties it should send you in the right direction. 

    (function() {
        var oNode = Scene.getPrimarySelection();
        if (!oNode) return;
        var oObj = oNode.getObject();
        if (!oObj) return
        var oShape = oObj.getCurrentShape();
        if (!oShape) return;
        var oMaterial = oShape.getMaterial(0);
    
        var nMat = oMaterial.getNumMaterials();
        for (var i = 0; i < nMat; i++) {
            var oMat = oMaterial.getMaterial(i);
            if (!oMat) continue;
            if (!oMat.isSelected()) continue;
            var oProp = oMat.findProperty("Diffuse Color");
            if (!oProp.isMapped()) continue;
            var oTexMod = oProp.getTextureModifier();
            if (!oTexMod) {
                oTexMod = DzTextureModifier();
                oTexMod.reset();
                oProp.setTextureModifier(oTexMod);
            }
            oTexMod.verticalTiles = 3.0;
            oTexMod.horizontalTiles = 3.0;
        }
    })();

     

    What about Gamma? Can I change Gamma with this way?

     

    Thnx in advance

  • GKDantasGKDantas Posts: 197

    Amazing, I need the same thing here... need to try it

Sign In or Register to comment.