Home 3D Art Showcase & Critiques

3D Realtime Character [WIP]

2

Replies

  • Art1977
    Thx woogity i will consider this, but the below problem is getting more headache ...
  • Art1977
    changing the lightdirection brings me pretty close to my aim.

    XNA_NormalProblem01t.jpg
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    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.

    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?
  • Art1977
    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.

    DifferentShadingTechniques.jpg

    @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...
  • Art1977
    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.

    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:
    //***********************************************************************
    //*********************** Datenstrukturen *******************************
    //***********************************************************************
    struct VS_INPUT 
    {
        float4 Position : POSITION0;         //Position des Vertex im GameModel
        float2 TexCoord : TEXCOORD0;         //Texturkoordinate des Vertex im Modelfile
        float3 Normal : NORMAL0;             //der Vektor der Normale des Vertex
        float3 Tangent : TANGENT0;           //Der Tangenten-Vektor
        float3 Binormal : BINORMAL0;         //der Binormal-Vektor
        
        
        float4 BoneIndices : BLENDINDICES0; //Index für Bones eines geskinnten Charakters
        float4 BoneWeights : BLENDWEIGHT0;  //Weights des geskinnten Charakters
    };
    
    //struct-Definition für Vertexshader output
    struct VS_OUTPUT 
    {
        float4 Position : POSITION0;       //die Finale Position des Vertex im World Space
        float2 TexCoord : TEXCOORD0;       //die zugehörige Texturkoordinate des Vertex
        float3 Data1: TEXCOORD1;           //Container 
      //float3 Data2: TEXCOORD2;           //
    };
    
    //***********************************************************************
    //*********************** Vertex Shader *********************************
    //***********************************************************************
    VS_OUTPUT VSNormals(VS_INPUT input)
    {
        VS_OUTPUT output;
        
        float4x4 skinTransform = 0;
        skinTransform += Bones[input.BoneIndices.x] * input.BoneWeights.x;
        skinTransform += Bones[input.BoneIndices.y] * input.BoneWeights.y;
        skinTransform += Bones[input.BoneIndices.z] * input.BoneWeights.z;
        skinTransform += Bones[input.BoneIndices.w] * input.BoneWeights.w;
        
        float4 pos = mul(input.Position, skinTransform);
        pos = mul(pos,View);
        pos = mul(pos,Projection);
        
        
    float3x3 tgtSpace;
    tgtSpace[0] = mul(input.Tangent, skinTransform);
    tgtSpace[1] = mul(cross(input.Tangent, input.Normal),skinTransform);
    tgtSpace[2] = mul(input.Normal, skinTransform);
    
    float3 tgtLightDir1 = mul(tgtSpace, lightDir1);
    output.Position = pos;
    output.TexCoord = input.TexCoord;
    output.Data1 = normalize(tgtLightDir1);
    
        return output;
    }
    
    My Pixelshader Code:
    //***********************************************************************
    //*********************** 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:
      float3x3 tgtSpace;
      tgtSpace[0] = mul(input.Tangent, skinTransform);
      tgtSpace[1] = mul(input.Binormal, skinTransform);
      tgtSpace[2] = mul(input.Normal, skinTransform);
     
    
  • dbreak
    Offline / Send Message
    dbreak polycounter lvl 10
    Hes too short, heheee. Make his legs taller plz xD
  • Art1977
    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:

    XNA_NormalProblem01v.jpg

    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...
  • Art1977
    Ok, here is a final Prototypshot of the XNA-Application with the animated Model:

    XNA_Screenshot.jpg
  • Eric Chadwick
    Art1977 wrote: »
    ...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.
  • Art1977
    I get nearly everything finished with the programming stuff......now a lot of writting stuff of the documentation and only 5 weeks left:

    M3G_AND_XNA01.jpg

    @Eric
    I don´t have programmer, i just exported everything with the .fbx exporter built in maya.
  • odium
    Offline / Send Message
    odium polycounter lvl 18
    Is this a Dwarf SWAT member or something?
  • Michael Knubben
    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.
  • Art1977
    Thx Mighty, that´s the point.

    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.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    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.
  • woogity
    great work man no nitpicks here it looks good and concidering you made your deadline i think u managed your time well. keep it comin!


    -Woog
2
Sign In or Register to comment.