English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Graphics (https://eab.abime.net/forumdisplay.php?f=140)
-   -   Perspective projection and long straight lines. (https://eab.abime.net/showthread.php?t=104996)

Ernst Blofeld 13 December 2020 16:10

Perspective projection and long straight lines.
 
3 Attachment(s)
I'm adding ground level scenery into the project I started over lockdown 2.

I'm drawing my first object, a runway, 1.5km long and 30m wide.

When doing the standard perspective transform on the four corner points of the runway (positioning my camera a bit above the centre point of that runway), things "work", but the straight edges from corner to corner result in a runway that's "skinny" at the middle. I guess this is to be expected, but I didn't appreciate how severe the effect would be.

If I divide the runway up into many segments, calculate and draw them individually, I can get a more realistic runway, but with a side effect that it can appear "bendy" if looking at it from the side. Which is probably actually realistic?

So, I think this is how things work, if you're transforming only the vertices and drawing lines between them, then the lines won't be accurate to curves that would happen in real life as the edge passes around and behind you.

The thing is, I don't recall ever seeing these effects in the games I used to play, so were they doing something different, or was I just not observant as a teenager?

Edit, added two more images, one where the runway is a simple rectangle, trying to get the same angles, and another showing how things start to go wrong - the aircraft and its shadow are no longer centered over the runway.

Ernst Blofeld 14 December 2020 16:43

1 Attachment(s)
Thanks everyone, I've now got the runway and everything else including shadows drawing correctly without any weird effects.

But now that I can test my code further I have other strange glitches that I really can't be bothered trying to chase down. Will probably go outside instead.


All times are GMT +2. The time now is 04:58.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04846 seconds with 11 queries