Jump to content

Recommended Posts

I hadn't actually read your code properly earlier but again you're setting a condition which can never be true.

You initialise a variable id as zero, then you say if it's between 2 and 10 set the Cd variable, but it's always zero.

For the id workflow I mentioned you need to read in the id from the geometry, in your sample scene you've set it as an output, and as a vector.

 

Attached is a sample scene.

inline_colour_by_id.hip

Share this post


Link to post
Share on other sites

You must bind import the attribute; but only attributes which are not global variables used within the material context, otherwise the inline vop can't find the attribute, correct ?

Although it is still not working ? See updated attached file.

qa_inlinevop.hipnc

Share this post


Link to post
Share on other sites

For a start you have id set as a vector output, and you're binding it as a vector too. It's an integer.

I haven't really got time to try and unpick the logic of your for loop but it seems to me you're trying to run before you can walk.

Houdini is telling you via the colour labels what's an int, float, vector etc. You need to be able to recognize them and know what data types you need to use to get what you're after. Don't overcomplicate with for loops, learn about basic stuff first like setting outputs in your inline VOP, writing to them, reading in geometry attributes, manipulating them and then outputting them.

 

Edited by j00ey

Share this post


Link to post
Share on other sites

Although if you take the scene which I rushed, and fix the errors; and even take your code and paste it into the inline vop of my scene; there are no errors, but it doesn't render the primitives a color ?

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

Also it's a good idea when you're testing things and figuring out what's going on in your shaders to work at the top level of a material network, not inside a material builder because you can assign anything as a material.

What I usually do is make a null, call it 'test' and assign that as a material, then just plug things into that to test

Share this post


Link to post
Share on other sites

@j00ey This is your scene, slightly modified; it renders as strictly white ?

B_inline_colour_by_id.hipnc

Attached is also my original scene although modified, which renders as simply white, as well ?

Sorry, if I should so happen to have missed something before posting the scenes.

 

qa_cinnamonInline.hipnc

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

I haven't looked at your scene but in the amended one of mine you've disconnected the enumerate SOP so there's no id attribute to bind, so it will always be zero and the conditions in the inline VOP always evaluate as false

Share this post


Link to post
Share on other sites

@j00ey You have to use the enumerate vop in order to use global attributes which are outside of the material global attributes inside of a inline vop; I thought that was by choice ?

I tried, rather then the enumerate vop to use

@id;

or

@id = @id;

in a primitive wrangler; and neither worked ?

One cannot also do multiple attribute within the enumerate sop as in; @id  @primnum etc.

If this is the only method by means to get attributes to be applied to the geometry for which the inline vop can read these attributes, only once they are bound in to the material; excluding global variables which are native to the material context those don't need to be bound, if this is all correct ?

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×