Jump to content


Photo

Refraction Macro

Macros Warp Gringo

  • Please log in to reply
27 replies to this topic

#1 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 18 September 2008 - 10:29 AM

A macro to simulate the refraction effect.
In comparison to the Displace tool it doesn't need a center. Pixels are being shifted from bright to dark areas of the refraction map.

Attached File  Refraction.jpg   67.59KB   293 downloads
Attached File  Refraction_v01.setting   6.73KB   105 downloads
Attached File  Refraction_Example.comp   17.38KB   95 downloads

Does anybody know, how to get to a simple expression the initial resolution of a picture generated by a node without taking into account the Proxy mode state?
And how to get the pixel aspect there?

#2 SecondMan

SecondMan

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 1,797 posts

Posted 18 September 2008 - 11:42 AM

Another interesting one!

Your example comp seems to have a strange character at the end when clicked on in a web browser, had to delete it to open it (I tend to copy-paste macros and comps from Pigsfly to Scite).

What your question concerns, no clue. But I would mail that one to Eyeon themselves, I think there you'll get an answer much quicker than here.

#3 SecondMan

SecondMan

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 1,797 posts

Posted 18 September 2008 - 11:43 AM

And thank you! Obviously. :)

#4 leif3d

leif3d

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 554 posts

Posted 18 September 2008 - 02:39 PM

This looks very cool Gringo!

I can't wait to try it out.

Thanks again for all your great tools. :mf_gap:

#5 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 18 September 2008 - 03:15 PM

Now it has an issue when the proxy mode is on.
But once I'm able to get the full size of a node's output, I'll solve it.
Another, not very elegant way is to create extra parameters to give a possibility to define image size manually.

Yes, I'll try to contact the tech support :)

#6 Daniel Koch

Daniel Koch

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 661 posts

Posted 19 September 2008 - 02:14 AM

You're using Blur1.Input.Width to get the image width. If you use Blur1.Input.OriginalWidth, that'll give you the unproxied value.

There's also OriginalHeight, XScale, YScale, OriginalXScale and OriginalYScale members. See the page here, or type Help "Image" into the Console view.

#7 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 19 September 2008 - 07:20 AM

Thank you Daniel!
Using these members I can also improve my macro for dailies so that it will output desired QT resolution when rendering in proxy.

And this is a new version of the Refraction macro.
It works fine when the Proxy mode is on.

Description of the macro at VFXPedia: http://vfxpedia.com/...ion_Description

Attached Files



#8 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 20 August 2009 - 12:21 PM

I put a bug in the macro during the final testing. It would scale the image up constraining left bottom corner.

Please, see a new, cleaned up version:

Attached Files



#9 ChadCapeland

ChadCapeland

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 1,975 posts

Posted 20 August 2009 - 01:34 PM

Nice work. I love the group-based macros, too. But a little nitpick...

The BG should have the Red and Green 1.0's replaced with a simple expression: (Blur.Input.OriginalWidth-1)/Blur.Input.OriginalWidth


{
	Tools = ordered() {
		Background = Background {
			ExtentSet = false,
			CtrlWZoom = false,
			NameSet = true,
			Inputs = {
				Width = Input {
					Value = 204,
					Expression = "Blur.Input.OriginalWidth",
				},
				Height = Input {
					Value = 155,
					Expression = "Blur.Input.OriginalHeight",
				},
				PixelAspect = Input {
					Expression = "Point(Blur.Input.OriginalXScale, Blur.Input.OriginalYScale)",
				},
				Depth = Input {
					Value = 4,
				},
				Type = Input {
					Value = FuID { "Corner", },
				},
				TopLeftGreen = Input {
					Value = 0.995098039215686,
					Expression = "(Blur.Input.OriginalWidth-1)/(Blur.Input.OriginalWidth)",
				},
				TopLeftAlpha = Input {
					Value = 0,
				},
				TopRightRed = Input {
					Value = 0.995098039215686,
					Expression = "TopLeftGreen",
				},
				TopRightGreen = Input {
					Value = 0.995098039215686,
					Expression = "TopLeftGreen",
				},
				BottomRightRed = Input {
					Value = 0.995098039215686,
					Expression = "TopLeftGreen",
				},
				Gradient = Input {
					Value = Gradient {
						Colors = {
							[0] = { 0, 0, 0, 1, },
							[1] = { 1, 1, 1, 1, },
						},
					},
				},
			},
			ViewInfo = OperatorInfo {
				Pos = { 85.7859, -30.6648, },
			},
		},
	},
	ActiveTool = "Background",
}


The result is slightly more accurate. Of course, the Filter set to Relief isn't ideal either, since it doesn't wrap the edge pixels. For that, I can think of three options:

1) Pad the input to the Filters by 2 pixels in X and Y, then crop them off before the CT.
2) Use the CustomFilter tools, one with a Sobel X the other with Sobel Y. The CustomFilter is slower than the Filter, but your CT will not have to have the -.5 in it.
3) Use the CreateBumpmap (yeah, you'd have to have Fusion 6 for that...). This is probably your best bet since it will make the horizontal and vertical components in one tool.

#10 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 20 August 2009 - 04:07 PM

Thank you for the interesting comments!
It's a good kind of feedback helping improve tools further!

If consider pixel level precision, the Red and Green channel values should be calculated separately taking into account the Image Height as well:
Attached File  TextureTest.comp   15.83KB   40 downloads

The next version for Fu6 is going to be more precise and elegant :)

#11 ChadCapeland

ChadCapeland

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 1,975 posts

Posted 21 August 2009 - 05:26 PM

If consider pixel level precision, the Red and Green channel values should be calculated separately taking into account the Image Height as well:


Whoops! That's the setup I have for one of my BG default settings, I just forgot to copy it all over when I was renaming the expressions to your macro. Doesn't help that I was testing a square texture... :)

- Chad

#12 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 28 September 2009 - 09:11 AM

So, more precise and elegant version for Fusion 6 after Chad's suggestions:
Attached File  Refraction_v04.setting   6.23KB   18 downloads
It also has some new functionality.
Now you can define which channels should be used to generate the height map and the new Combined Power control lets you adjust the refraction index in both vertical and horizontal directions simultaneously.

#13 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 05 October 2009 - 04:30 AM

In this new version you can attach masks to the tool.

The Common Controls tab was added, where you can define blend and affected channels, invert used mask (thanks to Christoffer Hulusjo for the tabs tip!)

Attached Files



#14 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 11 October 2009 - 09:29 AM

A new version with some improvements concerning masks.

  • If you feed an image directly to the Mask input, Low and High controls are now displayed.
  • Added the Refraction Mask input which affects not blending, but the power of the effect.
Is it possible to define the color of a node input?
Would be great to paint the Effect Mask input standard lavender

Attached Files



#15 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1,455 posts

Posted 12 October 2009 - 08:31 AM

Is it possible to define the color of a node input?
Would be great to paint the Effect Mask input standard lavender

Yes, Gringo, it's possible.
Just use
EffectMask = InstanceInput {
	SourceOp = "Merge1",
	Source = "EffectMask",
},
instead of
MainInput2 = InstanceInput {
	SourceOp = "Merge1",
	Source = "EffectMask",
},
See a modification of your macro:

Attached Files







Also tagged with one or more of these keywords: Macros, Warp, Gringo

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users