Jump to content

From Magnet To Color Then To Vops?


Recommended Posts

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.

post-1724-1186102854_thumb.jpg

magnet_bump_v1r2_post.hip

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

:(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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