Jump to content
AntoineSfx

How to importattrib from another SOP in a shader ?

Recommended Posts

In a shader, I want to sample the Cd attribute from a curve, which is not the object being shaded.

I can't / doesn't want to store the information on the grid - also this is just a proof of concept for something a bit more complex. 

In shop, I don't undertand how to query attributes on other piece of information for a given SOP.

In theory I could do it with Import Attribute, but how do I point to the set of curves ? I don't understand what OP Input Index mean. It feels like the other inputs for say, PointWrangle in SOP, but how does this work in shop ?

The documentation for " Import Attribute VOP node " says: This operator imports attribute data from the OP connected to the given input. It returns 1 if successful and 0 if unsuccessful. Possible reasons for failure are:

example.png

 

In pure SOP, this would look like this in a point wrangle on a subdivided grid:

int n = nearpoint(1,@P);
vector Cd = point(1,"Cd",n);
@Cd=Cd;
 

but I can't emulate the  "1" input in shop

Edited by AntoineSfx

Share this post


Link to post
Share on other sites

To be clear, are you using Shops or Material networks?  Shops is very deprecated at this point so hopefully just typed out of habit. 

Regadless, this might be something better achieved through baking your curve attributes to nearest point texture on the grid similar to Entagma's example:

 

Share this post


Link to post
Share on other sites
17 hours ago, ryew said:

To be clear, are you using Shops or Material networks?  Shops is very deprecated at this point so hopefully just typed out of habit. 

 

 

may not be shop

It's whatever it is that you plug in principled shader in the current H version

Window says VEX Builder

Edited by AntoineSfx

Share this post


Link to post
Share on other sites
16 hours ago, fencer said:

Maybe, simpli read curve in shader.

read_curve_in_shader.thumb.jpg.aa9baba20d947a5f446a238a57a4483a.jpg

read_curve_in_shader.hip

Is there a reason why you can't link directly to line/edit1 in xyzdist ? Something like op://line/edit1

 

Share this post


Link to post
Share on other sites
3 hours ago, AntoineSfx said:

Is there a reason why you can't link directly to line/edit1 in xyzdist ? Something like op://line/edit1

 

Not sure it will work in MAT contex, just save line before render what makes sense to keep stages separate.

Share this post


Link to post
Share on other sites
On 18.9.2022 at 2:37 PM, AntoineSfx said:

Is there a reason why you can't link directly to line/edit1 in xyzdist ? Something like op://line/edit1

 

You can. But you need to make sure that Houdini actually exports the line to Mantra, by adding it to the "Force Objects" parameter, but you also need to disable visibility by leaving the "Render Visibility" parameter on the object node blank.

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

×