kolarz3

Members
  • Content count

    37
  • Joined

  • Last visited

Community Reputation

164 Neutral

About kolarz3

  • Rank
    Member
  1. Hello guys, I try to use brakepoint in my shader file but visual tell me that he didnt see file with flags to debuging. I comppile shader with: D3DCompile(buffer.data(), buffer.size(), NULL, NULL, NULL, mainFucName, "ps_5_0", D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION, NULL, &PS_Buffer, &errorPS); In hlsl proporties in both shaders is enable debugging information and shader verision is 5_0. Project: http://www.dropbox.com/s/0wgbjqdxgvi2g1o/DirectXTest.rar  
  2. 3D Engine to analysis

    I need this engine to learning, I have't any special project. Very important for me is source code editor to learn more about architecture and relationship between engine and editor. I'm searching engine like Unity3D but not soooo large. Maybe like this: http://www.maratis3d.org/?p=343. It would be best if engine will be only for windows and written on DirectX 11 or 10.Do you have any suggestions?
  3. I searching for 3D engine with editor (engine and editor source code free ). This engine should be easy and I'd be good if project is on vs2010 and DirectX 11.
  4. Hello, I have the same problem that is in topic :). I have array with unsigned char "RGBABufor". I map this data to ID3D11Texture2D (only 20 sciles). When I try save this texture i have HRESULT : Unspecified error ID3D11Texture2D *defaultTex; D3D11_TEXTURE2D_DESC desc; ZeroMemory( &desc, sizeof(desc)); desc.Width = clip->getWidth(); desc.Height = 20; desc.MipLevels = desc.ArraySize = 1; desc.Format = DXGI_FORMAT_R8G8B8A8_UINT; desc.SampleDesc.Count = 1; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; engine.d3d11Device->CreateTexture2D( &desc, NULL, &defaultTex ); D3D11_MAPPED_SUBRESOURCE mapResource; engine.d3d11DevCon->Map(defaultTex,0,D3D11_MAP_WRITE_DISCARD,0,&mapResource); BYTE* mappedData = reinterpret_cast<BYTE*>(mapResource.pData); memcpy(mappedData,RGBABufor, clip->getWidth()*20*4); engine.d3d11DevCon->Unmap(defaultTex, 0); hr=D3DX11SaveTextureToFile(engine.d3d11DevCon,defaultTex,D3DX11_IFF_PNG,L"obraz.png"); This is fragment of "mappedData", 3 pixels: ùùùÿùùùÿùùùÿ This looks good. Where is problem ... ?    
  5. bool ModelData::createDefaultMaterial() { struct Pix { float r,g,b,a; }; Pix* img; img=new Pix[256*256]; for(int y=0;y<256;y++)for(int x=0;x<256;x++){img[y*256+x].r=1.0;img[y*256+x].g=0.0;img[y*256+x].b=0.0;img[y*256+x].a=1.0;} D3D11_TEXTURE2D_DESC desc; ZeroMemory( &desc, sizeof(desc)); desc.Width = 256; desc.Height = 256; desc.MipLevels = desc.ArraySize = 1; desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; desc.SampleDesc.Count = 1; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; ID3D11Texture2D *pTexture = NULL; engine.d3d11Device->CreateTexture2D( &desc, NULL, &pTexture ); D3D11_MAPPED_SUBRESOURCE mapResource; engine.d3d11DevCon->Map(pTexture,0,D3D11_MAP_WRITE_DISCARD,0,&mapResource); BYTE* mappedData = reinterpret_cast<BYTE*>(mapResource.pData); memcpy(mappedData, img, 256*256*4*sizeof(float)); engine.d3d11DevCon->Unmap(pTexture, 0); D3DX11SaveTextureToFile(engine.d3d11DevCon,pTexture,D3DX11_IFF_PNG,L"nazwaa.png"); return TRUE; } Problem is solved. I must change Format to DXGI_FORMAT_R32G32B32A32_FLOAT
  6. Hello, i try to generate texture progrmically. Everything looks good, but when I save texture to file I'm disappointed. I expected red texture but i got this:    Code: bool ModelData::createDefaultMaterial() { struct Pix { float r,g,b,a; }; Pix* img; img=new Pix[256*256]; for(int y=0;y<128;y++)for(int x=0;x<256;x++){img[y*256+x].r=1.0;img[y*256+x].g=0.0;img[y*256+x].b=0.0;img[y*256+x].a=1.0;} D3D11_TEXTURE2D_DESC desc; ZeroMemory( &desc, sizeof(desc)); desc.Width = 256; desc.Height = 256; desc.MipLevels = desc.ArraySize = 1; desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.SampleDesc.Count = 1; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; ID3D11Texture2D *pTexture = NULL; engine.d3d11Device->CreateTexture2D( &desc, NULL, &pTexture ); D3D11_MAPPED_SUBRESOURCE mapResource; engine.d3d11DevCon->Map(pTexture,0,D3D11_MAP_WRITE_DISCARD,0,&mapResource); BYTE* mappedData = reinterpret_cast<BYTE*>(mapResource.pData); memcpy(mappedData, img, 256*256*4); engine.d3d11DevCon->Unmap(pTexture, 0); D3DX11SaveTextureToFile(engine.d3d11DevCon,pTexture,D3DX11_IFF_PNG,L"nazwaa.png"); return TRUE; }
  7. I didnt see any texture adds in DirectX SDK. I have 2010 version. But I'd like program that also load mesh and change UV cords. 
  8. I download 3d model from free website. But thay have multi texture. I want to link this into one texture(and I would't want have problem with mipmap). How can I this generate? Almost I use 3ds or obj format.
  9. Helo guys, I try to turn on opacity texture. In close model look good, but in the distance I see artifacts. Maybe mipmaps help ? I try to turn on this mipmap but I dont known that this work ? This is clip on yt : http://www.youtube.com/watch?v=cfvxJ8dGHaQ. D3DX11_IMAGE_LOAD_INFO info; //ZeroMemory( &info, sizeof(info) ); info.BindFlags= D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; info.MiscFlags=D3D11_RESOURCE_MISC_GENERATE_MIPS; info.MipLevels=D3DX11_DEFAULT ; D3DX11CreateShaderResourceViewFromFile( d3d11Device,sw,&info, NULL, &texture, NULL );//diffuse D3DX11CreateShaderResourceViewFromFile( d3d11Device,sw,&info, NULL, &texture2, NULL );/opacity D3D11_SAMPLER_DESC sampDesc; ZeroMemory( &sampDesc, sizeof(sampDesc) ); sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; sampDesc.MinLOD = 0; sampDesc.MaxLOD = D3D11_FLOAT32_MAX; d3d11Device->CreateSamplerState( &sampDesc, &CubesTexSamplerState );//sampler state of textures //This call per frame d3d11DevCon->GenerateMips(texture); d3d11DevCon->GenerateMips(texture2); //PS fragment if(opacity.Sample( ObjSamplerState, input.UVcord ).x>=0.5)psOut.Color=diffuse.Sample( ObjSamplerState, input.UVcord ); else clip(psOut.Color.a-1.1);
  10. Anyway "Color* obj = (Color*)mapResource.pData;" do the same that "memcpy(obj, mapResource.pData,mapResource.RowPitch*Height);"
  11. But in this case we must to cast data from D3D11_MAPPED_SUBRESOURCE to BYTE.
  12. Now everything work.I found also thet all rows of pixel have extra 4 pixel data(I dont known what they mean) . If anybody later searching for solution I put code . void Pick(ID3D11Texture2D* texture) { ID3D11Texture2D* textureBuf; D3D11_TEXTURE2D_DESC textureDesc; ZeroMemory(&textureDesc, sizeof(textureDesc)); textureDesc.Width = Width; textureDesc.Height = Height; textureDesc.MipLevels = 1; textureDesc.ArraySize = 1; textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; textureDesc.SampleDesc.Count = 1; textureDesc.SampleDesc.Quality = 0; textureDesc.Usage = D3D11_USAGE_STAGING; textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; textureDesc.MiscFlags = 0; d3d11Device->CreateTexture2D(&textureDesc, NULL, &textureBuf); d3d11DevCon->CopyResource(textureBuf,texture); D3D11_MAPPED_SUBRESOURCE mapResource; hr=d3d11DevCon->Map(textureBuf,0,D3D11_MAP_READ,NULL,&mapResource); struct Color {float r, g, b, a;}; Color* obj; obj=new Color[(mapResource.RowPitch/sizeof(Color))*Height]; memcpy(obj, mapResource.pData,mapResource.RowPitch*Height); if(mousePos.x>0&&mousePos.x<Width&&mousePos.y>0&&mousePos.y<Height) if(obj[(mousePos.y*Width)+(4*mousePos.y)+mousePos.x].r==1.0/*If object that we was pick mouse have 1.0 on red bit we draw little cloud*/)model.rysujOtoczk?(model.dolny,model.gorny); d3d11DevCon->Unmap(textureBuf,0); textureBuf->Release(); delete [] obj; }
  13. I dont known why i cant move pointer of my structer. Any solution ? struct Color { float r, g, b, a; }; Color* obj; obj=new Color[mapResource.RowPitch*Height]; BYTE* mappedData = reinterpret_cast<BYTE*>(mapResource.pData); for(UINT i = 0; i < Height; ++i) { memcpy(obj, mappedData, mapResource.RowPitch); mappedData += mapResource.RowPitch; obj += mapResource.RowPitch;//without this line program work }
  14. I cant copy anything because debuger stop on memcpy, if I continue debuging visual jump into memcpy.asm file : rep movsd ;N - move all of our dwords memcpy(obj,mapResource.pData,mapResource.RowPitch); Edit: I forget to allocate memory/
  15. Now work(with copying with "obj=(Color *)mapResource.pData;"), but I don't known why I cant copy with memcpy. How can I copy this data with memcpy? memcpy ( obj,mapResource.pData, sizeof(Color) );