Jump to content

Perspectival shrinking of 3D text


rain_gloom

Recommended Posts

Could someone help with the math here?

If I have a line of length 'a' and it is 'd' distance away from the camera, how do I calculate the perspectively correct size on screen? I checked existing 3d text resources, but the only method I found is incorrect and I don't know what to google. ._.

(Part of what I'm trying to do is to replicate the "effect" system of the game "XIII", that's why I want it to be this way)

Link to comment
local fontSize = 2 -- the original text size 
local dist = getDistanceBetweenPoints3D ( x, y, z, x1, y1, z1 ); -- Set the distance with getDistanceBetweenPoints3D\ 
local allowedDistance = 13; -- The max distance you can be to see the text 
local scale = fontSize * ( ( defdd - dist ) / defdd ) 

(Formula taken from the following resource)

https://community.multitheftauto.com/index.php?p= ... ls&id=3090

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...