Jump to content

Rendering Normal Maps?


Recommended Posts

Hey Guys!

In a recent demo vid on how Houdini can be used in games, they showed how ocean fx can be used to create normal maps for fluid. 

at 7:46

I'm just wondering, how do I render the normal map? 

So far, I unwrapped my grid, and used polyframe to get my normal, tangent and bitangent. But I'm unsure on how to get the colour to reflect the correct values.

From a lot of reading, it looks like I have to  orient my current normal to turn it into tangent space? I've given it a guess, but it doesn't look right. 

My next step is then how do I bring this into COPS (what it looks like he's using) to save the normal map out? 

Thanks a lot!



Link to comment
Share on other sites

  • 5 weeks later...

You don't have to do any tangent space transformations here, with ocean surface. Idea of tangent space is, roughly, "looking along depth", like in camera space. Lifehack-solution for cases like rendering of sprites or planes. Just use object space normals from geometry oriented along depth axis. See fix scene. Don't forget to fit vectors from -1..1 to 0..1 range. By the way, isn't it just object space normals? With double gamma correction, probably. Normal maps should be in gamma 1.0 to have correct numerical values of vectors.


To render a real normal map, sample object space normal, then multiply it with an inversion of tangent space basis (matrix3 of tangent, bitangent and normal) to get tangent space normal. It is good idea to compute this matrix beforehand, instead of constructing it inside vops. Less nodes, less ways to shoot yourself in the foot. Vectors must be normalized, properly transformed into same space, basis must not be broken by sop-level transformations, etc. Here an example of baking tangent space normals and color textures using Mantra and pig head. Snapshots are from Unreal Engine 4. Green channel set inverted. It can be synced with target engine by transforming tangent space.






UP: this stuff was for H14 where baking tangent normals was an interesting task. Now with H15 some workflows in pighead example may be outdated a bit. But not much.





Edited by f1480187
  • Like 2
Link to comment
Share on other sites

The gradient COP in H15 can produce a tangent space normal map from a height map, as well (Gradient type: Displacement, Output: Normal Map, adjust Scale parameter to fit the displacement scale). It's very important to make sure both the loaded displacement map and the saved image are loaded/saved as Linear, especially if they're in an sRGB format like JPG, tiff or PNG.

Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...

Hi guys !

i would be curious to know , what is now the proper workflow to compute a tangent space normal map for UE4.

I have try the new H16 ROP bake texture, but the normal map i get looks broken compare to what i get in substance ?




To solve the pb you must install the last Game Dev Tools Shelf 


Beware to switch the GitHub Branch to Development before download.


And use the ROP Game Baker


Edited by sebkaine
Link to comment
Share on other sites

Mantra's TS should be very close to MikkTSpace, with small artifacts on UV seams (if they weren't fixed in the last year). Normal maps baked in Mantra should look correct, with possible channel reversing. Houdini is +X right, +Y up, -Z forward; UE4: +X forward, +Y right, +Z up, also it is depends on baking material.

Make sure texture node inside UE4 material has Sampler set to Normal Map. If it wasn't automatically set, there are chances that texture wasn't imported and compressed as a normal map too: check asset settings and compare with normal maps from Starter Content.

When everything is correct, NM will look very nice, smooth and seamless. If it looks "moderately good" and shading reveals very distinct seams, probably, the NM still not set correctly or it was baked with very different tangent space.

Edited by f1480187
Link to comment
Share on other sites

Thanks a lot for the extra info guys ! i will push that further.

From my test for occ / height / N / thickness beetween high / low substance is just the best tool in term of speed.

But houdini shine to export all the exotic stuff you want.


As a side note i was using an old H16 release, i have update it and you now have a MikkTSpace option in the rop bake.

Link to comment
Share on other sites

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.

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.

  • Create New...