Polyvector question

Previous topic - Next topic

Hemlos

Im trying to adjust the corners of a polyvector box, to simulate a 3d effect in 2d.
When i move the polyvector corners around(polyvector is no longer square), the image in the polyvectors seem to get distorted.
I tried turning off smoothing, but this doesnt help.
The same effect happens whether i use 2 triangles or 4, or 8
Any ideas?

I know someone tried to make a 3d game with polyvectors and had this problem while viewing walls...the triangles distorted.
I couldnt find this old thread, and was wondering if anyone remembers where it was?
Bing ChatGpt is pretty smart :O

Slydog

If you haven't changed your tx, ty points for each corner, it will stretch the image to fit the new poly shape.
Just like an image editing program when you take a square picture and move the corner handles around, and it distorts / stretches the picture to fill the new shape.  It's still fitting the same source image but into the new shape.

If you wanted to skew the polygon but not distort the image (keep it non-skewed), I think that would be difficult.  If you know the final polygon shape ahead of time, you may be able to reverse-skew the image so that when it is skewed it will look normal / unskewed.

Or are you saying the image is distorted incorrectly, and not as expected?

My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

Yes, what you want is "perspecitve correction", and you don't get it with real 2D. Search the forums, there was a thread about exaclty the same topic years ago.

BTW: That was the problem with many PSone games.

Hemlos

Ive looked a few times, nothing.

Maybe ill just run the program in 3d while the effect is happening.
Bing ChatGpt is pretty smart :O

Wampus

Hi Helmos

I think this thread is the one you may have been looking for: http://www.glbasic.com/forum/index.php?topic=2543

I came across the same issue when doing an experiment to create a pseudo-3D floor like Diablo 2. I created a grid of tiles, drew them using some old-school perspective math and then slapped myself when I saw all of the tiles were slightly skewed! I decided 3D was the obvious choice. No need to reinvent the wheel.  ;/ Problem was I was so shy of looking at 3D functions at that time that I gave up!  :-[

Perhaps I'll revive the project at some point. I have recently thought about what it would take to do a LAN rehash of the the classic SNES-style "Mode 7" Mario Kart battles. That was so much fun back in the day and yet so simple to pick up.

Quote from: Kitty Hello on 2011-Jan-21
Yes, what you want is "perspecitve correction", and you don't get it with real 2D. Search the forums, there was a thread about exaclty the same topic years ago.

BTW: That was the problem with many PSone games.

Yeh! For nostalgia purposes I still play some of my old PS1 games on an emulator occasionally. The lack of perspective correction makes classics like Soul Reaver and Tomb Raider look really odd nowadays.

Hemlos

Quote from: Ragaril on 2011-Jan-28
Hi Helmos

I think this thread is the one you may have been looking for: http://www.glbasic.com/forum/index.php?topic=2543

yes thats the one.
I tried my 2d solution, and it doesnt work.
An increase in triangles doesnt help.

Quote from: Slydog on 2011-Jan-20
If you wanted to skew the polygon but not distort the image (keep it non-skewed), I think that would be difficult.  If you know the final polygon shape ahead of time, you may be able to reverse-skew the image so that when it is skewed it will look normal / unskewed.
I even tried to shift the tx coordinates, but that causes a loss of image data on the poly, skewing the image out of the polyvector map.

Im coming to my own conclusion here;
How opengl fits all the colors together, is probably not very math intensive for the sake of gpu speed.

Which gives me an idea, a rough draft so to say..
Perhaps sprite2mem, and rebuild the image in a mathematically correct way....this would require good equipment to draw alot of these(im assuming), cpu and gpu intensive.

Bing ChatGpt is pretty smart :O