tangent space is made of three vectors (normal, tangent, bitangent). You create the bitangent with the crossproduct, however this vector can have "two sides". Hence when people dont send bitangent explicitly they encode side into tangent.w (-1 or 1) and multiply binormal after cross product with it.
I get it nearly fixed and ok for the project. Unfortunately i didn´t have the time to implement a specualar shader and painting a specmap. Maybe after the finish for the university. A lot of stuff to write now.
Here is an ingame shot with different shading styles i tried to implement. At the moment i´am working on the animation blending between idle and walk...both are working well, but i don´t have a proper blending between them at the moment.
@Crazy, naja ist ja kein richtiges Game Projekt. Eher nen Prototyp, in dem der Char dargestellt wird und man mit ihm rumlaufen kann. Inklusive Animation etc... das Ganze funktioniert ja auch inzwischen ganz gut....aber übernommen hab ich mich mit dem ganzen schon etwas...
I thought i solved the problem in setting the right lightdirections in the shader. I implemented a chaseing cam, but now i realised that if i moving my char in the positive z direction. after passing the cam in positive z space the normals for some parts are flipped.
If i move my char back towards the origin and in negative z direction, after passing the chasing cam, everything looks fine again. But the further i move it also from postive or negative x-direction and postive z space everything looks fine. Just at the near postive z direction and a little bit of x or -x direction are working false. I tried to use just 1 light and the same problem occurs with 1 light direction.
//***********************************************************************
//*********************** Pixel Shader **********************************
//***********************************************************************
//Basis Normalmap - PixelShader mit Farbtextur
float4 PSNormals(VS_OUTPUT input) : COLOR0
{
//Colortextur als Diffuscolor des Normal-Shaders
float4 outColor = tex2D(C_Sampler, input.TexCoord);
// die Multiplikation mit 2 und die Subtraktion von -1 erweitert den Bereich der Normalen von -1 bis 1
float3 normal = 2.0 * tex2D(N_Sampler, input.TexCoord) -1.0;
// diffuse Lichtberechnung
float diffuse = saturate(dot(normal, input.Data1));
return outColor * ( diffuse);
}
I also try to use the tangents, normals, binormals directly, but this doens´t change anything in the problem with the flipped normal map:
After all the problems discovered, i took a closer look to the rotated parts of my mesh on the normalmap. Correct me please if i´am wrong, but it seems that the only problem is the wrong lighting of normalmap:
Any idea how i could flip parts of my pieces within photoshop? Not all parts are seperately, if i want do this, i had to cut out the wrong lit pieces an flip the channels of the normal map an then paste back at the same postion but how could i do this in photoshop. (i mean flipping the channels) And could this only done with the whole image or is it possible to do this only with a layer...
...it seems that the only problem is the wrong lighting of normalmap:
...Any idea how i could flip parts of my pieces within photoshop?
Generally you don't want to do this, because of the way normal-mapped models are lit. If the shader is written properly, it will rely on the tangent basis of the model which determines the color/lighting directions that are baked into the normal map.
If you change these colors, they won't match the tangent basis anymore, and you'll get worse lighting. You need to talk with the programmer who wrote your exporter and figure out if they're exporting the tangent basis properly, and if they're in turn using it in the shader.
Always the constructive one eh, Odium?
As a few people have pointed out, the proportions don't work, but Art1977 has mentioned he had to finish this on a deadline, so he couldn't go back and change things. If you'd read the thread, you'd see that he had to do a lot more than just model the character.
I could completly finish and overwork the charakter after finishing the thesis. At this point i ´ am quite satisfied with the result and get everything worked and implemented. It was a lot of stuff to do.
Just to learn everything vom scratch. Modeling, Zbrushing, Textureing, Rigging, Animating and also to learn c# and xna and m3g and java and to get everything working....
Now writting the whole documentation. At the moment i have 80 pages of just theoretical stuff about the whole process.
Art: I think you should be really happy with your results. It is a crazy amount of stuff to finish in the given amount of time, and considering it was a first for all of it, its pretty awesome really. Keep it up, I can't wait to see your next project.
Replies
Or you feed bitangent explicitly as well.
some more info here http://www.terathon.com/code/tangent.html
if you feed via tangent.w make sure you use tangent.xyz in the tgtspace muls.
btw where in german-speaking world can you make diploma with a game project?
Here is an ingame shot with different shading styles i tried to implement. At the moment i´am working on the animation blending between idle and walk...both are working well, but i don´t have a proper blending between them at the moment.
@Crazy, naja ist ja kein richtiges Game Projekt. Eher nen Prototyp, in dem der Char dargestellt wird und man mit ihm rumlaufen kann. Inklusive Animation etc... das Ganze funktioniert ja auch inzwischen ganz gut....aber übernommen hab ich mich mit dem ganzen schon etwas...
If i move my char back towards the origin and in negative z direction, after passing the chasing cam, everything looks fine again. But the further i move it also from postive or negative x-direction and postive z space everything looks fine. Just at the near postive z direction and a little bit of x or -x direction are working false. I tried to use just 1 light and the same problem occurs with 1 light direction.
float3 lightDir1 = float3(1.0f,1.0f,-1.0f);
//float3 lightDir2 = float3(-1.0f,-1.0f,1.0f);
My Struct, i don´t use the Binormals at the moment: My Pixelshader Code:
I also try to use the tangents, normals, binormals directly, but this doens´t change anything in the problem with the flipped normal map:
Any idea how i could flip parts of my pieces within photoshop? Not all parts are seperately, if i want do this, i had to cut out the wrong lit pieces an flip the channels of the normal map an then paste back at the same postion but how could i do this in photoshop. (i mean flipping the channels) And could this only done with the whole image or is it possible to do this only with a layer...
Generally you don't want to do this, because of the way normal-mapped models are lit. If the shader is written properly, it will rely on the tangent basis of the model which determines the color/lighting directions that are baked into the normal map.
If you change these colors, they won't match the tangent basis anymore, and you'll get worse lighting. You need to talk with the programmer who wrote your exporter and figure out if they're exporting the tangent basis properly, and if they're in turn using it in the shader.
@Eric
I don´t have programmer, i just exported everything with the .fbx exporter built in maya.
As a few people have pointed out, the proportions don't work, but Art1977 has mentioned he had to finish this on a deadline, so he couldn't go back and change things. If you'd read the thread, you'd see that he had to do a lot more than just model the character.
I could completly finish and overwork the charakter after finishing the thesis. At this point i ´ am quite satisfied with the result and get everything worked and implemented. It was a lot of stuff to do.
Just to learn everything vom scratch. Modeling, Zbrushing, Textureing, Rigging, Animating and also to learn c# and xna and m3g and java and to get everything working....
Now writting the whole documentation. At the moment i have 80 pages of just theoretical stuff about the whole process.
-Woog