Jump to content
  • Advertisement

rekotc

Member
  • Content Count

    31
  • Joined

  • Last visited

Community Reputation

121 Neutral

About rekotc

  • Rank
    Member

Personal Information

  • Role
    Amateur / Hobbyist
  • Interests
    Art
    Design
    Programming

Social

  • Github
    rekotc
  • Steam
    rekotc
  1. I believe i can now answer to my own question. I completely forgot to call GenerateMips after creating the SRV. I modified the code inside graphicsclass.cpp and added: d3d11DevCon->GenerateMips(tempMeshSRV); Just after creating the ShaderResourceView: hr = d3d11Device->CreateShaderResourceView(m_texture, &srvDesc, &tempMeshSRV); And the model now renders correctly! There is no need to touch the mipLevels, -1 is a perfectly legal value, it just didnt' make sense without creating the mipmaps first! Thanks again :)
  2. Some background: The LoadTarga() function inside my application needs the .tga textures to be 32bits, i had to convert all the textures inside the model to 32bits to be able to run the demo. I tried the md5mesh file inside GPUAnimation.zip (after converting its textures to 32bits) , and i still see the black face. However, thanks to @Alessio1989 i now know that i need to set the srvDesc.Texture2D.MipLevels to 1 in order to render the model successfully, this fix works on both the md5mesh files so i can say that my problem was solved. I need to study better the meaning of this 1, as i don't really get how it works. Besides, the texture loading is based on this rastertek demo, where the MipLevels is set to 1 without much explanations. Thanks everybody for your help, i really appreciate it. Special thanks to @Alessio1989 for the extra details about 16-byte aligned SIMD registers.
  3. It doesn't work (it crashes) if i put MipLevels = 0, while it works if i set MipLevels = 1; srvDesc.Texture2D.MipLevels = 1; I read the documentation, trying to understand why it happens, but i don't understand the problem, the documentation about MipLevels says: Thanks for pointing me in the right direction! PS: about this: I need time to understand what it is all about
  4. Hello everybody, thanks for the answer _Flame_! It pointed me to the right direction, you were right, the d3d initialization code was a mess, i had to rewrite it from scratch. I think i've made a big improvement, now all the triangles show up correctly! Still something that bugs me though, the guy's face is totally black, but it gets brighter when i move closer to it... I attached an updated version of the source. md5-viewer-git.zip
  5. Hello everybody, thanks for all your answers and sorry for the late reply, i've been very busy lately. I was able to clean the code and simplify the pixel shader, the problem is still there (new screenshot) and i still can't find a solution. I'll keep you updated with any progress, i attached a zip file with the source just in case thanks again! D3D11_MD5_MODEL_LOADER.zip
  6. Thanks, from inside the model the body seems fully rendered....! I tried to run the demo with the following descriptor and still no difference: ZeroMemory(&cmdesc, sizeof(D3D11_RASTERIZER_DESC)); cmdesc.FillMode = D3D11_FILL_SOLID; cmdesc.FrontCounterClockwise = false; cmdesc.CullMode = D3D11_CULL_NONE; hr = m_device->CreateRasterizerState(&cmdesc, &RSCullNone);
  7. Hi, i'm trying to develop a basic md5 mesh viewer (without animations) using directX11, right now i'm still cleaning the code so i can't show you the entire project, but maybe you can give me a hint. The mesh is loaded correctly but some triangles are not filled up with the textures, they are invisible. Does the screenshot help? I hope i will be able to upload the code on github during the weekend. Thanks in advance.
  8. Thanks! It worked! Now i need to understand a bit better what i just did Huge thanks!
  9. Hello everybody, i'm learning DirectX11 and i can't understand why the following code doesn't work as expected. I have a function that takes 3 XMMATRIX and multiplies them to get the WVP matrix. void DummyShader::PrepareToDraw(XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix) { WVP = worldMatrix * viewMatrix * projectionMatrix; } The 3 XMMATRIX are correctly read, but the resulting WVP matrix contains some absurd values. The function behaves as expected if i replace the offending line with the following: XMMATRIX temp1 = projectionMatrix; XMMATRIX temp2 = viewMatrix; XMMATRIX temp3 = worldMatrix; WVP = temp3 * temp2 * temp1; But it doesn't make any sense to me, what's the difference? I'm sure i'm missing something veeeery obvious, but i'm not that experienced in the field. This is a fully reproducible example of my problem: //main.cpp #include <windows.h> #include "DummyShader.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) { DummyShader* dummyShader = new DummyShader(); XMMATRIX world = XMMatrixIdentity(); XMMATRIX view = XMMatrixIdentity(); XMMATRIX projection = XMMatrixIdentity(); dummyShader->PrepareToDraw(world,view,projection); return 0; } //DummyShader.h using namespace DirectX; class DummyShader { public: XMMATRIX WVP; DummyShader(); ~DummyShader(); void PrepareToDraw(XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix); }; //DummyShader.cpp #include "DummyShader.h" DummyShader::DummyShader() { } DummyShader::~DummyShader() { } void DummyShader::PrepareToDraw(XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix) { WVP = worldMatrix * viewMatrix * projectionMatrix; } Any hint? Thanks in advance
  10. Ok, i was able to find a solution somehow, you can find it here https://gamedev.stackexchange.com/questions/121867/load-2-triangles-in-a-simple-dx11-example/
  11. Hello everybody,   I'm following this tutorial, where they show how to setup a simple dx11 demo with a green triangle in the middle. I'd like to be able to modify it so that it shows 2 triangles instead, in order to do this i modified the code of the Graphicsclass.cpp in the tutorial by adding some lines to the Render() function, just after the first triangle is drawn, like this (the code i added starts at //ADDITIONAL CODE): [...] // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. m_Model->Render(m_Direct3D->GetDeviceContext()); // Render the model using the color shader. result = m_ColorShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix); if (!result) { return false; } //ADDITIONAL CODE // Reset the world matrix. worldMatrix = XMMatrixIdentity(); // Translate to the location of the second triangle. translateMatrix = XMMatrixTranslation(1.0f, 1.0f, 0.0f); worldMatrix = XMMatrixMultiply(worldMatrix, translateMatrix); // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. m_Model->Render(m_Direct3D->GetDeviceContext()); // Render the model using the color shader. result = m_ColorShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix); if (!result) { return false; } //END OF ADDITIONAL CODE // Present the rendered scene to the screen. m_Direct3D->EndScene();  But the second triangle doesn't show up, i also put the complete example on github in case you want to try it yourself. I'm sure i'm missing something pretty basic but i can't figure it out.. i'm going crazy.
  12. thank you!!! that was stupid... you were right, these are the modified lines:   output.normal = mul(input.normal,composition); output.normal = mul(output.normal, (float3x3)worldMatrix);
  13. i attached the vertex shader below, it's based on the tutorial with a few modifications, in particular i had to add some calculations to translate and rotate the instances in the correct position, i don't know if it's the best approach (and it might be the root of my problems..) , i just couldn't find any example for it.
  14. mmm, these are the only lines where i touch the normals in the vertex shader:   // Calculate the normal vector against the world matrix only. output.normal = mul(input.normal, (float3x3)worldMatrix);   // Normalize the normal vector. output.normal = normalize(output.normal);  
  15. I'm trying to understand the basics of directional lighting, i have a very simple demo with a few axes (i mean the weapon), instanced in different positions, some of them rotated, and i'm using the light.ps shader file i found in this tutorial http://www.rastertek.com/dx11tut09.html in order to add a directional light to the scene. As you can see from the screenshot below, the light always hits the left side of the axes, like if the directional light vector (pointing at (0,0,-1) is being considered relative to the position of every axe, instead of being fixed to the z negative axis of the scene.   Could you help me on this one?   thanks    
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!