c++ - DirectX 11: Shader not creating world view matrix -



c++ - DirectX 11: Shader not creating world view matrix -

after coming across problem here, the entity::draw() phone call not displayed due vertex shader values returning 0 on multiplication world view matrix.

the problem funneled faulty constant buffer input. however, after checking values, can't seem understand problem @ hand. pre-multiplied world, view, , projection matrices:

mworld = xmmatrixidentity(); mview = xmmatrixlookatlh(eye, at, up); mprojection = xmmatrixperspectivefovlh(xm_pidiv2, 1.0, 0.0f, 1000.0f); mwvp = mworld*mview*mprojection;

mwvp

-0.999999940, 0.000000000, 0.000000000, 0.000000000 0.000000000, 0.999999940, 0.000000000, 0.000000000 0.000000000, 0.000000000, -1.00000000, -1.00000000 0.000000000, 0.000000000, 5.00000000, 5.00000000

mwvp enters constant buffer after beingness transposed:

worldcb.mworldvp = xmmatrixtranspose(mwvp); devicecontext->updatesubresource(matrixbuffer, 0, null, &worldcb, 0, 0); devicecontext->vssetconstantbuffers(0, 1, &matrixbuffer);

xmmatrixtranspose(mwvp);

-0.999999940, 0.000000000, 0.000000000, 0.000000000 0.000000000, 0.999999940, 0.000000000, 0.000000000 0.000000000, 0.000000000, -1.00000000, 5.00000000 0.000000000, 0.000000000, -1.00000000, 5.00000000

which looks ok, @ to the lowest degree me. next shader starts doing thing, here's things funky, checking disassembly yields when:

output.position = mul(position, wvp);

vertex shader: 00000000 dp4 o0.x, v0.xyzw, cb0[0].xyzw 00000001 dp4 o0.y, v0.xyzw, cb0[1].xyzw 00000002 dp4 o0.z, v0.xyzw, cb0[2].xyzw 00000003 dp4 o0.w, v0.xyzw, cb0[3].xyzw 00000004 mov o1.xyzw, v1.xyzw

for each multiplication, values homecoming 0. , if output.position = position; values correct, , box displays, not within world transformation.

the total shader file below:

cbuffer constantbuffer:register(b0) { matrix wvp; } struct vout { float4 position : sv_position; float4 color : color; }; vout vshader(float4 position : position, float4 color : color) { vout output; output.position = mul(position, wvp); // position; output.color = color; homecoming output; } float4 pshader(float4 position : sv_position, float4 color : color) : sv_target { homecoming color; }

edit: noted transpose of world matrix equals zero:

objectspace = m_scale*m_rotation*m_translate; mwvp = objectspace*direct3d.mview*direct3d.mprojection; localworld.mworldvp = xmmatrixtranspose(wwvp);

xmmatrixtranspose(wwvp) comes out:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

and problem. guesses why transpose of matrix equal 0?

the near plane of perspective projection must value larger zero. if zero, near plane photographic camera located, , in scene converges single point.

c++ debugging visual-studio-2013 shader directx-11

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -