YOUR ACCOUNT

Login or Register to post new topics or replies
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
I would like to share ideas for creating perspective in FF.

I'll start with the simplest possible example of making a proper perspective distortion. At least it shows the basic way this works.

The method is similar to using Profile Gradients and Offset to scale an image. The difference is that the percentage input is mapped with the depth information.

Here's the sample, which is essentially achieved by 5 Components.

(As you can see, it would look better if scaled down vertically. That is one of the most likely things you would do in actual use, unless you want a "wide angle" distortion.)

Snippet attached.



Perspective Distort Snippet.ffxml
  Details E-Mail
CFandM
ForgeSmith

Posts: 4761
Filters: 266
Also I found that if you can get some interesting distortions...Almost like a bloat and punk type of effect...
This is a nice and WAY COOL snippet I will be playing with this one all day..Many ideasl.. smile;) smile:)

bloated punk.ffxml
Stupid things happen to computers for stupid reasons at stupid times!
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
The simple distort above may not work for all purposes, so here's another one: The Infinite Plane.

Here we employ methods piloted by Matrix and Sphinx to create the plane (It's not actually infinite, for there are 201 copies of the original at the horizon, but close enough for most purposes). This involves shrinking the image down first and doing the offsetting in the opposite direction from the first example, that is, scaling the image up with perspective distortion.

Now we could get into the complexities of how the correct bias curve for keeping the perspective linear is calculated... better skip it at this point and just be happy with the output of the snippet. Here's how it looks; again you see that the image goes into "wide angle" below the center line, so if a "normal" perspective is needed, you could for instance just use the upper half.

Snippet attached.





Infinite Plane Snippet.ffxml
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
It is easy to see that many variations on the theme -- such as a road or a not-so-infinite plane -- can readily be made by masking off portions of the image right before the perspective distortion.

Scaling this output vertically will give you a great number of "different" perspectives.

With these two snippets and some additional scaling and masking you can do create almost any x-axis-rotated perspective plane.

If you want to get even fancier, you can probably add a "Any Angle Rotate" both before and after the perspective distortion step in the snippet, the first one to rotate the plane around the y-axis and the second one to rotate it around the z-axis. (Haven't tried that as yet, but at least in theory it should work -- I'll do that next).
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
So here it is, the fancier version with two Uberzev "Any Angle Rotate" snippets added.

Z-axis rotation forced me to mask off areas where the image wrapped around from the other side incorrectly, so something needs to be done about that if you want to rotate around that axis.

Other than that, worked fine. Rotated 45 degrees around Y-axis, 15 degrees around Z-axis:







Infinite Plane Advanced Snippet.ffxml
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Quite a number of 3D-landscape possibilities: Ground planes, water planes, cloud planes -- now we're talking!

Not to mention walls, floors, ceilings...
  Details E-Mail
Vladimir Golovin
Administrator
Posts: 3446
Filters: 55
Wow. Very nice!
  Details E-Mail
Sjeiti
sock puppet

Posts: 722
Filters: 71
Ah this is great... I was waiting for something like that. This opens the door to a whole new range of filters.
I remember Uberfez showed some perspective thing like that, but as with most of his teasers, he never submits them smile:p. Luckily we still have you.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Quote
CFandM wrote:
Also I found that if you can get some interesting distortions...Almost like a bloat and punk type of effect... This is a nice and WAY COOL snippet I will be playing with this one all day..Many ideas.. Wink Smile

bloated punk.ffxml


Some interesting warp effects, indeed. Well worth developing into something.
  Details E-Mail
Crapadilla
lvl 52 Filter Weaver and Official "Filter Forge Seer"

Posts: 4365
Filters: 65
I'm sure uberfez would disagree, but:

ThreeDee, you're the man! smile:D
--- Crapadilla says: "Damn you, stupid redundant feature requests!" ;)
  Details E-Mail
rgoer
Posts: 46
Can you explain the logic of the particular values used in the "bias" curve in the infinite plane snippet? Did you just eyeball them and it happened to work out perfectly, or is there a mathematical reason that this creates a perspective projection?
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
There's a mathematical reason it does, but it'd give me a headache to try and figure out exactly what it is. Nevertheless, by asking this question, you actually managed to make me figure out the formulas, which is a good thing, for I had been asking if anyone can...

The figures are related to the number of repeats in the profile gradient used to shrink down the original image. When you shrink down the image using that method, you get 2x+1 copies of the original image, where x is the number of repeats. (In the Infinite Plane snippet you have 100 repeats in the gradients, which results in 201 images in each direction.)

The reverse transformation Bias curve settings work with these formulas:

Bias = -x/(x+1)*100
Maximum = 50-50/(2x+1)


