timfagan Posted June 21, 2015 Share Posted June 21, 2015 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? Quote Link to comment Share on other sites More sharing options...
Atom Posted June 21, 2015 Share Posted June 21, 2015 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? Quote Link to comment Share on other sites More sharing options...
timfagan Posted June 21, 2015 Author Share Posted June 21, 2015 (edited) 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... Edited June 21, 2015 by kayman Quote Link to comment Share on other sites More sharing options...
mestela Posted June 21, 2015 Share Posted June 21, 2015 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. Right click on the geo, 'edit parameter interface...' Go to the Render Properties tab Use the filter at the bottom to search for some keywords. In this case, type 'stylesheet', hit enter The treeview gets reduced to a single folder. Expand it out, there's a subfolder 'shader', expand it, you'll find 'material_stylesheet' 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) Apply/Accept 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. 1 Quote Link to comment Share on other sites More sharing options...
timfagan Posted June 21, 2015 Author Share Posted June 21, 2015 Excellent, thanks! Quote Link to comment Share on other sites More sharing options...
timfagan Posted June 22, 2015 Author Share Posted June 22, 2015 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. Quote Link to comment Share on other sites More sharing options...
Atom Posted June 29, 2015 Share Posted June 29, 2015 (edited) 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? 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. { "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 June 29, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
Atom Posted June 29, 2015 Share Posted June 29, 2015 (edited) 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 June 29, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
Atom Posted June 30, 2015 Share Posted June 30, 2015 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" }} } ] } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.