BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

custom normals

4 posters

Go down

custom normals Empty custom normals

Post by mobile1 Sun Mar 02, 2014 11:11 am

Hi all, does anyone have any info on custom normals, the official openbve site at the moment is just machine code or something similar...many thanks   mobile1
mobile1
mobile1

Posts : 136
Join date : 2011-08-22

Back to top Go down

custom normals Empty Re: custom normals

Post by Dexter Sun Mar 02, 2014 11:16 am

Basically the normals define a vector for the ambient light... they define the direction, in which the light "touches" the surface (the give AddFace command) of your object.
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

custom normals Empty custom normals

Post by mobile1 Sun Mar 02, 2014 11:21 am

thanks Dexter, i have been in touch with Leezer3 on this subject, the cab roof and front dome on a class45 loco i am working on is a bit scrappy looking, custom normals has made a vast improvement so i would like to know more about it, i am particularly interested in what the used numbers represent.....
mobile1
mobile1

Posts : 136
Join date : 2011-08-22

Back to top Go down

custom normals Empty Re: custom normals

Post by Quork Sun Mar 02, 2014 11:46 am

"Normal" is the 3D-aequivalent for "orthogonal": That's a line standing at right angles to a surface. This normal is defined as a vector in CGI, with three coordinates x, y and z.
Obviously, the surface as such (meaning the body itself) is defined by the vertices and always flat: However it is possible to shade a flat face as if it were curved. That's what you define by the normal vectors. If you have a square lying flat on the "floor", it normally is shaded in one colour, since the default normals are automatically perpendicular to the real face. You can however define custom normals showing in other directions. If you define them to show outwards, lying on the "floor" and pointing along the diagonals of the square, the 3D representation of the square will still be flat, but the shading will be as if it were a half ball.
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

custom normals Empty custom normals

Post by mobile1 Sun Mar 02, 2014 1:47 pm

Thanks for that explanation Quirk, that  explains very nicely what custom normals does....I assume that the  first of  the numbers relate to which side to shade, what do the middle and last numbers relate to...?  Many thanks
mobile1
mobile1

Posts : 136
Join date : 2011-08-22

Back to top Go down

custom normals Empty Re: custom normals

Post by Quork Sun Mar 02, 2014 2:07 pm

No, as I said, normals are defined as vectors. Using vectors is usually part of the mathematics curriculum in school, so I hope you'll remember them after reading this short article: http://www.mathsisfun.com/algebra/vectors.html Especially from the sub-title "More than two dimensions" on it's relevant.
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

custom normals Empty custom normals

Post by mobile1 Sun Mar 02, 2014 2:20 pm

Hi Quork,  please understand at almost 70 some of the things that the younger generation grasp quickly, gives us oldies trouble...i don`t remember my school days, if we were ever taught what you suggest, then its been forgotton long ago....I do struggle with some of the current usage of mathematics, I think I need an idiots guide to most things these days, as i said i understood what custom normals does and how it does it, but if you have time, perhaps you could go that little bit further...many thanks...
mobile1
mobile1

Posts : 136
Join date : 2011-08-22

Back to top Go down

custom normals Empty Re: custom normals

Post by Quork Sun Mar 02, 2014 2:49 pm

I understand your problem, but I fear I'm not really able to explain it any plainer than it's written in the article I linked... Hm. Let's try anyway.
Take this image from the article: http://www.mathsisfun.com/algebra/images/vector-3d.gif
The black arrow labeled "a" is what you want, that's the vector. It shows way upward, way to the right and a little bit towards yourself. The three coordinates of the vector are just that: az defines how much the vector goes upward, ay how much to the right and a[size=10]x[size=13] how much towards you[/size][/size]rself. Just keep in mind that for BVE-formats, x is right/left, y is up/down, is front/back (from you/to you). You could put it this way:

- for the normal vector, the origin (0, 0, 0) is always the modified vertex' position, wherever the vertex might really be
- the normal vector is the line starting in its origin (the modified vertex' position) and ending at a point you define by the three parametres
- this means the first parametre defines how far the vector goes to the right, the second how far up and the third how far along the track

If you, for example, want a vector going dead ahead, it is (0, 0, 1). If you want it to go straight upward, it's (0, 1, 0). If you want it to go left and upward at a 45 degrees angle, it is (-1, 1, 0). Or if you want the same, but with a 30 degrees angle, it's (-2, 1, 0).

Since you aren't really familiar with vectors any more, angles will probably be better understandable for you. So let me explain the vector concept starting from angles. Let alpha be the clockward angle between the track direction and the vector direction; so alpha=0 is dead ahead, alpha=180 is dead behind and alpha=45 is right and ahead. Let beta be the angle between the ground plain and the vector direction. So beta=0 is lying on the ground, beta=90 is straight upward, beta=-45 is a downward slope of 45 degrees. Then you can transform those two angles to a vector like this:
(sin[alpha], cos[beta], cos[alpha])
The whole term in the b3d file is then:

[MeshBuilder]
Vertex right/left position, up/down position, front/back position, sin[alpha], cos[beta], cos[alpha]
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

custom normals Empty custom normals

Post by mobile1 Sun Mar 02, 2014 3:00 pm

Hi Quork, thanks for understanding, my wife does wonder sometimes why i am bothering with openbve and its associated goings on, but as i explained to her, i build the route files and objects for my pleasure and to keep my mind active, if others use them , then i am glad........

back to the question....the sentence

"If you, for example, want a vector going dead ahead, it is (0, 0, 1). If you want it to go straight upward, it's (0, 1, 0). If you want it to go left and upward at a 45 degrees angle, it is (-1, 1, 0). Or if you want the same, but with a 30 degrees angle, it's (-2, 1, 0)."


explains everything i need to know at this point.....many thanks for your co-operation..


.p.s. .now you know why my  produced routes are based around the 70`s....regards
mobile1
mobile1

Posts : 136
Join date : 2011-08-22

Back to top Go down

custom normals Empty Re: custom normals

Post by Quork Sun Mar 02, 2014 3:05 pm

No problem, I'm glad I could help!
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

custom normals Empty Normals

Post by gyzma Thu Mar 06, 2014 5:47 pm

Using the normals leads to better results. Roof, for example. It is smooth;-)
Attachments
custom normals Attachment
normals1.jpg You don't have permission to download attachments.(98 Kb) Downloaded 21 times
custom normals Attachment
normals2.jpg You don't have permission to download attachments.(54 Kb) Downloaded 17 times

gyzma

Posts : 12
Join date : 2011-07-08

Back to top Go down

custom normals Empty Re: custom normals

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum