Archive: Superscope help


3rd February 2003 02:15 UTC

Superscope help
Ok, This is strictly for those who know superscopes, mathematics, and preferably english.

Ive started working on a mirror Superscope. Ie, you duplicate a 3d scope, chuck in some code, and viola! you have a reflection of your scope from a horizontal plane.

I worked out the code for elvis's 3d thing so everyone can understand it.

The original lines:
x=x4/(1+z4/dst);
y=y4/(1+z4/dst);

My code:
y5=2;
z5=(z4-(((y4-y5)*z4)/(-y5+(y4-y5))));
x5=(z4-(((y4-y5)*z4)/(-y5+(y4-y5))))*(x4/z4);
x=x5/(1+z5/dst);
y=y5/(1+z5/dst);

I really dont want to explain how and why, so if you understand what ive done, Read On.

That code makes a reflective projection of the scope specified in y1,x1 and z1 along the plane at y=2.

MY PROBLEM IS: It doesnt look like a mirror, it just looks like another scope lover down, the same way that a perfectly clean mirror resembles a real life extension of a room. I need to think of a way of rotating the mirror, and therfore distorting the reflection to convince the viewer.

Any suggestions, ideas, ... Unconed perhaps.!??


3rd February 2003 03:33 UTC

First off, don't use the el-vis method for 3D. I've got a psuedo-explanation of 3D in AVS Primer, it doesn't work in the real world (the proof, that is), but for all intents and purposes, it'll suffice (I'm gonna update it soon).
An object mirrored along the X-plane works like this:
frame: a=0;
pixel:
a=1-a;
x=if(a,...,-x);
y=if(a,...,y);
You can apply this to 3D quite easily. Do note that this only works if "lines" is off.


4th February 2003 01:31 UTC

Cheers atero, but if im not mistaken, your 1-a method will just create an inversion of the original. That is, it is still 3d, but just reversed on the x plane.

What im trying to get is a 3d object that is transposed on to a 2d surface in front of the camera. Just like mirrors in real life.



btw, by actual code does not use elvis's method, im just explaining it that way so all can understand without me posting the whole lot.


4th February 2003 02:08 UTC

It sounds like you are just trying to project a 3-D object onto a 2-D SSC. Look at Atero's primer. There are several presets that somewhat explain this projection. Also, search the forums for this. Shouldn't be too hard to find what you need.


4th February 2003 02:17 UTC

sigh.. ok


4th February 2003 06:08 UTC

loook, thank you all.. but i dont think ive explained it very well..
its not just projections.., its more like projections twice over.

you draw the 3d image, project it onto the 2d surface, move that 2d surface into the 3d world and then project it back to the 2d x by y superscope engine.

y5=2;
z5=(z4-(((y4-y5)*z4)/(-y5+(y4-y5))));
x5=(z4-(((y4-y5)*z4)/(-y5+(y4-y5))))*(x4/z4);

This makes the mirrored image, on an actual 2d surface (The plane at y=2)! Ive already done that much.. What i need is a way to rotate my projection, and distort the mirrored image as it would be in real life.. IT IS A REALATIVLY NEW IDEA.. (For superscopes anyway) its not going to be in the forums.. The forums will have ideas like rotating the flat surface, or rotatingg a surface with DM. But none of these ideas will actually affect the shape of the reflection like in real life.

Any understand me now?? im not very good at explaining this shit.


4th February 2003 11:21 UTC

What i sugest is that you make two same 3D scopes and sinchonise them using getosc. Than project one of yore scopes once and one off them two times(2nd time on a plane you want).
In the attachment you can see 3 scopes: a 3D cube, a square, and a mirrored cube projectet on the plane defined by this square.

And this should be moved to troubleshooting forum.


4th February 2003 12:28 UTC

I don't really understand what you mean either. Do you mean non-flat mirrors and such? Or do you mean drawing what you see when you look straight at the mirror and then using that as a texture on a 3D DM?

In the second case, you need to mirror your camera's position and rotation and use that virtual viewpoint as your perspective.


4th February 2003 12:30 UTC

The key to doing that right is to make sure you do the rotations and translations in the right order.


4th February 2003 12:50 UTC

It's not so much doing it in the right order, but knowing why you're using a certain order.

Attached is the idea behind the virtual camera thing. Using vector math you can mirror the camera's position and viewing direction.


PS: nixa: this doesn't belong in the troubleshooting forum... troubleshooting is for technical problems in getting AVS to run, not discussions about making avs presets.


4th February 2003 18:29 UTC

You want to reflect something though a general plane? (ax+by+cz+d=0)

Is that what you want to do? If so then the easiest way to do this is to rotate and translate your 'world' so that the plane is z=0 then just change the signs the resulting z co-ordinates and reverse the rotation and translation. It will take a maximum of two rotations and one translation to align the plane with z=0 since the rotations and translation should be done to remove the x component, then the y component then the constant value. Do some matrix multiplication by a general plane to figure this out... I can't be bothered to expand that many brackets right now.


The main thing that I don't understand is this:

It doesnt look like a mirror, it just looks like another scope lover down, the same way that a perfectly clean mirror resembles a real life extension of a room. I need to think of a way of rotating the mirror, and therfore distorting the reflection to convince the viewer.
Rotate a real world mirror and the image will *NOT* distort, it will move to show a different viewpoint.

4th February 2003 21:56 UTC

If, by distort, you mean have a trapezoidal effect when the camera is looking at the mirror through a low angle, then yes it will distort. Any other distortion would be caused by a non-flat mirror.


5th February 2003 01:01 UTC

ok, your all with me now.. sweet...
Unconed is right on the money when he was talking about using a 3d scope as a texture for a 3d surface..
BUT, mirror images and reflections dont act like textures when the surface they are on is rotated, skewed or bent. A texture will distort as the surface is rotated, but a reflection will maintain the shape (from the pov of the camera) but reflect a different part of the original..

Ang, on.. im re-reading everyones posts

":Rotate a real world mirror and the image will *NOT* distort, it will move to show a different viewpoint."

Cheers jheriko, i think thats where i got everyone (incl myself) confused..i meant wot you said. ill send my first attempt in a sec.

But you see the problem, i just need ways to convince the person that is an actual reflection, and not just another 3d scope directly below the original one. Im thinking about stealing unconed's idea from the sourceII

btw, how do i attatch, and how do i use the code box so i can draw cheezy diagrams


5th February 2003 01:31 UTC

To attach files: Click the "Post a Reply" button :down: .
Then, type whatever in the "your reply:" box. Then, below the "your reply:" box are some checkboxes and a place where it says "Attach file:". To the right of "Attach file:" is a empty text box and a button that says "Browse...". Click the "Browse..." button and locate the file you want to attach by navigating the folders in the window that should appear after clicking the "Browse..." button. This file must be one of the valid file extensions which are listed below the "Browse..." button. "Valid file extensions: gif jpg png txt zip bmp jpeg wsz wal m maki nsi nsh". You can download winamp from www.winamp.com and add your avs files(or whatever) to a zip file, which can then be uploaded on the website.

It isn't that difficult to figure out and I am sure it is addressed somewhere in these forums. If you can't follow my instructions, then go away.:hang:


5th February 2003 01:45 UTC

nixa.. man.. geeez
i only just looked at you preset posted above..
you showed me up hardcore and made it look so eeeezy

thats very clever of you..

im still trying to get my head around bits of the movement. but yeah..
thats eaxactly what i wanted to do pretty much.

If there are people on this thread that still cant understand what im shiting on about.. download nixa's mirror.

Attatched is my first attempt, before nixa came along and made me look so wanky... full of bugs, errors and code imperfections..
i used a very cheezy ways of blackening part of the reflection as it passes over the grid..
i havnot yet worked out rotation etc.. sigh..


5th February 2003 01:53 UTC

That's nice. The grid can be done easier than using 15 SSC's. Yeah, it does look like you haven't added the "distortion".


5th February 2003 02:01 UTC

hehe.. that grid is an heirloom..
its the first think i made in 3d.. and now i use it whenever i start a new project..
hehe.. im glad you comented..


-----------------
i made this is edit for anubis
-----------------


5th February 2003 06:18 UTC

Ooops.. alright nixa..
i re read your scope code.. and..
well.. its not a mirror.. its just a texture sortof thing..
ie.. if the cubes arnt rotating, the reflection will only show the side that the camera see..
wheras a reflection would show the apparant side from the imaginary cameras pov.

Geez, now im talking about imaginary camera's, i didnt even use them with my method..

here.. i whiped up a cheezy diagram in paint. i think my working out it right.. feel free to correct or ammend.

unconeds diagram above uses the imaginaryt cam thingo