Kylawl

Hey,

I've been tyring to track down a couple problems I've been having with rendering normal maps.

First of all, I have these shaders that I have programmed previously that take a tangent space

normal map and function 100% correctly. If I move those shaders and normal maps onto an

object in Game Studio I find a number of issues. The normals in the normals map seem to receive

the light from the wrong directions, the flat surface areas are lit correctly though. So I was

wondering if which directions the normal map need to be, Red left or right, Green up or down.

I've tried a number of different arrangements and orderings of my Normal, Binormal and

Tangent matrix.


The second problem is I find that the Binormal and Tangent data changes direction a few

seconds after the game starts.

I'm wondering if these 2 problems are related, any help would be awesome.

Thanks





Re: Game Technologies: Graphics Normal Map colour directions.

Jack Hoxley

Kylawl wrote:
If I move those shaders and normal maps onto an

object in Game Studio I find a number of issues.
Are you sure that Game Studio is using the same algorithm Is it definitely reading the texture in as the same format (BGR vs RGB formats would screw things up for example). Remember that normal maps don't have to be in tangent-space, its just that they're the most common - if the algorithm is expecting object-space normals then you'll get strange results by feeding it tangent-space normals.

Kylawl wrote:
So I was wondering if which directions the normal map need to be, Red left or right, Green up or down.
I wouldn't think too much about the colour - just that red=x, green=y and blue=z (in conventional implementations). If you're getting incorrect results it's probably not the encoding (except in the aforementioned format case).

Kylawl wrote:
The second problem is I find that the Binormal and Tangent data changes direction a few seconds after the game starts.
This doesn't sound at all right! the n/b/bt should be as constant as the texture coordinate information - unless they change the TS basis vectors shouldn't...

I recommend putting on your debugging hat and getting to the bottom of these vectors changing direction - that sounds more like the root cause to me.

hth
Jack






Re: Game Technologies: Graphics Normal Map colour directions.

Kylawl

The shader algorithm I'm using is defiantly supposed to be used for tangent space normal maps. And they are what I want to use, now if for some reason Game Studio does not support that type of thing then thats a different issue. As far as the format being BGR instead of RGB, I do not think thats the case otherwise my color maps would be incorrect because they are using the same format..

The one I suppose i need to track down is the why the various vectors seem to be changing. I'm not sure how easy that is going to be.

Thanks
Kyle




Re: Game Technologies: Graphics Normal Map colour directions.

Kylawl

Is there a tutorial or a source sample kicking around somewhere that I can take a look at to see what I am doing different




Re: Game Technologies: Graphics Normal Map colour directions.

needforhint

The second problem is I find that the Binormal and Tangent data changes direction a few

seconds after the game starts.

maybe you are forgetting (this word does not exist for example) to normalize the normals to your coresponding tangs and bis. So it is done automaticly at some point. might be