Jump to content

giving individual looks to crowd objects using style sheets


Recommended Posts

I'm trying to render different materials for crowd objects using the style sheets, however it's not working as expected.

 

 

Here's some simple code that works:

 

 

{
    "styles" : [              
                    {   "target" : { "group" : "100-200" },
                         "overrides" : { "material" : { "name" : "`opfullpath("../shopnet1/constant1")`" }
            }
        }
    ]
}

 

This basically assigns the "constant" material shader to all the points/primitives 100-200.

 

However replacing the constant material with the mocap biped material results in no material at all, ie replace "../shopnet1/constant1" with "../mocapbiped21/MATERIALS/clothing".  Using this material as the assigned geometry material works fine, but it doesn't seem to be recognised by the style sheet... Does anyone know what I'm doing wrong?

 

Link to comment
Share on other sites

Hmm..I did not even know that was possible. Where do you place the code, assuming it works? Is there a field in the material node? Where is the style sheet located? Is that a window on it's own, like Geometry Spreadsheet?

Link to comment
Share on other sites

Yeah check out the explanation and link to stylesheets here:

 

http://www.sidefx.com/docs/houdini14.0/crowds/diversity

 

The code snippet goes under the material tab, although I couldn't actually figure out how to add it to the geometry node as it's not normally there. So I copied across the geometry node from one of the example files which had it...

post-12939-0-72067600-1434921478_thumb.j

post-12939-0-09036900-1434921486_thumb.j

Edited by kayman
Link to comment
Share on other sites

I couldn't actually figure out how to add it to the geometry node as it's not normally there. 

 

Same as adding any other spare parameters, but you gotta know where to look. :)

 

  1. Right click on the geo, 'edit parameter interface...'
  2. Go to the Render Properties tab
  3. Use the filter at the bottom to search for some keywords. In this case, type 'stylesheet', hit enter
  4. The treeview gets reduced to a single folder. Expand it out, there's a subfolder 'shader', expand it, you'll find 'material_stylesheet'
  5. Select it, click the arrow in the middle of the UI to copy it from the left (available parameters) to the right (parameters on your geo)
  6. Apply/Accept
  7. Now you've got a new tab, 'shaders', and under it is the stylesheet text field.

This is the same for most esoteric and cunning parameters used to control mantra. Have a guess as to words that'll appear in the name, filter, see what you get back.

  • Like 1
Link to comment
Share on other sites

And it turns out I must have made a syntax error because it's working now.

 

In case anyone is interested this is how I assigned a bunch of different textures to the crowd characters:

 

{
"styles" : [

{ "target" : { "group" : "1-100" },
"overrides" : { "material" : { "name" : "`opfullpath("../cheer/MATERIALS/clothing")`" } }
},

{ "target" : { "group" : "101-200" },
"overrides" : { "material" : { "name" : "`opfullpath("../interact/MATERIALS/clothing")`" } }
},

{ "target" : { "group" : "201-300" },
"overrides" : { "material" : { "name" : "`opfullpath("../talking/MATERIALS/clothing")`" } }
},

{ "target" : { "group" : "301-400" },
"overrides" : { "material" : { "name" : "`opfullpath("../look/MATERIALS/clothing")`" } }
},

] }

 

 

where the first name in the opfullpath is the biped character name. I couldn't quickly get the target by attributes to work, seems they need to be primitive attributes rather than the point attributes the crowd characters have normally.

Link to comment
Share on other sites

I am trying to get this to work as well and I still do not have a working solution.

 

I am using the default formation preset that ships with Houdini.

I have a shopnet1 which contains 4 different colored constant shaders.

I have placed the stylesheet inside the crowdsource node but when I render there seems to be no change.

 

Does anyone have a stylesheet that works with the example crowd simulations?

post-12295-0-40830900-1435586022_thumb.j

 

After further digging and reviewing the example files in the help documentation I have come up with a style sheet that does cause a visible effect when rendered.

post-12295-0-18144900-1435589464_thumb.j

 

{
    "styles" :
    [ 
        {
            "target" : "*",
            "overrides" : {
                "material" : {
                    "name" : "`opfullpath("../shopnet1/constant")`"
                },
                "materialParameters" : {
                    "clr" : {
                        "script" : {
                            "code" : "cvex mFn( int seed = 0; export vector out_color = {0,0,0} ) { out_color = rand(seed); }",
                            "bindings": { "seed" : "intrinsic:indexorder" }
                        }
                    }
                }
            }
        }
    ]
}
Edited by Atom
Link to comment
Share on other sites

I can not get groups to target correctly.

Of I use "*" I can target all agents in the crowd.

 

How do I discover what groups exist in a crowd system so I can target them in a stylesheet?

 

EDIT

.

.

.

Ok, I made some progress. It seems the stylesheet has a very touchy syntax. It does not produce errors when a trailing comma is left in place (i.e. no syntax error) however, if the comma is left in place and no further target is specified, the last target is ignored by Mantra. Ugh..

 

This will shade agents using two target groups:

{
    "styles" : [
        {
            "target" : {"group" : "1-10"},
            "overrides" : {"material" : { "name" : "`opfullpath("../shopnet1/constant2")`" }}
        },
        {
            "target" : {"group" : "11-20"},
            "overrides" : {"material" : { "name" : "`opfullpath("../shopnet1/constant1")`" }}
        }
    ]
}
 
This will shade agents using only the first target group.
{
    "styles" : [
        {
            "target" : {"group" : "1-10"},
            "overrides" : {"material" : { "name" : "`opfullpath("../shopnet1/constant2")`" }}
        },
        {
            "target" : {"group" : "11-20"},
            "overrides" : {"material" : { "name" : "`opfullpath("../shopnet1/constant1")`" }}
        }, <--- bad comma
    ]
}
 
And what is even weirder is that if I correct the bug and remove the last comma and render I get the correct result. But then if I re-introduce the bug by typing the comma again and I re-render then Mantra will still render the final group because it previously detected the group. So there is some kind of internal caching going on inside the Mantra node.
 
Just an FYI to users who explore this technique, there are bugs. If you feel your style sheet is correct try throwing away the Mantra node and creating a new one.
Edited by Atom
Link to comment
Share on other sites

I extracted the clothing_001.jpg from the digital asset and re-colorized it and saved multiple copies to a 'textures' folder. By overriding the materialParamters baseColorMap I can substitute an alternate image map for groups of agents. This stylesheet system is great fun to play around with. The major caveat I have encountered is that if you are referencing a file on disk make sure there is no SPACE character in the final path. For instance a folder called "My Textures" will not work but "My_Textures" will.

{
    "styles" : [
        {
            "target" : {"group" : "1-100"},
            "overrides" : {"materialParameters" : { "baseColorMap" : "$HOME/Houdini_Scenes/textures/clothing_brown_pants.jpg" }}
        },
        {
            "target" : {"group" : "101-200"},
            "overrides" : {"materialParameters" : { "baseColorMap" : "$HOME/Houdini_Scenes/textures/clothing_green_pants.jpg" }}
        },
        {
            "target" : {"group" : "201-300"},
            "overrides" : {"materialParameters" : { "baseColorMap" : "$HOME/Houdini_Scenes/textures/clothing_rust_pants.jpg" }}
        },  
        {
            "target" : {"group" : "301-400"},
            "overrides" : {"materialParameters" : { "baseColorMap" : "$HOME/Houdini_Scenes/textures/clothing_teal_pants.jpg" }}
        }
    ]
}

post-12295-0-13431800-1435673108_thumb.j

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...