Jump to content

Recommended Posts

okay I think I have what you want..

I am at work so cannot share a hipfile but its really simple:

1. in your shader, grab your Global P and pipe that into a transform node making sure space goes from current to object.

2. from your transform node put down a transform matrix, and set scale to 0,0,0

3. pipe in the output from your transform node and your transform matrix into a distance node.

4. put down a fit range and pipe that into the surfaceOutput cf

 

let me know if this is what you are after..

Share this post


Link to post
Share on other sites

Before I do that, this is going to give me the distance from the world origin right? Not really the center of the mesh. If the mesh was postioned somewhere else, this would not really work right?

Share this post


Link to post
Share on other sites
45 minutes ago, GreenGuy said:

Before I do that, this is going to give me the distance from the world origin right? Not really the center of the mesh. If the mesh was postioned somewhere else, this would not really work right?

pretty sure when you set the transform matrix scale to 0 and the space representation is object and not world it will scale to the center of the object. I did not test this outside of the origin on the scene you provided..

 

gonna test it now...

Edited by Jesper Rahlff

Share this post


Link to post
Share on other sites
54 minutes ago, GreenGuy said:

Before I do that, this is going to give me the distance from the world origin right? Not really the center of the mesh. If the mesh was postioned somewhere else, this would not really work right?

yes you are right. that is from the center... so that does not work.

Share this post


Link to post
Share on other sites

can't you do the usual:

01) remember 'world location', move to origin.

02) do your business.

03) move back out to 'world location' ?

Share this post


Link to post
Share on other sites
8 minutes ago, Noobini said:

can't you do the usual:

01) remember 'world location', move to origin.

02) do your business.

03) move back out to 'world location' ?

would that work in a shader?

Share this post


Link to post
Share on other sites
Just now, Jesper Rahlff said:

would that work in a shader?

dunno but nothing ventured nothing gained...

Share this post


Link to post
Share on other sites
Just now, Noobini said:

dunno but nothing ventured nothing gained...

well I have failed in several threads today.. I am calling it a day. No more venture for me. :(

Share this post


Link to post
Share on other sites
14 hours ago, GreenGuy said:

yes, I did that. I just put a transform node between the P and the multiply.(To apply it to your example)

just checking here....the advice from amm was to use transformspace, now you said you are using transform....NOT same.

so rclick/hit tab, whatever, type in transf, select Make Space Transform, near the bottom...(not the first thing you see there which is transform)...if you're already using Make Space Transform, then apologies...I'm just being pedantic...

Share this post


Link to post
Share on other sites
8 hours ago, Noobini said:

can't you do the usual:

01) remember 'world location', move to origin.

02) do your business.

03) move back out to 'world location' ?

I am not quite sure what exactly you mean here, sorry. I am still pretty much a beginner in Houdini.

 

@NoobiniHi there. I honestly dont quite know how to use that in a material. Where do I get the inputs from? I used the transform node in the past to measure the distance to a point and that worked quite well... I am assuming I have the wrong value for the center of the mesh. Can you tell me how you would do it in a material? Currently I have nothing connected to the bounding box node. This feels really wrong even though I am getting (the wrong) values...

Share this post


Link to post
Share on other sites

Does this do it?

I got rid of the fit inside the shader so it's just outputting directly the distance from the centroid. I added a couple of image planes so you can check the result against an attribute calculated in SOPs.

ShaderExample_edit.hip

Share this post


Link to post
Share on other sites
4 hours ago, j00ey said:

Does this do it?

I got rid of the fit inside the shader so it's just outputting directly the distance from the centroid. I added a couple of image planes so you can check the result against an attribute calculated in SOPs.

ShaderExample_edit.hip

Hey j00ey, thanks for the file. From it I realized that I simply had to change the transforms coming from the bounding box to object space. Rookie mistake.

Thank you all for the help!

All the best,

Sascha

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

×