Isotropix Forums

Debug/evalution of select node when doing look dev

So you'd like something that's not there? Just tell us what, we'll see what we can do.

Debug/evalution of select node when doing look dev

Unread postby square01 » Mon Jun 19, 2017 6:46 pm

Hi!
One of the things that I'm recently fighting with clarisse, its to do look dev,
currently I spend a lot of time, using an overwrite shader to check my nodes isolate.
We should have a way to visualise the influence of a node just by soloing it

check this example
https://youtu.be/N5sy4vwoM40?t=5m45s
on the middle of this tutorial

and
in maya viewport
https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-5B870D6B-7D1D-4E84-A94B-9EEAAB1D97B6-htm.html


this or a swatch that could check every node....

Thank you

Johnny
square01
 
Posts: 42
Joined: Sat Jan 26, 2013 12:33 am

Re: Debug/evalution of select node when doing look dev

Unread postby daaims » Tue Jun 20, 2017 10:02 am

Hi,

I agree, i asked for it too.

Here is a little script to do a quick override. Select the texture you want to be displayed on your object and then your object to the selection. When you have finish checking your texture just delete the matte shader.

Code: Select all
# Override Object with matte and selected texure. Select texture first then the object.

sel = ix.selection
tex = sel[0]
obj = sel[1]

matte = ix.cmds.CreateObject("Mtl_Override", "MaterialMatte")
ix.cmds.SetTexture([str(matte) + ".color"], str(tex))
obj.attrs.override_material = matte


Cheers ;)
User avatar
daaims
 
Posts: 431
Joined: Fri Mar 22, 2013 1:17 am

Re: Debug/evalution of select node when doing look dev

Unread postby bvaldes » Tue Jun 20, 2017 10:17 am

Hi,

I did a script several months ago to do that. Take a look of it and feel free to improve it:

python code

def add_to_SL(items):
for i in range(len(items)):
item = items[i]
ix.cmds.AddShadingLayerRule(str(SL), i, [
"filter", str(item),
"is_visible", "1",
"material", matte.get_full_name(),
"clip_map", "",
"displacement", "",
"shading_variables", ""
])

def get_all_3d_views():
_3d_widgets = []
objs = ix.api.OfObjectArray()
ix.application.get_factory().get_all_objects("Widget3dView", objs)
for i in range(objs.get_count()):
_3d_widgets.append(objs[i])
return _3d_widgets

def restore(node):
_3d_view_content = node.get_attribute("_3D_views").get_string().split("\n")
for line in _3d_view_content:
if line:
line = line.split(" ")
view = line[0]
content = line[1]
if content != "None":
ix.cmds.SetValues([line+".shading_layer"],[content])

def write_info(attribute, informations):
ix.cmds.SetValues([attribute.get_full_name()], [informations+"\n"])

def make_setup():
if not ix.item_exists("project://__ShowNodeScript"):
ctx = ix.cmds.CreateContext("__ShowNodeScript", "project:/")
else:
ctx = ix.get_item("project://__ShowNodeScript")
if not ix.item_exists("project://__ShowNodeScript/info"):
info = ix.cmds.CreateObject("info", "ProjectItem", ctx.get_full_name())
ix.cmds.CreateCustomAttribute(
[info.get_full_name()], "_3D_views", 3,
["container", "vhint", "group", "count"],
["CONTAINER_SINGLE", "VISUAL_HINT_SCRIPT", "general", "1"]
)
else:
info = ix.get_item("project://__ShowNodeScript/info")
if not ix.item_exists("project://__ShowNodeScript/shading_layer"):
SL = ix.cmds.CreateObject("shading_layer", "ShadingLayer", "Global", ctx.get_full_name())
else:
ix.cmds.DeleteItems(["project://__ShowNodeScript/shading_layer"])
restore(info)
SL = ix.cmds.CreateObject("shading_layer", "ShadingLayer", "Global", ctx.get_full_name())
if not ix.item_exists("project://__ShowNodeScript/matte"):
matte = ix.cmds.CreateObject("matte", "MaterialMatte", "Global", ctx.get_full_name())
else:
matte = ix.get_item("project://__ShowNodeScript/matte")
return ctx, matte, SL, info

def main():
if "Texture" in item.get_class_name():
ix.selection.select(item.get_full_name())
ix.application.select_next_outputs(True)
geometries = []
for i in range(ix.selection.get_count()):
if "Geometry" in ix.selection[i].get_class_name():
geometries.append(ix.selection[i].get_full_name())
if geometries:
ix.cmds.SetTexture([matte.get_attribute("color").get_full_name()], item.get_full_name())
add_to_SL(geometries)
_3d_views = get_all_3d_views()
for _3d_view in _3d_views:
infos = _3d_view.get_full_name() + " " + str(_3d_view.get_attribute("shading_layer").get_object(0))
write_info(info.get_attribute("_3D_views"), infos)
ix.cmds.SetValues([_3d_view.get_attribute("shading_layer").get_full_name()], [SL.get_full_name()])
else:
ix.log_warning("The selected not is not linked to a geometry")
ix.set_current_context(str(item.get_context()))
ix.selection.select(str(item))
else:
ix.log_warning("The selected item in not a texture node")

