0

i get strange results when loading an .obj file in SharpDX. It gets semi-transparent. I just can not figure out the problem. It looks like the normals are inverted at some faces but i am not sure. I also tried to duplicate the vertices and inverse every normal, but nothing helps. Could it be that i am doing wrong draw calls? I draw for every object in the scene and after that i present it.

Example 1,Example 2

After some testing, i think it could also be the shader. But like i already said i am not sure about that. This is the Shadercode:

cbuffer data :register(b0)
{
    float4x4 worldViewProj;
};

struct VS_IN
{
    float4 position : POSITION;
    float2 texcoord : TEXCOORD;
};

struct PS_IN
{
    float4 position : SV_POSITION;
    float2 texcoord : TEXCOORD;
};

//texture
Texture2D textureMap;
SamplerState textureSampler
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};

PS_IN VS( VS_IN input)
{
    PS_IN output = (PS_IN)0;

    output.position = mul(worldViewProj,input.position);
    output.texcoord=input.texcoord;

    return output;
}

float4 PS( PS_IN input ) : SV_Target
{
    return textureMap.Sample( textureSampler, input.texcoord );
}

Also i am new to shader.

00noize00
  • 101
  • 1
  • 11

1 Answers1

0

I solved the problem. The ZBuffer was not initialized, by initializing a DepthStencilView to the device

00noize00
  • 101
  • 1
  • 11