Jump to content

Is there Support for Object Space Normal Maps?


mr_pinc
 Share

Recommended Posts

From my technical artist:
 

our typical project showcases a very complex mechanical object, or set of objects.

we are constrained by draw culls and by content size in megabytes, due to the fact that our app needs to download quickly even with a mediocre connection speed.

since the amount of pieces in our objects is high, the triangle count we can afford per piece has to be minimal. what makes matters worse is often most pieces have unique shapes, so instancing does not completely solve the problem.

we are using normal maps to fake some details, but we run into the common issue of lowpoly geometry smoothing which produces visual artifacts. we can provide examples later if required; but just think of your keyboard which has no definite smoothing seams, but lots of smooth angles and bevels, many of which have to have a geometrical representation in addition to pixels.

 

utilizing the normal compensation approach we can bake the geometry smoothness data, invert it, and combine with the normal map to restore the visual smoothness where required (check handplane.com for some nice examples). we are also averaging the geometrical normals to reduce the artifacts.

but this can only take us half-way, since this approach does not always work 100%. in such cases, using object-space normal map instead would give us full control over the look of our assets - and those arealways either static, or animated on object level.

of course the same could be achieved with world-space normal maps, but this would result in wrong visuals for instanced objects (think of two instanced bolts facing different directions); thus we would have to revert to unique meshes with unique UVs and correct world space normal data in the texture.

 

the cost of one extra channel does not seem too high (meaning we could use B of tangent space normal map for storing something useful, and that of course would not be possible with OS or WS). the precision difference would be negligible as well. we are also not using any detail normals currently, so combining normals would not be an issue. 

now, we understand that adding the OS option could lead to refactoring in many unexpected places. but we keep our hopes up.

 

The attached image  is for illustration purposes only - example of smoothness artifacts resulting from geometry; adding tangent-space normal map here would not hide the issues completely.   this asset in general also illustrates how the artist had to introduce numerous hard edges across bevels to preserve the smoothness. this introduces a lot of sharp lines where things need to be smooth, and adds extra cost to geometry, multiplying the number of verts to be exported

 

smoothness.jpg

Link to comment
Share on other sites

right now you're taking normal of the triangle. the missing step (which would be optional with default == false) would rotate this normal based on object pivot or world

it would be in this section:

 

// get edge vectors of the pixel triangle
vec3 dp1 = dFdx(p);
vec3 dp2 = dFdy(p);
vec2 duv1 = dFdx(uv);
vec2 duv2 = dFdy(uv);
 
// solve the linear system
vec3 dp2perp = cross(dp2, normal);
vec3 dp1perp = cross(normal, dp1);
vec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x;

vec3 bitangent = dp2perp * duv1.y + dp1perp * duv2.y;

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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