Author Topic: Problems with normal maps, possible coding issue.  (Read 2238 times)

0 Members and 1 Guest are viewing this topic.

Problems with normal maps, possible coding issue.
I have been having "issues" with normal maps and being symmetrical. 

After doing some testing I've found that if the two symmetrical sides are touching AND if you've flipped (via manually or through symmetry modifier) the uvmap then you'll get an odd normal error.

Instead of having the shine appear uniformly over the entire plane, it'll just appear on one half of it and never on the other. Now if the uvmap isn't flipped or the one side as a totally different uvmap section then everythings ok.  Or if it is flipped and neither piece is touching then it's also ok. 

And no, according to Keldor symmetrical normal mapping is suppose to be supported correctly (don't remember if it's tangent space or object space).

I'll upload the sample model to those who need to see the error.
« Last Edit: April 06, 2009, 10:17:57 pm by Scooby_Doo »
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: Problems with normal maps, possible coding issue.
Or you can look at most of the mediavp models in F3 (Deimos, Amazon Adv to name two off the top of my head) to see it in action.

Quadratic lighting makes it look REALLY nice. In F3. Don't play with it though.. *shudder* Unless you like being blind.

PITA, but the recommendation would be: don't symmetrically flip/mirror UV faces or the normal.

See, the shine factor probably IS there.....and it is probably facing IN to the model. But I could be wrong on that.

Good example of that idea (if that is in fact the case) is the nameplate on the Aeolus.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the FSU on #SCP-FSU Talk with the SCP on #SCP
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 
Re: Problems with normal maps, possible coding issue.
Keldor believes its something to do with the vertex normals not being correct.  And it's not a shine map issue, turn off normal map and the problem goes away.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Problems with normal maps, possible coding issue.
taylor mentioned something about this some time ago.

Basically it's related to how the majority of models uses mirror symmetry on their UV maps, which means that moving from starboard side to port side, the normal map's normals information needs to be reversed, because if you just mirror the normal map like a normal texture and light still comes from the same direction... it's going to make bumps on one side and recesses on the other side of the ship.

Making the shaders deal with the mirror symmetric UV coordinates correctly requires tricky magic (I don't know how many goats have been sacrificed) and has an unfortunate result of causing that little specular lighting problem.*

Good thing is that it's only really visible on large, flat and shiny surfaces, and majority of FS2 ships with large surfaces also has relatively dark shinemaps.


*Although I don't know if it's the shader system in the engine that does this or the shaders themselves.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: Problems with normal maps, possible coding issue.
Keldor believes its something to do with the vertex normals not being correct.  And it's not a shine map issue, turn off normal map and the problem goes away.

Sorry, I did not mean to confuse. I know the problem is not inherently with the shine map. I am saying that the effect is somewhat shine related because, as Keldor mentioned, that the vertex normals not being correct. I was trying to say that the appropriate effect is probably facing inwards on the problem side, not outward. And the side that is facing outwards is having issues when glFrontMaterialShininess is being applied/calculated.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the FSU on #SCP-FSU Talk with the SCP on #SCP
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 
Re: Problems with normal maps, possible coding issue.
Ya he mentioned that with one of his custom shaders, the vertex normals don't look quite right.  Also in one of my testing with two symmetrical object connected with each other, but using seperated vertices (i.e. two vertices on the same spot, one for the left side, other for the right side) the issue still shows up.  I'm wonder if PCS2 is combining the vertices into one.  :confused: Perhaps thats where the vertex normals are getting messed up in.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 
Re: Problems with normal maps, possible coding issue.
Oh yuck, well this definetely complicates things badly.  :sigh:
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Problems with normal maps, possible coding issue.
this is a major problem for nukemod too, since many of my ships were made in the pre-normal-map era and i tend to use a lot of uv mirroring. so normal mapping old ships usually comes with a remodel. a way around this is by using a second uv mapping channel. you would need to use something like max automatically reorganize your uv space into a second mapping channel then you can mirror the **** out of everything in the first chanel, and in the second have every polygon get a dedicated set of space. then somehow use channel 1 for some textures and channel 2 for others, ect. its a big can of worms to open, would require a materials system, many pof upgrades, and some more render code.

i would gladly sacrifice a few goats for this, maybe even a virgin or two.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 
Re: Problems with normal maps, possible coding issue.
* Scooby_Doo hands Nuke a few goats....
Now virgins might be harder to find  :lol:


Actually I kinda found a workaround.  Separate the sides by a very tiny tiny amount.  Create a polygon between those two sides (if your using Max the edit poly's bridge tool works wonders).  Apply a unique uvmap texture to it (it doesn't have to be big or any details, it's just a sliver).  Make sure it's smoothed with both sides.  You'll get a hard line when just viewing normal maps, but begins less visible if you add in shine maps and when viewing with everything (including diffuse) the sliver is practically invisible.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 
Re: Problems with normal maps, possible coding issue.
Sorry, that hack doesn't seem to work in-game.  It looks great in the F3 viewer, but definetly not ingame.

You can see exactly where the symmetry is done
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Problems with normal maps, possible coding issue.
I'm wonder if PCS2 is combining the vertices into one.  :confused: Perhaps thats where the vertex normals are getting messed up in.

it does, this should not be an issue though, due to the vertex/index buffers getting rebuilt for every model in game.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Problems with normal maps, possible coding issue.
are vertex normals stored at the vertex level or the polygon level? using the latter meathod would probibly allow us to mirror to our hearts content without inverting the bumps. unless of coursei completely misunderstand the concept of tangent space.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 
Re: Problems with normal maps, possible coding issue.
Keldor found the issue. Apparently it's a shader issue. 
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

  

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: Problems with normal maps, possible coding issue.
:bump:
I've found a bit of a workaround for this problem.  You can move the UV coordinates for one half of the ship up above the coordinates for the other half of the ship, like I did below.  Then, the problem should be gone, or at least unnoticeable.

It's not perfect, but it seems to work fine; the seam in the center is slightly visible if you look closely enough.

BTW, will this be fixed in the FSO shader set in the future?
« Last Edit: June 13, 2010, 12:07:37 am by Talon 1024 »
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 
Re: Problems with normal maps, possible coding issue.
One problem with that... at least with Saga's shaders is nothing should go beyond (0,0)-(1,1).

But I like the solution though.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"