Jump to content
WnSoft Forums

Z axis panning zoom compensation


Recommended Posts

Again with an old proposal...

I spent a lot of time cutting my photos into layers (it took ages!).

The purpose is to obtain a 3D effect by placing each layer in different Z axis position.

The difficult part now is that if i move a layer on Z axis, then its apparent size changes due to perspective. This is bad in my case because layers are already "perspective corrected" by themselves because i extracted them by a real photo.

Hence, I must correct the apparent size by acting on the zoom factor of each layer. This is not a precise operation, because i don't know the formula that gives me the zoom factor based on z panning distance.

Would it be possible to introduce some (maybe well hidden) parameter that lets me counter balance the Z panning parameter by acting on the zoom level? At least... some kind of formula that given the Z axis pan value returns the zoom level that I should set to get the original apparent size back again?

Thanks... Umberto

Link to comment
Share on other sites

Umberto,

Firstly I must admit that I don't fully understand what you have achieved with your "layers" nor do I understand exactly what your problem is but permit me to make the following observation:

would your problem be resolved if you placed all your "layers" as children of a transparent frame and then applied the zoom to the frame?

would not the chldren then inherit their parent's attributes?

regards,

Peter

Link to comment
Share on other sites

Hi Peter...

Please check this out Cave test.zip.

I already post this little single slide animation months ago, but just to refresh.

As you can see, the scene is built by slicing a single photo into layers and filling the holes caused by slicing operation.

Each layer is on a different Z plane. When i place each layer on Z axis, I must correct layer zoom level to restore the original picture (if i look at the scene from the front, i want to see the original picture). If i don't do that, the assembly doesn't work because nearer layers appear to be bigger because of perspective.

Then I must work on zoom, hence my initial request :)

Thank you! Umberto

Link to comment
Share on other sites

Hi Umberto,

Very impressive! And now I understand what you have done with your layers. But if you now place the entire assemblage onto a new transparent frame and then zoom that frame, does this not give the effect you want?

regards,

Peter

Link to comment
Share on other sites

No, i was referring to the need to zoom each layer with different zoom values to constraint them to their "apparent original size".

Layers need to be on different Z distances fron observator eye to obtain the parallax effect.

You can try this with boxes. Create three identical boxes. Place the first at Z = 0, the second at Z = -100 and the third at Z = +100.

Obviously now you'll notice the perspective effect. The nearest one looks bigger and the fartest one looks smaller. By applying this procedure to a sliced photograph you get an odd result. You must "realign" all layers by zooming them. you must zoom out the nearest one to make it smaller (and fit the Z = 0 box size), then you must zoom in the fartest to make it bigger (for the same reason).

After this operation the original photo is restored (but with each layer at different Z coordinates!).

If you see it without perspective, you should see a "frustum".

Then you can pan/rotate and get a nice parallax effect.

The issue is that it's difficult to compute the right zoom factor to be applied to each layer to get the original "apparent size".

P.S. And, yes, all this mess in under a parent transparent frame that I use to rotate everything.

Greetings! Umberto

Link to comment
Share on other sites

To be more clear, here you are a little schema explaining the problem.

How to compute correct zoom factors?

Obviously computed zoom factors are related to the distance of z=0 plane from the eye. But when you have set the distance from the eye, you should be able to compute the zoom factor for each layer to make them visually re-align with the z=0 plane. When you have "reassembled" the picture, then you can start move/rotate the entire group and get the parallax effect.

Obviously, you cannot move/rotate too much.

If you exaggerate then the viewer will notice the artifact.

Greetings! Umberto

post-6394-127425677764_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

This is not a precise operation, because i don't know the formula that gives me the zoom factor based on z panning distance.

Would it be possible (...) At least... some kind of formula that given the Z axis pan value returns the zoom level that I should set to get the original apparent size back again?

Umberto, here is a formula I could think of.

I hope my explanations are comprehensible.

I don't know if it will be more precise than doing it with the apparent size but you can try.

I have very good results with my own tests.

Z : this is the Zoom value of your reference picture, the one with Pan Z = 0 (middle layer for your example)

P : this is the Pan Z value of the picture for which you want to calculate the Zoom level, the one with Pan Z <> 0

The Pan Z value might be positive or negative.

Zoom level = (( P x 0.0029 ) + 1 ) x Z

Please let me know how it works for you. :)

Link to comment
Share on other sites

Hi Umberto,

For the 3D representation, the overall observation point lies sqrt(3) times the height of screen in front of it. Thus, the pan Z value of the observation point (relative to the screen) is approx. -346.41 (200 times sqrt(3)). Using the intercept theorem, you obtain the following result:

Place an object at Z-position P , then the zoom factor you need is (346.41 + P)/(346.41); multiply by 100 in order to obtain the corresponding percent value.

Regards,

Xaver

Link to comment
Share on other sites

  • 2 weeks later...

@thedom: I think that your solution is not mathematically correct. I mean.... after posting the picture, i realized that the relative zoom levels needed to restore the apparence of the picture are not absolute, but they depend on the distance from the observator. You can see that by setting up a set of "aligned" layers, then moving all the block on the z axis. you will notice that they will go "out of sync" again.

If you wish, feel free to use text and pictures to illustrate the problem.

@xaver: I think that your hint is on the right way, but I fear we miss the distance from the observator to correctly apply the theorem... mumble mumble...

Greetings! Umberto

Link to comment
Share on other sites

Hi, Umberto,

Xaver formula is correct IF your pictures are at the 0 level – or under parents with all the zoom’ values at 100%

If the pictures are children of a parent with a zoom value, you have to take this value into account.

Example : if the parent ‘zoom is 16% , you have to take Pan Z x 16% in the formula

(if there is more than one parent, you have to multiply the zoom values of all the parents)

To verify the accuracy of the zoom value, you put a picture at Pan Z = 0 and zoom = 100%

above this picture, you put the same picture but with the negative colors, and with 50% opacity. Put it at the Pan Z value and the corresponding calculated Zoom value. You must obtain a perfect grey picture

Jean-Cyprien

Link to comment
Share on other sites

Hi Umberto,

See here the template of an example

edit. The zoom values of the pictures themselves are not to be taken into account into the formula, but of course, if one picture is not at 100% (258% for example !) the formula result is to be multiplied by this zoom value (here 258%)

I hope I'm clear, but be kind enough to excuse my difficulties with the English language (Even in French, it's not always easy to explain !!!!).

Thanks

PanZ_et_zoom.pt.zip

Link to comment
Share on other sites

Hi Umberto,

See here the template of an example

Thank you for your example template Jean-Cyprien, now i see, that under the constraint you stated, the formula is correct.

I'll keep it for future referral, even if i found that perfection is not really needed for a real photo, and manually adjusting each layer "by eye" is usually enough to obtain a pleasant result (and faster than calculate each layer zoom factor).

Anyway, this thread was really helpful to my knowledge. Thank you!

Greetings! Umberto

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.

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