Jump to content

Distance from center in shops


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

Link to comment
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
Link to comment
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.

Link to comment
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...

Link to comment
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...

Link to comment
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

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