endrollex

Member
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

270 Neutral

About endrollex

  • Rank
    Member

Personal Information

  1. Hello, I use Frank Luna's DX11 code draw particle, after draw it will restore default states: particle.draw(); D3DDC->RSSetState(0); D3DDC->OMSetDepthStencilState(0, 0); D3DDC->OMSetBlendState(0, {0.0f, 0.0f, 0.0f, 0.0f}, 0xffffffff); sprite.draw(); This code restore failed,  then draw DirectXTK SpriteBatch will display nothing.   particle.draw(); D3DDC->ClearState(); D3DDC->OMSetRenderTargets(1, render_targets, DepthStencilView); D3DDC->RSSetViewports(1, &ScreenViewport); sprite.draw(); Use ClearState() will be OK, but I want to know which certain state is not restore correctly. Is there step-by-step version of ClearState() existing? Thanks!
  2. when is Frank Luna's latest book coming out?

    amazon.com update: March 31, 2016
  3. DX11 How to trim shadow bounds?

    Thanks! It is OK now. SamplerComparisonState samShadow { Filter = COMPARISON_MIN_MAG_LINEAR_MIP_POINT; AddressU = BORDER; AddressV = BORDER; AddressW = BORDER; BorderColor = float4(1.0f, 1.0f, 1.0f, 0.0f); ComparisonFunc = LESS_EQUAL; }; if (depth < 0.0f || depth > 1.0f) { percentLit = 9.0f; }
  4. Hello, I am using rendering technique from the book Intro to 3D Game DX11 by Frank Luna, Its shadow mapping has a bounds, out of bounds will be dark. How to make the out of bounds area be nature without shadow? I try determine shadowPosH.x/y if out of shadowMap, but the range value is wrong (0.0f < range < 1.0f)? The result (bottom pic) still retain a small dark area. How to trim it correctly? Thanks,   // Performs shadowmap test to determine if a pixel is in shadow. static const float SMAP_SIZE = 2048.0f; static const float SMAP_DX = 1.0f / SMAP_SIZE; float CalcShadowFactor(SamplerComparisonState samShadow, Texture2D shadowMap, float4 shadowPosH) { // Complete projection by doing division by w. shadowPosH.xyz /= shadowPosH.w; // Depth in NDC space. float depth = shadowPosH.z; // Texel size. const float dx = SMAP_DX; float percentLit = 0.0f; const float2 offsets[9] = { float2(-dx, -dx), float2(0.0f, -dx), float2(dx, -dx), float2(-dx, 0.0f), float2(0.0f, 0.0f), float2(dx, 0.0f), float2(-dx, +dx), float2(0.0f, +dx), float2(dx, +dx) }; // if (shadowPosH.x < 0.0f || shadowPosH.y < 0.0f || shadowPosH.x > 1.0f || shadowPosH.y > 1.0f) { percentLit = 9.0f; } else { [unroll] for(int i = 0; i < 9; ++i) { percentLit += shadowMap.SampleCmpLevelZero(samShadow, shadowPosH.xy + offsets[i], depth).r; } } return percentLit /= 9.0f; }
  5. DirectXTK Audio not work

    The official sample should be another issue, maybe because I use vs2013 build it, too complicated.
  6. DirectXTK Audio not work

    Thanks, I found my .wav file name is wrong, giddiness But the API does not check file name what is unexpected... Edit: I use system file Windows Notify.wav for test. (Win7 version) Windows Notify.wav (12.3 KB) error (Win8 version) Windows Notify.wav (222 KB) success I do not know the detail of .wav format, I think they are different, AudioEngine is picky.
  7. Hello, I am following the official DirectXTK Audio document, but failed:   CoInitializeEx( nullptr, COINIT_MULTITHREADED ); AUDIO_ENGINE_FLAGS eflags = AudioEngine_Default | AudioEngine_Debug; std::unique_ptr<AudioEngine> audEngine( new AudioEngine( eflags ) ); std::unique_ptr<SoundEffect> soundEffect( new SoundEffect( audEngine.get(), L"sound.wav" ) ); XAudio 2.8 / XAudio 2.7 get same error: - abort() has been called, it gave less debug info. It seems soundEffect cannot be created. (run on win7/win8 x64, vs2013, sdk 8.1) https://code.msdn.microsoft.com/windowsdesktop/DirectXTK-for-Audio-Simple-928e0700 DirectXTK for Audio Simple Win32 Sample (DirectX SDK) This official sample also get same error, I cannot figure it out ,what's happening? Audio Sample:
  8. hello, Is XMLoadFloat function overhead bigger than several simple operators? DirectXMath Programming Guide has not mentioned this point. Method 1: XMVECTOR vec_A = XMLoadFloat3(&f3_A); XMVECTOR vec_B = XMLoadFloat3(&f3_B); vec_A += vec_B; XMStoreFloat3(&f3_A, vec_A); Method 2: f3_A.x += f3_B.x; f3_A.y += f3_B.y; f3_A.z += f3_B.z; Which method more effective? Thanks.
  9. Matrix right hand to left hand problem

    Thanks all, I use 2 box for test, just bind pose. My to_parent matrix formula is wrong when in column vector: to_child = pose_bones[ix-1].matrix.inverted()*pose_bones[ix].matrix to_parent = to_child.inverted() It should be flip the order of multiplication, that cause my final matrix wrong. (Formula still not all right) The final matrix is different between column vector and row vector: column vector final matrix: bone_to_parent[0]*bone_to_parent[1]* ... *bone_to_parent[n]*offset == identity matrix row vector, column vector, right hand, left hand, they are confused bind pose OK now: (but motion pose is wrong)
  10. hello, I am doing export animation data from Blender to DirectX. In Blender, it is right hand system. The final matrix of bind pose: offset*bone_to_parent[n]*bone_to_parent[n-1]... == identity matrix It is OK.   Because Blender uses column vector, DirectX uses row vector, thus DirectX uses transposed matrices of Blender's. But the result is wrong: offset^T*bone_to_parent[n]^T*bone_to_parent[n-1]^T... != identity matrix   I found some method convert right hand matrix to left hand before transpose, but not work. such as http://answers.unity3d.com/storage/temp/12048-lefthandedtorighthanded.pdf, or swap y and z.   Is there other reason cause it fail? How to make the final matrix to be idenity matrix in left hand without change the order of multiplication? Thanks,
  11. Hello, I am doing export work from Blender to DX. According a book(Frank Luna DX11) it needs animation data, it wrote: Each key frame stores the time position, the translation vector specifying the position of the bone, the scaling vector specifying the bone scale, and the quaternion specifying the orientation of the bone.   What is the definition of the position of a bone? The book is not say any more about the position. In Blender's data, I found it's bone has head, tail, center position, which one is for the animation data do translation vector work? or arbitrarily?   Thanks.
  12. Sorry, I am new here. Not need to see my code, correct the question: I wanna know who did similar export working and meet with similar problem. Performance of Luna's rendering is less information deal with book's few mesh data. So just look the picture. Is the normal mapping regular?   In fact, I have never write HLSL, if data is OK, is the shader or somewhere need to adjust? Another possible is my tangents is wrong, not confirm. (vertex, normal, uv, triangle shall be right) What is minimum requirements (or key points) for a normal mapping gets a good look? (Why 2nd picture looks almost plain vs 1st?)   I have no inspiration now, If I fight it out, will update this post.
  13. Hello,   I am trying to export Blender's model data for DirectX. The demo is from Frank Luna's DX11 book Chapter 23 Meshes. I just replaced the .m3d file. But it's normal mapping looks not obvious. Where is the wrong? Computing tangents is incorrect?   Thanks,   in Crazybump, .obj file is originally export from Blender:   in Luna's demo, the tangents is re-computed for triangle mesh, normal map was created by Crazybump:
  14. Hello,   I am trying to export Blender's model data for DirectX. The tangent is need to compute. The Algorithm is from http://www.terathon.com/code/tangent.html   But in this step: float r = 1.0F / (s1 * t2 - s2 * t1); It appears an error: float division by zero I found the reason is one triangle face has two same uv. ?the uv mapping in DirectX is seems OK? Is it regular? How can I get the tangent In this case?   Update: Perhaps uv mapping is wrong, I am not familiar with the principles of uv mapping.   Thanks.