Thus, with the Infinite Plane snippet, which has 100 repeats in the gradient, you get:

Bias -99.0099, Maximum 49.7512

As to exactly why these formulas work, all I have to say is that my math coprocessor works independently from my language processor -- in other words, I probably couldn't explain it if I tried, not even to myself.

(Well, let me attempt to explain one thing: the reason the Maximum setting is approaching 50 as the number of repeats increases, is because that is the 50% gray that results in no offsetting. Thus the resultant image where after the two transformations the bottom row of pixels is the same as in the original -- and if you can follow that trail of logic, I'm amazed.)
  Details E-Mail
Carl
c r v a

Posts: 7289
Filters: 82
Quote
ThreeDee wrote:
I would like to share ideas for creating perspective in FF.

Thanks, opens up some fun stuff smile8) smile8) smile8)
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Rgoer, one more note on the logic behind the math, if it helps, as to why it is the Bias curve that works: the Bias curve is an inverse function, while perspective is a function of the inverse square. The bias curve works in one axis, so on two axes it becomes "Bias squared" or inverse square.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
About perspective view normalization:

The Infinite Plane Snippet gives you a 90 degree field of view, so if you want to normalize it to 60 degrees (human vision), scale it up so you see 2/3 of the default output from that snippet.

Another normalization factor is that you might want to center the vanishing point, which is now at the top center by moving it. (If you just do it by scaling vertically, you will technically speaking still have a wide-angle view.)
  Details E-Mail
Crapadilla
lvl 52 Filter Weaver and Official "Filter Forge Seer"

Posts: 4365
Filters: 65
ThreeDee, you should post these snippets to the library... very important stuff! smile:)
--- Crapadilla says: "Damn you, stupid redundant feature requests!" ;)
  Details E-Mail
James
James
Posts: 676
Filters: 46
Very cool, thanks ThreeDee smile:)
  Details E-Mail
CFandM
ForgeSmith

Posts: 4761
Filters: 266
Quote
Crapadilla wrote:
ThreeDee, you should post these snippets to the library... very important stuff! Smile

+100 smile:D
Stupid things happen to computers for stupid reasons at stupid times!
  Details E-Mail
Indigo Ray
Adam

Posts: 1442
Filters: 82
Alright, I never saw this thread. Completely disregard my incoming snippet.

Also, ThreeDee, I hope you don't think I'm leeching off of you by submitting perspective filters. I'm just trying to come up with creative additions to your prodigal ingenuity. Keep it up! smile:)
  Details E-Mail
Professor Fate
Professor Fate

Posts: 35
Filters: 3
Really neat. Thanks for posting!
  Details E-Mail
SpaceRay
SpaceRay

Posts: 12298
Filters: 35
Quote
Vladimir Golovin wrote:

Wow. Very nice!


I agree with Vladimir, WOW, this are very nice, well done, interesting and useful, and are different perspective possible and not just the plain one

Thanks
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
In FF3 perspective transformation is extremely simple. You just use the scale component set to 0 and feed a gradient to the percentage input. Black is view plane (0 distance), white is horizon (infinity).

Note: If you want the images to go all in the same direction, not flip around every other row, you have to enable Seamless tiling in the overrides. (Filter Editor: Filter>Overrides...).

  Details E-Mail
Morgantao
Can't script

Posts: 2185
Filters: 20
DOH!
Why am I seeing this thread only now?

Quote
Note: If you want the images to go all in the same direction, not flip around every other row, you have to enable Seamless tiling in the overrides. (Filter Editor: Filter>Overrides...).

Double DOH!
I uploaded a filter to your other thread, ThreeDee, where I used 2 gradients and a lookup for the same result. 4 times. In one filter....

Tripple DOH!
After typing a slightly longer post a few hours ago, my computer crashed, so I now had to retype smile:-p
  Details E-Mail
SpaceRay
SpaceRay

Posts: 12298
Filters: 35
Quote
Morgantao wrote:

After typing a slightly longer post a few hours ago, my computer crashed, so I now had to retype


I always make a copy in the notepad of the post that I am writing if it will include more than 3 lines, so while I am writing I copy in intervals to the notepad and save it, and so if anything happens and I loose the post I have already a copy of it, at least until the problem happened.

And I always for ALL the posts select all the text written and make a copy of the to the clipboard
  Details E-Mail
Morgantao
Can't script

Posts: 2185
Filters: 20
I copy to the clipboard too, except when I forget. And somehow the server\my computer\my internet connection knows that I forgot, because naturally that's when something goes wrong smile:D
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,712 Registered Users
+19 new in 30 days!

153,533 Posts
+31 new in 30 days!

15,348 Topics
+73 new in year!

Create an Account

Online Users Last minute:

33 unregistered users.