Symbolic Posted August 3, 2007 Share Posted August 3, 2007 Hi, I have a magnet-metaball system that deforms a tube. I want to create a BumpMap in the shader applied to that tube... and I want that to be limited in the area effected by the Magnet. I kind of found a solution. There is an option in the Magnet SOP that lets you manipulate the color of the points as well as deform them. But the problem is that the parameters that are creating enough deformation are not enough to create a significant change in the color. And when I increase the values... I get proper color change but the geometry is totally destroyed. So in the attached file I use two Magnet SOPs... one manipulates the geometry the other changes the color. But this breaks the procedurality. I have to deal with two nodes and this is not efficient. After the color is created it is picked up by the shader and is used to mask a noise that is later used to create the bump. Could you please help me to find a solution. Probably there is a better way of linking the deformation caused by a magnet to a change in color. Thanks. magnet_bump_v1r2_post.hip Quote Link to comment Share on other sites More sharing options...
grasshopper Posted August 3, 2007 Share Posted August 3, 2007 I haven't looked at your file but one thought that occurs to me is to apply the magnet twice; once for the geometry deformation and then again with the settings that get you the colour you like. Then all you need to do is grab the colour settings from the second magnet operation and add them to the geometry deformation of the first. You can use a Point SOP for this. Feed the geometry version into the left input of the Point SOP and the colour version into the right input. Then put $CR2 $CG2 $GB2 in the colour fields. .... Alternatively you could try using a single magnet operation and then applying a function to your colours afterwards in a Point SOP. Try using a pos() function on the $CR, $CG, $CB fields to boost the values. john. Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 3, 2007 Author Share Posted August 3, 2007 I haven't looked at your file but one thought that occurs to me is to apply the magnet twice; once for the geometry deformation and then again with the settings that get you the colour you like.Then all you need to do is grab the colour settings from the second magnet operation and add them to the geometry deformation of the first. You can use a Point SOP for this. Feed the geometry version into the left input of the Point SOP and the colour version into the right input. Then put $CR2 $CG2 $GB2 in the colour fields. .... Alternatively you could try using a single magnet operation and then applying a function to your colours afterwards in a Point SOP. Try using a pos() function on the $CR, $CG, $CB fields to boost the values. john. Hi! I am using exactly the same technique... the one with the $CR2 $CG2 $GB2 But I am trying to avoid using two magnets... it complicates things... since I want to do some other things with that magnet... when they are two... it gets messy... I will have a look at your second suggestion as soon as possible... thank you very much... Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 3, 2007 Author Share Posted August 3, 2007 Hi!I am using exactly the same technique... the one with the $CR2 $CG2 $GB2 But I am trying to avoid using two magnets... it complicates things... since I want to do some other things with that magnet... when they are two... it gets messy... I will have a look at your second suggestion as soon as possible... thank you very much... // I have tried the pow() function... but boosting does not help... at the end everything in the color field of the Point SOP becomes 1 Quote Link to comment Share on other sites More sharing options...
David Gary Posted August 3, 2007 Share Posted August 3, 2007 Well, if you feel like using VEX or VOP: there's a VOP called Metaweight and which returns the weight of a metaball field ( no loops!, just one VOP ) ( it uses a file input but if you type: op/ + the path of your metaball SOP, or any SOP that contain metaballs, it also works on SOP - think of them as temporary geo files-). You can then use this value to determine your color. Notice that if you know how to write deformations in VEX/VOP you can also use this value for the deformation itself. You can then have both in one VOPnetwork. ( using metaball weight in a deformation is just a matter of multiplying the deformation parameter ( the angle of rotation, the x amount of translation whatever) with the metaball weight for each point -> so metaballs deformation ( = magnet SOP) "do not deform", they rather "weight deformations"! so... of course they eventually deform). This being said, if your final goal is a shader, why not make your VOPnet the one of a... shader ( almsot copy and paste one VOPNet to the other): f.Ex if you want the metaball to compute the amount of displacement or whatever... Just thoughts. hth -d Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 3, 2007 Author Share Posted August 3, 2007 thanks.. I am on my way to my computer I will try it as soon as possible. But it sounds complicated... I am not that experienced with those things... Quote Link to comment Share on other sites More sharing options...
SpencerL Posted August 3, 2007 Share Posted August 3, 2007 I just mult'd up the color value that is generated from the Magnet SOP that affects the position. magnet_bump_v1r2_post_002.hip Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 3, 2007 Author Share Posted August 3, 2007 Thanks SpencerL! That worked perfect! Great Quote Link to comment Share on other sites More sharing options...
SpencerL Posted August 3, 2007 Share Posted August 3, 2007 (edited) No problem. I think FrenchOP's suggestions seem to be more robust and elegant, but if this works then great! Edited August 3, 2007 by SpencerL Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 6, 2007 Author Share Posted August 6, 2007 No problem. I think FrenchOP's suggestions seem to be more robust and elegant, but if this works then great! I could not apply FrenchOP's suggestion... I think something was wrong with the process of reading the metaball into the VOP network... I am sorry about that but it is my fault... I am not that experienced with the VOPs... so I am sure I messed up things... if there is somebody that would like to test it... i really would likte to learn how to do it with FrenchOP's technique... Thanks Quote Link to comment Share on other sites More sharing options...
SpencerL Posted August 7, 2007 Share Posted August 7, 2007 Here is an example of what FrenchOP is talking about (i think). The example transforms (deforms) the geo based on the metaweight VOP as well as colors the geo. Adjust the metaweight and it will increase the deformation. Hope this makes sense. magnet_bump_v1r2_post_003.hip Quote Link to comment Share on other sites More sharing options...
Symbolic Posted August 7, 2007 Author Share Posted August 7, 2007 Hi! Thanks for this post. This technique is much better. You have the "metaball and the coloring process" separated from the "metball and deformation process" which I think is a much cleaner workflow. Thanks again for your help... and to everybody who contributed to this post. 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.