if ix.item_exists("project://__ShowNodeScript"):
if ix.selection.get_count() > 0 and ix.selection[0].get_full_name() != ix.get_item("project://__ShowNodeScript/matte.color").get_texture():
override_info = False
item = ix.selection[0]
print "Pas meme node donc je relance le truc"
ctx, matte, SL, info = make_setup()
main()
else:
print "restore like previously"
info = ix.get_item("project://__ShowNodeScript/info")
if info:
restore(info)
ix.cmds.DeleteItems(["project://__ShowNodeScript"])
else:
print "make setup for the first time"
if ix.selection.get_count() > 0:
item = ix.selection[0]
ctx, matte, SL, info = make_setup()
override_info = True
main()
else:
ix.log_warning("Nothing is selected. Please selection a texture node")

Cheers
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 141
Joined: Mon Sep 26, 2016 11:44 am

Re: Debug/evalution of select node when doing look dev

Unread postby square01 » Tue Jun 20, 2017 12:11 pm

Thank you both,
daaims thats pretty simple and cool, its works :) Thank you

Thank you Benoit also,
can you explain out to use your script?

Clarisse re-evaluates everything because lighting will change , we should really have a debug mode for this kind of things

Thank you
square01
 
Posts: 42
Joined: Sat Jan 26, 2013 12:33 am

Re: Debug/evalution of select node when doing look dev

Unread postby bvaldes » Tue Jun 20, 2017 4:40 pm

Hi,

The script isolates the node you use by setting it inside of a matte material. To see it inside of the 3D view the script creates a shading layer and set it in the 3dview.

What you have to do is quite simple: select the node which interest you then execute the script.
To delete the setup delete the folder called _ShowNode.

You can try with a simple setup:
Code: Select all
#Isotropix_Clarisse_Clipboard_Serialization 0.94
Context "scene" {
    copy_from "project://scene"
    CameraPerspective {
        name "camera"
        #version 0.9
        copy_from "project://scene/camera"
        translate 28 21 28
        rotate -27.938 45 0.0
        aim_distance 44.8218696620299
        field_of_view 25
    }
    LightPhysicalDistant {
        name "light"
        #version 0.91
        copy_from "project://scene/light"
        rotate -35 125 0.0
    }
    RendererRaytracer {
        name "path_tracer"
        #version 0.97
        copy_from "project://scene/path_tracer"
        anti_aliasing_sampling_mode 3
        integration_model "IntegratorPathtracer"
        integrator ".IntegratorPathtracer_embedded"
        embedded_objects {
            IntegratorPathtracer {
                name "IntegratorPathtracer_embedded"
                #version 0.92
                copy_from "project://scene/path_tracer.IntegratorPathtracer_embedded"
                private yes
                embedded_objects {
                    MaterialPhysicalStandard {
                        name "surface_default"
                        #version 0.0
                        copy_from "project://scene/path_tracer.IntegratorPathtracer_embedded.surface_default"
                        private yes
                    }
                    MaterialPhysicalVolume {
                        name "volume_default"
                        #version 0.9
                        copy_from "project://scene/path_tracer.IntegratorPathtracer_embedded.volume_default"
                        private yes
                        density_multiplier 100
                    }
                    MaterialPhysicalHair {
                        name "curve_default"
                        #version 0.9
                        copy_from "project://scene/path_tracer.IntegratorPathtracer_embedded.curve_default"
                        private yes
                    }
                }
            }
        }
    }
    Image {
        name "image"
        #version 0.93
        copy_from "project://scene/image"
        active_layer 0
        layers ".background"
        first_frame 0
        last_frame 50
        embedded_objects {
            Layer3d {
                name "background"
                #version 0.97
                copy_from "project://scene/image.background"
                first_frame 0
                last_frame 50
                deep_output_data_precision 0
                max_sample_count 0
                active_camera "project://scene/camera"
                renderer "project://scene/path_tracer"
                user_data {
                    __geometries__ {
                    }
                    __lights__ {
                    }
                }
            }
        }
    }
    GeometryBox {
        name "box"
        #version 0.9
        copy_from "project://scene/box"
        uv_maps "horizontal unfold" "vertical unfold"
        uv_maps_loaded yes
        shading_groups "surface"
        materials "project://scene/layered"
        clip_maps ""
        displacements ""
        sg_shading_variables ""
        visibles yes
    }
    MaterialPhysicalLayered {
        name "layered"
        #version 0.9
        copy_from "project://scene/layered"
        positions "mat_1" 1318 179
        base "project://scene/diffuse"
    }
    MaterialPhysicalDiffuse {
        name "diffuse"
        #version 0.91
        copy_from "project://scene/diffuse"
        positions "mat_1" 1035 212
        front_color {
            value 0.78 0.78 0.78
            texture "project://scene/fractal_noise"
        }
    }
    TextureConstantColor {
        name "constant_color"
        #version 0.91
        copy_from "project://scene/constant_color"
        positions "mat_1" 360 271
        color 1 0.0 0.0 1
    }
    TextureFractalNoise {
        name "fractal_noise"
        #version 0.91
        copy_from "project://scene/fractal_noise"
        positions "mat_1" 727 212
        projection 6
        color1 {
            value 0.78 0.78 0.78
            texture "project://scene/constant_color"
        }
    }
}



Select the node you want and execute the script
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 141
Joined: Mon Sep 26, 2016 11:44 am

Re: Debug/evalution of select node when doing look dev

Unread postby bjoern » Thu Aug 17, 2017 12:21 pm

I just stubbed across the same problem. The script is nice. But I think while being in the material editor a shortcut like "I" should toggle this function (as a fully integrated feature). This is a very essential tool for day to day lookdev.
bjoern
 
Posts: 118
Joined: Thu May 11, 2017 1:43 pm


Return to Feature Requests
cron