When normalmap is exported from 3dsmax, the "correct" Algorithm of the tangent vector

Source: Internet
Author: User
Currently, many tools can directly generate normalmap. Algorithm Different algorithms make the calculation of tangent and binormal a little different. Currently, most artists use 3 DSMAX most often. Using Max to generate normalmap is also a common and convenient method. However, at present, there seems to be little information about how to calculate the tangent vector when exporting normalmap from Max. The document and example of Max say that this is also invisible, I believe that many people may encounter a little trouble when calculating this item, resulting in the display being "almost correct ". The correct calculation method should follow the steps below:
The tangent, binormal, and normal operations of each plane are calculated based on the three vertex coordinates and UV coordinates of each plane.
Then, when Max generates a normalmap, the tangent of this point can be superimposed on these faces only when a point is "smooth" transition on some faces. For normalmap, there are three necessary conditions for a "smooth" transition between two sides:
The first two sides of the smoothgroup must be equal, that is, the two adjacent smoothgroups that share the vertex must be equal (if the model does not have a smoothgroup in Max, it is considered to be a separate group of smoothgroup, if there are multiple groups, each group should be considered, but each side can only be calculated once when adding a vector ).
Second, the UV of the two faces at this point must be continuous, that is to say, the UV of the two faces at this point is equal, because the data structure of Max is to index different vertices and Uvs by surface, so the UV of the same vertex is sometimes different. If the uv is different, normalmap is not continuous here.
Third, the direction of UV must be consistent, and the UV between the two sides must be both forward or reverse. Because tangent and binormal each represent the u and v directions of the texture, and normal is only determined by smoothgroup, we can use two sides of tangent, whether the value of the determinant composed of binormal and normal is the same number to determine whether the direction is consistent.
If a vertex is adjacent to a certain surface and meets the preceding three conditions, then the tangent vector of this point must be superimposed by the tangent vectors of these faces (normal only needs to meet the conditions of smoothgroup equality), otherwise it cannot be superimposed.

Obviously, since normal is different from tangent and binormal, some vertices are generated after calculation in most cases.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.