GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 Here you go. This file is a good example of what I am doing. ShaderExample.hip Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 9, 2018 Share Posted January 9, 2018 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.. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 10, 2018 Author Share Posted January 10, 2018 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? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 10, 2018 Share Posted January 10, 2018 (edited) 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 January 10, 2018 by Jesper Rahlff Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 10, 2018 Share Posted January 10, 2018 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. Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 10, 2018 Share Posted January 10, 2018 can't you do the usual: 01) remember 'world location', move to origin. 02) do your business. 03) move back out to 'world location' ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 10, 2018 Share Posted January 10, 2018 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? Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 10, 2018 Share Posted January 10, 2018 Just now, Jesper Rahlff said: would that work in a shader? dunno but nothing ventured nothing gained... Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 10, 2018 Share Posted January 10, 2018 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. Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 10, 2018 Share Posted January 10, 2018 Jean Clod Van Dam says.....No Retreat No Surrender !!! Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 10, 2018 Share Posted January 10, 2018 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... Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 10, 2018 Author Share Posted January 10, 2018 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. @Noobini: Hi 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... Quote Link to comment Share on other sites More sharing options...
j00ey Posted January 10, 2018 Share Posted January 10, 2018 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 Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 10, 2018 Author Share Posted January 10, 2018 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.