Jump to content

Using Attributes As Stylesheet Values?


Recommended Posts

Hi All,

 

I have a crowd system with an attribute that I want to route to a value in the principle shader.

I have added a stylesheet text box and I have the following code.

{
    "styles":
    [
        {
            "target":{"pointGroup" : "@agentgroup=redagents"},
            "overrides":{"materialParameters":{"basecolor":[0, @sf_agent_tint, 0]}}
        },
        {
            "target":{"pointGroup" : "@agentgroup=greenagents"},
            "overrides":{"materialParameters":{"basecolor_texture":"$HIP/cc0_Forest_monster/texture/rock_golem_diffuse_green.png"}}
        },

        {
            "target":{"pointGroup" : "@agentgroup=greenagents"},
            "overrides":{"materialParameters":{"basecolor_texture":"$HIP/cc0_Forest_monster/texture/rock_golem_diffuse_green.png"}}
        }
    ]
}

The line with the attribute @sf_agent_tint is failing.

 

How can I relay attribute values directly to shader values?

Edited by Atom
Link to comment
Share on other sites

Thanks for the example, but I don't see how the "tint" variable gets mapped to the diffuse color in the clay shader?

What connects those two? The stylesheet maps t:tint then the material overrides clay with tint, but tint does not exist as a parameter on clay...?

 

Also is there a way to just do it in stylesheet code, I don't really want to lay down CVEX nodes?

Link to comment
Share on other sites

Thanks again for the example file.

 

I am having trouble configuring your example to work with the new PrincipledShader in H15.

 

Using your example I added a principledshader to shopnet1 and set the diffuse color to pure white.

 

I modified the stylesheet code to use basecolorr as the target parameter instead of tint found on clay.

{
        "styles":[
                {
                        "label":"Style",
                        "target":{
                                "label":"Target",
                                "pointGroup":"blueagents"
                        },
                        "overrides":{
                                "material":{
                                        "name":"`opfullpath('shopnet1/principledshader')`"
                                },
                                "materialParameters":{
                                        "basecolorr":{
                                                "script":{
                                                        "binding":"agent_tint"
                                                }
                                        }
                                }
                        }
                }
        ]
}

When I render I get all white agents,however. The intention is to actually replace the value of basecolorr with the attribute value agent_tint. This should produce agents with a varying degree of RED missing from the white base color.

 

Is there some other syntax I need to change to make this work as intended?

Link to comment
Share on other sites

Ok, I see. You modified the principled material to conform to the stylesheet.

 

One thing I discovered is that I was able to modify basecolor itself. So I am wondering if agent_tint were actually a vector instead of a float I could modify the X channel of the vector to influence the RED value of the base color.

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...