GreenGuy Posted January 8, 2018 Share Posted January 8, 2018 Hi, I need to calculate the distance from the center of a mesh. It works quite well in a point vop I made, but when I try to do the same thing in my material, the result looks wrong. Does anybody know what the reason might be? Quote Link to comment Share on other sites More sharing options...
Jesus Nieto Posted January 8, 2018 Share Posted January 8, 2018 I've had things not to match in SHOPS from SOPS too, and I don't exactly know why. But one thing you can do to get your attribute in SHOPS is to store it in sops using a bind export, and then in SHOPS simply place a parameter node and read back your attribute. it should match exactly. You can later use a fit or a ramp to adjust it in SHOPS and not see the ugly poly edges in case it's not too high poly. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 8, 2018 Author Share Posted January 8, 2018 Yeah, I was hoping to create the effect in shader. If I have to do it for tons of meshes it could get quite anoying... Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 8, 2018 Share Posted January 8, 2018 which houdini version are you using? Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 8, 2018 Author Share Posted January 8, 2018 16 Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 8, 2018 Share Posted January 8, 2018 Yeah I have had a few times in 16 where I cannot convert my SOPS to SHOPS as well in 16, however sometimes this issue could be fixed by using the mat context instead of shop. Its a long shot, but give it a try. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 8, 2018 Author Share Posted January 8, 2018 what exactly do you mean with the material context? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 8, 2018 Share Posted January 8, 2018 (edited) I dont know why, but I assumed you had your material located in a shopnet somewhere. I am saying try to put your material into the mat context instead Edited January 8, 2018 by Jesper Rahlff Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 8, 2018 Author Share Posted January 8, 2018 oh, i am working inside a classic shader Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 9, 2018 Share Posted January 9, 2018 if that classic shader is located at /obj/shop try to move it to /obj/mat instead Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 ok I will try that, but its going to take a while. there are a ton of references that will fall apart Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 9, 2018 Share Posted January 9, 2018 9 minutes ago, GreenGuy said: ok I will try that, but its going to take a while. there are a ton of references that will fall apart as I said previously it have fixed stuff for me a few times, but I don't know why the fix works.. so its a long shot. Quote Link to comment Share on other sites More sharing options...
Skybar Posted January 9, 2018 Share Posted January 9, 2018 How are you calculating it? If you just use P in the shader, the position will be in screenspace and not world. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 Yeah I thought so, I tried transforming it into world space, but that does not seem to do anything... Quote Link to comment Share on other sites More sharing options...
amm Posted January 9, 2018 Share Posted January 9, 2018 1 hour ago, GreenGuy said: Yeah I thought so, I tried transforming it into world space, but that does not seem to do anything... Should be something like in pic. That's SHOP, ''current'' space is camera. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 yes, I did that. I just put a transform node between the P and the multiply.(To apply it to your example) Quote Link to comment Share on other sites More sharing options...
amm Posted January 9, 2018 Share Posted January 9, 2018 14 minutes 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) Well, then something else went wrong. From my small experience, it works.... Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 14 hours ago, Jesper Rahlff said: if that classic shader is located at /obj/shop try to move it to /obj/mat instead Hey, so I did that and it did not really do anything. But it solved a couple of other problems I had, so thank you. Did not expect for shops to fall apart so quickly. Quote Link to comment Share on other sites More sharing options...
GreenGuy Posted January 9, 2018 Author Share Posted January 9, 2018 1 minute ago, amm said: Well, then something else went wrong. From my small experience, it works.... Yeah, seems like it I am probably not calculating the centroid the right way. How would you do it? I really have no clue how to do it in a shader, but in a point vop I can just average the bounding box outputs... Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted January 9, 2018 Share Posted January 9, 2018 3 hours ago, GreenGuy said: Hey, so I did that and it did not really do anything. But it solved a couple of other problems I had, so thank you. Did not expect for shops to fall apart so quickly. I am glad it at least solved something.. I dunno why but I find that shops throws me wonky errors now and then, so i started to use /mat context instead and it seems to work better. any chance you can share the hip file? a bit easier to help trouble shoot with a file to look at 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.