Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About RubenRS

  • Rank

Personal Information

  • Role
  • Interests


  • Github

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. How can I change the skeletal mesh position in a c++ class? because I got this. I´m working in UE4 -> 4.20 I know that the pivot of the mesh is on the bottom, but there must be a way to change the position by code. By the way, my object is a character's derived class.
  2. RubenRS

    DX11 Shader Reflection Problem

    😮 nice..!, well, thanks for your help and time @ChuckNovice and @0xnullptr Have a nice day !!!
  3. RubenRS

    DX11 Shader Reflection Problem

    Where I can activate that flag?
  4. RubenRS

    DX11 Shader Reflection Problem

    I did the change in my vertex buffer first from XMFLOAT3 to XMFLOAT4 and that didn't work but when i changed it in the shader it works.... It's not the same?
  5. RubenRS

    DX11 Shader Reflection Problem

    The image disappear. And no I haven't, I use Nvidia Nsight for rendering things but I'll check that tools, thanks. 😮 if I do the change in the shader it works... @ChuckNovice Why?
  6. RubenRS

    DX11 Shader Reflection Problem

    I think it's because my POSITION in the vertex shader is using a float4 and when im creating my vertex buffer I'm using a XMFLOAT3 cbuffer cbChangesPerFrame : register(b0) { matrix mvp_; }; Texture2D colorMap_ : register(t0); SamplerState colorSampler_ : register(s0); struct VS_Input { float4 pos : POSITION; float2 tex0 : TEXCOORD0; }; struct PS_Input { float4 pos : SV_POSITION; float2 tex0 : TEXCOORD0; }; PS_Input vs_main(VS_Input vertex) { PS_Input vsOut = (PS_Input)0; vsOut.pos = mul(vertex.pos, mvp_); vsOut.tex0 = vertex.tex0; return vsOut; } float4 ps_main(PS_Input frag) : SV_TARGET { return colorMap_.Sample(colorSampler_, frag.tex0); }
  7. RubenRS

    DX11 Shader Reflection Problem

    I found something else, the format of the position is changing from DXGI_FORMAT_R32G32B32_FLOAT to DXGI_FORMAT_R32G32B32A32_FLOAT. And that's because the paramDesc.Mask = 15 when I get my position from the shader.
  8. RubenRS

    DX11 Shader Reflection Problem

    right, I was wrong the D3D11_APPEND_ALIGNED_ELEMENT give me 0xffffffff = 4294967295. And that's the only change both codes have.
  9. RubenRS

    DX11 Shader Reflection Problem

    @ChuckNovice Only the AlignedByteOffset of the TEXCOORD change from 12 to 0. I think the error could be in this part of the code: elementDesc.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT; but, i don't know how to correct it if that's the wrong part.
  10. Hi, I'm trying to create my input layout with shader reflection, but there's something weird happening because in the thaditional form this is my output: Here's the code: D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; UINT numElements = ARRAYSIZE(layout); hr = m_ptrd3dDevice->CreateInputLayout(layout, numElements, m_ptrVSBlob->GetBufferPointer(), m_ptrVSBlob->GetBufferSize(), &m_ptrInputLayout); m_ptrVSBlob->Release(); if (FAILED(hr)) return hr; And when I create the input layout with shader reflection, this is my output: Here's the code: // Reflect shader info ID3D11ShaderReflection* pVertexShaderReflection = nullptr; if (FAILED(D3DReflect(m_ptrVSBlob->GetBufferPointer(), m_ptrVSBlob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**)&pVertexShaderReflection))) { return S_FALSE; } // Get shader info D3D11_SHADER_DESC shaderDesc; pVertexShaderReflection->GetDesc(&shaderDesc); // Read input layout description from shader info std::vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDesc; for (UINT i = 0; i < shaderDesc.InputParameters; i++) { D3D11_SIGNATURE_PARAMETER_DESC paramDesc; pVertexShaderReflection->GetInputParameterDesc(i, &paramDesc); // Fill out input element desc D3D11_INPUT_ELEMENT_DESC elementDesc; elementDesc.SemanticName = paramDesc.SemanticName; elementDesc.SemanticIndex = paramDesc.SemanticIndex; elementDesc.InputSlot = 0; elementDesc.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT; elementDesc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; elementDesc.InstanceDataStepRate = 0; // determine DXGI format if (paramDesc.Mask == 1) { if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_UINT32) elementDesc.Format = DXGI_FORMAT_R32_UINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_SINT32) elementDesc.Format = DXGI_FORMAT_R32_SINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_FLOAT32) elementDesc.Format = DXGI_FORMAT_R32_FLOAT; } else if (paramDesc.Mask <= 3) { if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_UINT32) elementDesc.Format = DXGI_FORMAT_R32G32_UINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_SINT32) elementDesc.Format = DXGI_FORMAT_R32G32_SINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_FLOAT32) elementDesc.Format = DXGI_FORMAT_R32G32_FLOAT; } else if (paramDesc.Mask <= 7) { if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_UINT32) elementDesc.Format = DXGI_FORMAT_R32G32B32_UINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_SINT32) elementDesc.Format = DXGI_FORMAT_R32G32B32_SINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_FLOAT32) elementDesc.Format = DXGI_FORMAT_R32G32B32_FLOAT; } else if (paramDesc.Mask <= 15) { if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_UINT32) elementDesc.Format = DXGI_FORMAT_R32G32B32A32_UINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_SINT32) elementDesc.Format = DXGI_FORMAT_R32G32B32A32_SINT; else if (paramDesc.ComponentType == D3D_REGISTER_COMPONENT_FLOAT32) elementDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; } // Save element desc inputLayoutDesc.push_back(elementDesc); } // Try to create Input Layout hr = m_ptrd3dDevice->CreateInputLayout(&inputLayoutDesc[0], inputLayoutDesc.size(), m_ptrVSBlob->GetBufferPointer(), m_ptrVSBlob->GetBufferSize(), &m_ptrInputLayout); //Free allocation shader reflection memory pVertexShaderReflection->Release(); pVertexShaderReflection = nullptr; if (FAILED(hr)) return hr;
  11. I'm trying to render the characters of a bitmap texture that i generated with stb_truetype.h. Currently i have the texcoords and the longitude of each character, my DirectXTexture2D is 512x512 normilized from -1 to 1. So, i send to render the character "C", creating my triangulation starting from coords (0,0) -> (X0,Y0). Then i get my X1 adding X0 + longitude. NOTE: I transformed my longitude to screen space coordinates dividing out of 512 (texture width size) before. This is my bitmap texture: This is my vertex buffer: float sizeX = static_cast<float>(tempInfo.longitude) / 512; float sizeY = 0.0625f; //32/512 (32->height of font) spritePtr[0].Pos = XMFLOAT3(0.0f + sizeX, 0.0f + sizeY, 1.0f); spritePtr[1].Pos = XMFLOAT3(0.0f + sizeX, 0.0f, 1.0f); spritePtr[2].Pos = XMFLOAT3(0.0f, 0.0f, 1.0f); spritePtr[3].Pos = XMFLOAT3(0.0f, 0.0f, 1.0f); spritePtr[4].Pos = XMFLOAT3(0.0f, 0.0f + sizeY, 1.0f); spritePtr[5].Pos = XMFLOAT3(0.0f + sizeX, 0.0f + sizeY, 1.0f); spritePtr[0].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v0); spritePtr[1].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v1); spritePtr[2].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v1); spritePtr[3].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v1); spritePtr[4].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v0); spritePtr[5].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v0); NOTE: spritePtr is the pointer to my dynamic buffer that i map and unmap. And this is my result: I don't understand why it is too small compared to my bitmap and if i expand the triangulation i get a pixelated character.
  12. How do i open an image to use it as Texture2D information without D3DX11CreateShaderResourceViewFromFile? And how it works for different formats like (JPG, PNG, BMP, DDS, etc.)? I have an (512 x 512) image with font letters, also i have the position and texcoord of every letter. The main idea is that i want to obtain the image pixel info, use the position and texcoords to create a new texture with one letter and render it. Or am I wrong in something?
  13. I want to render true type fonts in DirectX11, right now in one program im using stb_truetype.h to get the position and texcoords from every character i want. And in other one, i have DirectX11 with a texture that i can fill it with some information, in this case the .ttf info. But how do i need to open the .tff to tell the texture something like: "Hey, these are the coordinates you need, copy that pixels and fill yourself"?
  • 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!