# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### DarkBASIC Professional Discussion / Incorrect Normals render

Message
Posted: 17th Feb 2016 15:17 Edited at: 17th Feb 2016 15:18
I get this weird seam in my Normals

matrix WorldIT:WorldInverseTranspose;
float3x3 TBN={IN.Tangent,IN.Binormal,IN.Normal};
float3x3 wTBN=mul(TBN,WorldIT);

so I cant guess which cause this
I find some ways to compute tangent entire in vertex shader but
I get totally different render with them
float3 Tangent=float3(IN.Normal.y-IN.Normal.z,0,IN.Normal.x);
float3x3 TBN={Tangent,cross(IN.Normal,Tangent),IN.Normal};
Posted: 4th Apr 2016 15:33 Edited at: 4th Apr 2016 15:33
Did you ever get this sorted out? If not could you post a simple demo so I can take a look?

Posted: 5th Apr 2016 14:43
Hi GG !
Setting optimize in panda exporter to: "Normal" help a little bit
But to have really good normals in round surfaces I need to create custom normals and
write them to uv layers.I didnt do this yet
Here is technique:
Posted: 5th Apr 2016 15:04
Seams like those in your screenshot usually arise when your model isn't welded so adjacent faces each have separate normals on their coincident vertices. One solution is to calculate some sort of average over all normals at each shared vertex (and renormalized of course). The coding details are somewhat messy although straightforward in principle. I'm not convinced that article will help you very much.

Even a welded model will have an annoying seam in some situations - DBPro spheres for example have a North-South seam which causes problems for normal mapping (because the tangents are not calculated correctly along the seam). Most of my normal mapping shaders now have an option to reduce or even remove such seams.

Posted: 5th Apr 2016 15:36
Quote: "to calculate some sort of average over all normals at each shared vertex"

exactly
Quote: "Most of my normal mapping shaders now have an option to reduce or even remove such seams."

You mean calculating tangents inside vertex shader?
Posted: 5th Apr 2016 16:25
Quote: "You mean calculating tangents inside vertex shader?"

Not quite - more of an ad hoc smoothing as in the extract below:

If I recall correctly that particular fix was suggested by Paul Johnston - although I usually use a slightly simpler variant of the same idea. But that fix assumes the normals are calculated correctly.