View unanswered posts | View active topics It is currently Fri Jul 28, 2017 2:35 am



Reply to topic  [ 2 posts ] 
 Rotation matrix will magnify your manufacturer logos 
Author Message
User avatar


Joined: Fri Jan 01, 2010 4:02 pm
Posts: 468
Post Rotation matrix will magnify your manufacturer logos
Hi there,

I've recently came across Herbal's Manufacturers logos and after my first thought that was "it's a great thing that will fit into my Packs" an idea came to my mind.

You know, it's rather time-consuming and kinda irritating process to make a decent logo situated exactly in front of the camera eye (in the "standing" position) manually. Actually, the easiest way to make logo is to make it flat, with Y coordinate set to zero (roughly). That's just how, for example, already mentioned Herbal's logos were made, then in the main menu they look flat.

Despite their flatness, they surely make a very worthy addon. However, with use of some basic linear algebra, every logo, including these you might want to create in the future on your own, might look even better. :misch:

In order to raise a flat logo to make it stand as it should, you need to find a suitable linear map. In this case, we need to (some spatial imagination required :rofl:) rotate the logo by 45 degrees in the Y=0 plane (names of axis might be confusing, Car Editor doesn't use the standard basis of the 3-dimensional linear space, so directions are different. Briefly speaking, X - width, Y - height, Z - length) and then rotate it again by 45 degrees around x=-z line. Yay, now our logo lies on the plane defined by equation: x+y+z=0 (with normal vector (1, 1, 1) pointing at camera eye).

Now it's time to find a matrix of this map. I did it already and it looks like this:
Code:
      | 0.707    0.5      0.5  |
  M = |    0     0.707  -0.707 |   (where 0.707 is sqrt(2)/2 actually, but we don't need such precision of course)
      | -0.707   0.5      0.5  |

It's called rotation matrix. What can we do with this? Let v=(x, y, z) be vector representing a vertex, with its XYZ coordinates. And every kid knows that if we multiply M*v we will get the output vector representing our output vertex. For example:
Code:
      |  0.3 |          | 0.707    0.5      0.5  | | 0.3  |    |  0.4271  |
  v = | 0.03 |    M*v = |    0     0.707  -0.707 | | 0.03 | =  | -0.26159 |
      |  0.4 |          | -0.707   0.5      0.5  | | 0.4  |    |  0.0029  |

So the vector u=(0.43, -0.26, 0) is the image of v in our linear map (the rotation). Follow this procedure with all of your remaining vertices and you'll get a beautiful, standing logo ;)

And the final comparison:
Attachment:
logos.png
logos.png [ 3.34 KiB | Viewed 6037 times ]

EDIT:
Actually, leaving 0.707 instead of sqrt(2)/2 was not very wise either, 0.7 will do the work with the same effect, so you know what to do. ;)


Last edited by Lorenzo on Mon Nov 09, 2015 1:41 am, edited 2 times in total.



Sun Aug 23, 2015 10:50 pm
Profile E-mail
User avatar

GeneRally Carmaster

Joined: Sat Dec 26, 2009 7:52 pm
Posts: 1800
Location: Budapest, Hungary
Post Re: Rotation matrix will magnify your manufacturer logos
That is a great find, Lorenzo! I wish I could have find that out by myself (since I've learned some vector calculus, after all), but it's still a great feeling to be a base for that kind of ideas. ^^

EDIT: 0.7 should be enough, you don't need to be that precise with square rooting.
RE-EDIT: Now do I see, that you've seen that too. ^^

_________________
Founder and ex-administrator of GeneRally International Forum
Räbinä Awards: Competition organizer 2012, Carmaker 2014
My racing career, my tracks, and my cars
Thousand Point Knockout - coming soon!


Sun Aug 23, 2015 11:01 pm
Profile E-mail WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.