mister345

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

2 Followers

About mister345

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. Does buffer number matter in ID3D11DeviceContext::PSSetConstantBuffers()? I added 5 or six constant buffers to my framework, and later realized I had set the buffer number parameter to either 0 or 1 in all of them - but they still all worked! Curious why that is, and should they be set up to correspond to the number of constant buffers? Similarly, inside the buffer structs used to pass info into the hlsl shader, I added padding inside the c++ struct to make a struct containing a float3 be 16 bytes, but in the declaration of the same struct inside the hlsl shader file, it was missing the padding value - and it still worked! Do they need to be consistent or not? Thanks. struct CameraBufferType { XMFLOAT3 cameraPosition; float padding; };
  2. So you're saying in the following function, dont pass in the view matrix right? What matrix should I pass in instead, just identity? SetShaderParameters(deviceContext, worldMatrix, identity /*viewMatrix*/, projectionMatrix, texture);
  3. Yes, it did, thanks for following up! Out of curiosity, is there a "right way" to do this? Because it looks like D3D11_TEXTURE2D_DESC has a few different versions corresponding to different dimensions of arrays - so in my case, if I'm multitexturing with 4 or 5 textures, couldnt I just be using a 1 dimensional array or am I misunderstanding it?
  4. Trying to write a multitexturing shader in DirectX11 - 3 textures work fine, but adding 4th gets sampled as black! Could you please look at the textureClass.cpp line 79? - I'm guess its D3D11_TEXTURE2D_DESC settings are wrong, but no idea how to set it up right. I tried changing ArraySize from 1 to 4, but does nothing. If thats not the issue, please look at the LightShader_ps - maybe doing something wrong there? Otherwise, no idea. // Setup the description of the texture. textureDesc.Height = height; textureDesc.Width = width; textureDesc.MipLevels = 0; textureDesc.ArraySize = 1; textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; textureDesc.SampleDesc.Count = 1; textureDesc.SampleDesc.Quality = 0; textureDesc.Usage = D3D11_USAGE_DEFAULT; textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; textureDesc.CPUAccessFlags = 0; textureDesc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; Please help, thanks. https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/Texture.cpp
  5. Hi guys, anyone experienced with DX11 could look at my graphics.cpp class? I got fonts rendering correctly with painters algorithm - painting over the other 3d stuff each frame, however, whenever I turn the camera left or right, the fonts get smushed narrower and narrower, then disappear completely. It seems like the fix must be a very small change, untying their rendering from the cam direction, but I just can't figure out how to do it under all this rendering complexity. Any tips would be helpful, thanks. https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/Graphics.cpp
  6. Hey, anyone know a good plugin for debugging hlsl shaders? I have hlsl tool installed, and it makes the text change color, but it wont show me any of teh errors so I have no way of spotting errors in the shader I write other than my own two eyes. It doesnt do the red squiggly underline for some reason. Settings issue or do I need another plugin? Thanks.
  7. Thanks, you've been a huge help! Got the frustum working thanks to you both!
  8. Oh, I see. So this means that the far and near plane are offset from the origin along their respective normal vectors (actually the same) by their respective distances, but the other 4 planes would all have distance 0, but just different normal vectors, because they intersect the origin, correct?
  9. So then this would only work for planes that you are viewing head on, ie the near plane and far plane. Because you said you're just moving it away from the origin in the direction of your view vector. So how are the other 4 planes of the frustum expressed?
  10. Yes, but translation in which direction? You can't just translate a 3D object with a single scalar value. If you wanted to translate some object by that value, you would have to multiply a normalized direction vector by your desired distance, then add it to the 3D position of the object in question. So which point on the plane exactly are you "translating" with this "distance" scalar, and in what direction exactly? Thanks.
  11. I'm sorry, could you please elaborate? A plane would normally need at least 3 points to express in 3D space. How exactly do you only express it using a scalar value for distance from origin and normal? That tells you nothing about the location of the plane relative to the origin, or its width and height, only the direction of its surface. What am I missing here?
  12. @xycsoscyx Thanks for all your advice and I appreciate your desire to make me seek the answers myself. However, I am still inexperienced with the right ways of using these new XM types, is this the right way to access the element of an XMMATRIX say at row 4, column 3? float element43 = projectionMatrix.r[3].m128_f32[2]; Also, you said "as for XMVECTOR, the plane equation is just a 4D set of values," but a plane would need 12 values - 3 floats to express each of the 4 points, right? (or in the case of XMVECTOR, it has 4 floats). So how on earth do you store 4 3D points inside of 1 XMVECTOR? Even msdn specifically says use XMVECTOR instead of plane, but it makes no sense! And could you please tell me the best way to access the element of an XMVECTOR? They make it really user unfriendly, you can't just index into an XMVECTOR, like you have to load it into an XMFLOAT4 or something, which seems like a huge waste of resources.
  13. Hi, there's a great tutorial on frustum culling, but impossible to compile because it uses old DirectX 11 types (Direct3DXPlane instead of XMVECTOR, etc). Can someone please help me update this one class - frustumClass - to the new DirectX11 types (XMMATRIX, XMVECTOR, etc)? http://www.rastertek.com/dx11tut16.html Furthermore, can anyone please explain how he gets the minimum Z distance from the projection matrix by dividing one element by another? He leaves no explanation for this math and it's extremely frustrating. // Calculate the minimum Z distance in the frustum. zMinimum = -projectionMatrix._43 / projectionMatrix._33; r = screenDepth / (screenDepth - zMinimum); projectionMatrix._33 = r; projectionMatrix._43 = -r * zMinimum; Also not sure how to use an XMVECTOR instead of the old Plane class that he uses. Confused as to where all the m12, m13, etc correspond to the elements of an XMVECTOR. I thought you're not supposed to even access the elements of an XMVECTOR directly! So incredibly frustrating. Please help, thanks.
  14. Quadtree/terrain frustum culling help

    Hi, there's another great tutorial on frustum culling, but impossible to compile because it uses old DirectX 11 types (Direct3DXPlane instead of XMVECTOR, etc). Can someone please help me update this one class - frustumClass - to the new DirectX11 types (XMMATRIX, XMVECTOR, etc)? http://www.rastertek.com/dx11tut16.html Furthermore, can anyone please explain how he gets the minimum Z distance from the projection matrix by dividing one element by another? He leaves no explanation for this math and it's extremely frustrating. // Calculate the minimum Z distance in the frustum. zMinimum = -projectionMatrix._43 / projectionMatrix._33; r = screenDepth / (screenDepth - zMinimum); projectionMatrix._33 = r; projectionMatrix._43 = -r * zMinimum; Also not sure how to use an XMVECTOR instead of the old Plane class that he uses. Confused as to where all the m12, m13, etc correspond to the elements of an XMVECTOR. I thought you're not supposed to even access the elements of an XMVECTOR directly! So incredibly frustrating. Please help, thanks.