Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: Normal mapping  (Read 5679 times)

hope

  • Newbie
  • Posts: 3
  • newbie
Normal mapping
« on: January 03, 2016, 08:01:38 am »

Hello!

As some of you might know, I'm working on a procedural planet experiment in WebGL.

I would like to ask a few questions on normal mapping, about in which space it's best to calculate the normal map for better precision. I've noticed a lot of people run into precision problems because they calculate the normal map in either world space or object space. I know it's probably best to do it in tangent space, but that's where I get confused.

Currently, I'm generating a position map for each patch, which is basically the height map in the planet's object space (assuming the planet is always located at (0, 0, 0)). I'm aware that I will lose a lot of precision that way, so I'm trying to find a better solution.

I've found one neat solution from Acko's blog, http://acko.net/blog/making-worlds-3-thats-no-moon/
The source code behind the normal map shader: https://github.com/unconed/NFSpace/blob/master/Resources/Media/Planet/Materials/normalMapper_FP.glsl

The normal map is basically calculated in tangent space using Jacobian matrix. I think I understand most of the math explanation but the implementation part looks confusing, specifically the face transforms and the two coordinate systems, xy and st.

I would love to hear from others on how they solved generating the height map in tangent space. I've seen so many people say it's really hard because of seams between cube faces. Is it really that problematic?

Thanks!
Logged

montify

  • Jr. Member
  • *
  • Posts: 10
  • newbie
Re: Normal mapping
« Reply #1 on: January 03, 2016, 03:56:25 pm »

Use Sobel Filter 

Find good Shadercode in google


And for Heightmap, you need a 3d Noise implementation. so every Vertex of the cube have a unique 3d Vector = No seams between the cube Edge.
Logged