Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Calculate diminished perspective
Started by developer536 Oct 14 2014 02:14 PM

No replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

developer536

[GLOBAL: userInfoPane.html]
developer536
  • Observer

  • 3 posts
  • Enterprise

Hi Guys,

 

Hoping someone can help with some formula's.  I'm creating some perspective graphics with the 2.5d path functions.

 

I'm trying to calculate something fairly simple, a 1 point perspective checkerboard/scrollibg path.

 

I.e. its a path vanishing into the distance but I need to calculate where to put the checkerboards so that they size correctly.  This is similar to a railroad track and where to put the sleepers etc.

 

I'm trying to do this so I can scroll the path along the perspective so I need to know what percentages to move it by so it appears size correct (i.e. objects further away are smaller as well as squished)

 

This is nothing new and I've read plenty of articles about it.

 

I get the concepts and I'm not new to programming, however I am an idiot when it comes to maths.  I understand the ideas behind matrices but could never really get my head around them.

 

What I'm after is a formula that shows where an object of a given size, lets say 100x100 would appear to start and end when placed into certain perspective.

 

The 2.5d functions will skew it correctly, but in order to scroll it I need to know how much to change it as it comes towards you so that it appears to move correctly.

 

If you see the attached screenshot you can see my (obviously) wrong calculations based on linear assumptions.

 

The vanishing point remains true but the object in the foreground should be much bigger, but I don't know how to calculate by how much.

 

Based on all the articles I've read it doesn't look that hard, I know how to calculate an angle between two points, which should let me draw a line to the horizontal of the vanishing point which in turn give me the horizontal of my first box etc, but that's the extent of my maths ability and I don't know how to formulate that.

 

Any help would be appreciated.

 

Apologies in advance if this has been covered and I've missed it.

 

 

Attached Files




[topic_controls]
[/topic_controls]