|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® Stitcher™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Looking for a diolate tool fot TOXIK?
|
|
|
hey guys,
Unless I am blind,has anyone made a diolate tool like the minmax tool in combustion with the PXL tool? I do not think there is one standard so I thought I would ask.
Mark Rasmussen
Compositor | Consultant
Enigma Studios Inc
Enigma Studios London (UK) Ltd
http://www.toxikblog.blogspot.com
|
|
|
|
|
i think there was an example of ‘erode’ in the toxik documentation for PXL, and if i’m not mistaken dialate is the reverse of erode ? so perhaps using that code and
making modifications would work ?
Author: nirokugraphic
|
|
Replied: 26 October 2009 04:29 PM
|
|
|
|
|
Thanks man but that is not what I had in mind you
have to look at the combustion minmax tool to see what
I am thinking of, I can not see it in toxik
cheers
Mark Rasmussen
Compositor | Consultant
Enigma Studios Inc
Enigma Studios London (UK) Ltd
http://www.toxikblog.blogspot.com
|
|
|
|
I think the Erode preset for the PXL tool could work for you. The way it comes in by default, it works as a Minimum filter, i.e. it will grow the black areas in the alpha
channel.
If you go into the source code, there is a line that says “if( thisAlpha < alpha )" somewhere in the lower part of the script. If you change that to " if( thisAlpha >
alpha )”, you have a Maximum filter instead, i.e. one that will grow the white parts of the alpha.
Based on a quick look at the Combustion docs, Toxik’s default “Erode” script will therefore work like the “Minimum” option in Combustion’s Minmax operator, with the edit I
described it will work like the Maximum option. If you use two PXL nodes, one with the modification and one without, you can replicate the “Minimum then Maximum” and “Maximum
then Minimum” behaviors, depending on the order in which you string them together. You could then link the two radii using expressions (by dragging one on top of the other in
the composition browser).
One limitation of the PXL example seems to be that it cannot work with subpixel radii, i.e. a radius of 1.3 gives you the same result as a radius of 1.0 and so on.
You could also try using two instances of the Edge tool with corresponding radii for the Shrink option (eg. one -2 and the other +2), it would probably render quicker than two
PXL scripts.
Hope that helps
Peter
|
|
|
|
Hey Peter,
Thanks for that great response. However, I am looking to effect the RGB channels only. Exactly how the minmax tool within Combustion
does it. I was thinking about modifying the code for the erode to see if I can do what I need. However, it is not an expand or erode, it actually
effects the image in a way that dilates the image.
If you have any other ideas please share :-)
Cheers
p.s. I sent a response prior to this that did not seem to get posted. So if I posted twice sorry about that.
pixelLoop 01 November 2009 07:42 AM
I think the Erode preset for the PXL tool could work for you. The way it comes in by default, it works as a Minimum filter, i.e. it will grow the black areas in the alpha
channel.
If you go into the source code, there is a line that says “if( thisAlpha < alpha )" somewhere in the lower part of the script. If you change that to " if( thisAlpha >
alpha )”, you have a Maximum filter instead, i.e. one that will grow the white parts of the alpha.
Based on a quick look at the Combustion docs, Toxik’s default “Erode” script will therefore work like the “Minimum” option in Combustion’s Minmax operator, with the edit I
described it will work like the Maximum option. If you use two PXL nodes, one with the modification and one without, you can replicate the “Minimum then Maximum” and “Maximum
then Minimum” behaviors, depending on the order in which you string them together. You could then link the two radii using expressions (by dragging one on top of the other in
the composition browser).
One limitation of the PXL example seems to be that it cannot work with subpixel radii, i.e. a radius of 1.3 gives you the same result as a radius of 1.0 and so on.
You could also try using two instances of the Edge tool with corresponding radii for the Shrink option (eg. one -2 and the other +2), it would probably render quicker than two
PXL scripts.
Hope that helps
Peter
Mark Rasmussen
Compositor | Consultant
Enigma Studios Inc
Enigma Studios London (UK) Ltd
http://www.toxikblog.blogspot.com
|
|
|
|
I did some experimenting, but the Toxik system I had access to kept crashing on me, so I didn’t get very far on the PXL front. Maybe if I find some time next week, but I can’t
promise anything, plus I’m still new to PXL and Toxik in general.
And my apologies for not looking properly, I missed the fact that C*’s Minmax uses the RGB channels, not the alpha. But the approach is the same, only that instead of doing it
on the Alpha channel, you do it to the RGB channels independently. You can replicate that in Toxik by splitting the image into its channels (using an Channel Extract operator
for instance), then applying the Erosion/Dilation as I described, once per channel (you can link the radii using expressions so you only have to adjust one and it would be
replicated across all channels), and then recombining them to an RGB image (using Rewire and then Replace for instance). You can put the entire thing into a Macro node and it’s
probably still going to process faster than PXL. If you need individual horizontal and vertical control, though, you’ll need to use PXL script or do some faking using blur
operators.
|
|
|
pixelLoop 03 November 2009 06:43 PM
I did some experimenting, but the Toxik system I had access to kept crashing on me, so I didn’t get very far on the PXL front. Maybe if I find some time next week, but I can’t
promise anything, plus I’m still new to PXL and Toxik in general.
And my apologies for not looking properly, I missed the fact that C*’s Minmax uses the RGB channels, not the alpha. But the approach is the same, only that instead of doing it
on the Alpha channel, you do it to the RGB channels independently. You can replicate that in Toxik by splitting the image into its channels (using an Channel Extract operator
for instance), then applying the Erosion/Dilation as I described, once per channel (you can link the radii using expressions so you only have to adjust one and it would be
replicated across all channels), and then recombining them to an RGB image (using Rewire and then Replace for instance). You can put the entire thing into a Macro node and
it’s probably still going to process faster than PXL. If you need individual horizontal and vertical control, though, you’ll need to use PXL script or do some faking using
blur operators.
No worries Peter,
Thanks for the additional information. I think we are thinking the same thing with the PXL tool approach. The only thing is, like you it is getting the time to get it done :-)
Cheers
Mark Rasmussen
Compositor | Consultant
Enigma Studios Inc
Enigma Studios London (UK) Ltd
http://www.toxikblog.blogspot.com
|
|
|
|
Hey Peter,
Here is the code. Just replace the existing one with this. I tested
and it works.
Cheers
----------------
float aspect = getPixelAspectRatio( In )
// Get the x and y radius in pixels.
float yRadius = floor( Radius )
float xRadius = floor( Radius / aspect )
float alpha = a( In )
float red = r( In )
float green = g( In )
float blue = b( In )
for ( float ty = -yRadius; ty <= yRadius+0.5; ty += 1 ) { > for ( float tx = -xRadius; tx <= xRadius+0.5; tx += 1 ) { > // Convert x pixel position back to nominal
position
float thisAlpha = a(sample(In,x+tx*aspect,y+ty))
float thisRed = r(sample(In,x+tx*aspect,y+ty))
float thisGreen = g(sample(In,x+tx*aspect,y+ty))
float thisBlue = b(sample(In,x+tx*aspect,y+ty))
if( thisRed < red ) > red = thisRed;
if( thisGreen < green ) > green = thisGreen;
if( thisBlue < blue ) > blue = thisBlue;
if( thisAlpha < alpha ) > alpha = thisAlpha;
}
}
Out = color( red, green, blue, alpha )
Mark Rasmussen
Compositor | Consultant
Enigma Studios Inc
Enigma Studios London (UK) Ltd
http://www.toxikblog.blogspot.com
|
|
|
|
|
Settings
|
Choose Theme color:
|
|
|
|
|
|
|