Home Game Development shaders – D3D11 Object caught to display it doesn’t matter what eye place used

shaders – D3D11 Object caught to display it doesn’t matter what eye place used

0
shaders – D3D11 Object caught to display it doesn’t matter what eye place used

[ad_1]

I’ve run into a difficulty when making an attempt to put in writing a easy rendering program in d3d11. I’m 90% certain it is to do with some defective matrix multiplication or technology. But I’ve tried debugging the values of the matrices and so they appear positive to me. The drawback is that irrespective of the place I transfer the attention place, the renderered dice all the time seems the identical

The ensuing display picture is like this
enter image description here

Each vertex of the dice has a unique color, and the pixel shader must be mixing between them, so the gradient impact you’ll be able to see is between 4 vertices of the dice.

Here’s a few of my code

eyePos = XMVectorSet(0.0f, 1.0f, -5.0f, 0.0f);
lookAtPos = XMVectorSet(0.0f,1.0f,0.0f,0.0f);
up = XMVectorSet(0.0f,1.0f,0.0f,0.0f);

world = XMMatrixIdentity();
view = XMMatrixLookAtLH(eyePos, lookAtPos, up);
projection = XMMatrixPerspectiveFovLH(XM_PIDIV2, 1000.0f / 680.0f, 0.01f, 100.0f);

_pIContext->IASetVertexBuffers(0, 1, &_vertexBuffer, &stride, &offset);
_pIContext->IASetIndexBuffer(_indexBuffer, DXGI_FORMAT_R16_UINT, 0);
_pIContext->VSSetConstantBuffers(0, 1, &_cbWorldBuffer);
_pIContext->VSSetConstantBuffers(1, 1, &_cbViewBuffer);
_pIContext->VSSetConstantBuffers(2, 1, &_cbProjBuffer);

And then for shader code, we have…

cbuffer worldBuffer : register(b0) {
    matrix World;
    float t;
}

cbuffer viewBuffer : register(b1) {
    matrix View;
}

cbuffer projectionBuffer : register(b2) {
    matrix Projection;
}

PS_INPUT vs(float4 pos : POSITION, float4 col : COLOUR) {
    PS_INPUT output = (PS_INPUT)0;
    output.Pos = mul(pos, World);
    output.Pos = mul(pos, View);
    output.Pos = mul(pos, Projection);

    output.Colour = col;
    return output;
}

float4 ps(PS_INPUT enter) : SV_TARGET{
    return enter.Colour;
}

My intestine tells me it is the projection matrix, though I’ve based mostly this on one other venture I did, and evaluating the code, I am unable to discover out what I’ve completed in a different way. If it is advisable see different elements of the code, let me know and I’ll get again ASAP

Thanks for any assist

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here