Jump to content
  • Advertisement

NEvOl

Member
  • Content Count

    31
  • Joined

  • Last visited

Community Reputation

178 Neutral

About NEvOl

  • Rank
    Member
  1. NEvOl

    PCSS

    somebody, please help. How calculate relation between (lightSize and distance) and sizeWindowSample ???
  2. NEvOl

    PCSS

    Hi all. I trying make PCSS with use whitepaper: http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf  http://developer.download.nvidia.com/shaderlibrary/docs/shadow_PCSS.pdf  But i can't understand what is  NEAR_PLANE 9.5  LIGHT_WORLD_SIZE .5  LIGHT_FRUSTUM_WIDTH 3.75   in first whitepaper in the HLSL code, and can't understand what is the formulas: searchWidth = LIGHT_SIZE_UV * (zReceiver - NEAR_PLANE) / zReceiver and filterRadiusUV = penumbraRatio * LIGHT_SIZE_UV * NEAR_PLANE / coords.z. Please help me.
  3. NEvOl

    Render to texture

    all work on the nVidea GPU, but on the intel i have bugs  creatin fbo      glGenTextures(1, @tex);     glBindTexture(GL_TEXTURE_2D, tex);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, w, h, 0, GL_RGBA, GL_FLOAT, nil);     glBindTexture(GL_TEXTURE_2D, 0);       glGenFramebuffers(1, @fbo);     glBindFramebuffer(GL_FRAMEBUFFER, fbo);       glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);     if glCheckFramebufferStatus(GL_FRAMEBUFFER) <> GL_FRAMEBUFFER_COMPLETE then       tex := 0;   rendering, plane:   glBindFramebuffer(GL_FRAMEBUFFER, fbo);   glClearColor(0.0, 1.0, 0.0, 0.0);   glClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT);   glViewport(0, 0, Round(w), Round(h));   glUseProgram(inProg);     glBindBuffer(GL_ARRAY_BUFFER, vbo);   glVertexAttribPointer(aPosLocIn, 3, GL_FLOAT, ByteBool(0), 0, 0);   glEnableVertexAttribArray(aPosLocIn);     glDrawArrays(GL_TRIANGLES, 0, 6);     glBindFramebuffer(GL_FRAMEBUFFER, 0);   glClearColor(1.0, 0.0, 0.0, 0.0);   glClear(GL_COLOR_BUFFER_BIT);     glUseProgram(outProg);     glBindBuffer(GL_ARRAY_BUFFER, vbo);   glVertexAttribPointer(aPosLocOut, 3, GL_FLOAT, ByteBool(0), 0, 0);   glEnableVertexAttribArray(aPosLocOut);     glActiveTexture(GL_TEXTURE0);   glBindTexture(GL_TEXTURE_2D, fbo);   glUniform1i(uTexLocOut, 0);     glDrawArrays(GL_TRIANGLES, 0, 6);
  4. Hi all, I have a problem. I trying rendering to texture on GPU Intel HD 4000 by using functions floatBitsToInt and intBitsToFloat, but allways written in texture is 0. how to solve this problem? Testing program. write vs.glsl #version 400 attribute vec3 aPosition; void main() {  gl_Position = vec4(aPosition.xyz, 1.0); } ps.glsl void main() {  uint a = uint(100);  float b = uintBitsToFloat(a);  gl_FragColor = vec4(b, 0.0, 1.0, 1.0); } read vs.glsl #version 400 attribute vec3 aPosition;   varying vec2 t; void main() { t = aPosition.xy; gl_Position = vec4(aPosition.xyz, 1.0); } ps.glsl uniform sampler2D texture; varying vec2 t;   void main() { float b = floatBitsToUint(texture2D(texture, t).x);     gl_FragColor = vec4(b); }
  5. NEvOl

    msaa

    Hi, i try add msaa to my project, but eglChooseConfig(g_display, configAttributes, &config, 1, &countConfig) returning countConfig = 0, how i can check support msaa ? code: EGLint configAttributes[] =     {         EGL_RED_SIZE,       8,         EGL_GREEN_SIZE,     8,         EGL_BLUE_SIZE,      8,         EGL_ALPHA_SIZE,     8,         EGL_DEPTH_SIZE,     24,         EGL_STENCIL_SIZE,   8, EGL_SAMPLE_BUFFERS, 1, EGL_SAMPLES,        4,         EGL_NONE     };   if(EGL_FALSE == eglChooseConfig(g_display, configAttributes, &config, 1, &countConfig)) || countConfig != 1) { MB(L"eglChooseConfig - Failed"); return 0; }  
  6. ID3D11Query *pQuery_TD; D3D11_QUERY_DESC qd_td; ZeroMemory(&qd_td, sizeof(qd_td)); qd_td.MiscFlags = 0; qd_td.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;   UINT64 dataQuery_t = 0;   size_t size = sizeof(long double);   HRESULT hr;   if(FAILED(g_pDevice->CreateQuery(&qd_td, &pQuery_TD))) { MessageBox(NULL, L"CreateQuery_TD - Failed", NULL, NULL); }   g_pDeviceContext->Begin(pQuery_TD);   ID3D11Query *pQuery_T; D3D11_QUERY_DESC qd_t; ZeroMemory(&qd_t, sizeof(qd_t)); qd_t.MiscFlags = 0; qd_t.Query = D3D11_QUERY_TIMESTAMP;   if(FAILED(g_pDevice->CreateQuery(&qd_t, &pQuery_T))) { MessageBox(NULL, L"CreateQuery_T - Failed", NULL, NULL); }   while(S_OK == g_pDeviceContext->GetData(pQuery_T, &dataQuery_t, sizeof(UINT64), 0)) { }   Render();   while( S_OK == g_pDeviceContext->GetData(pQuery_T, &dataQuery_t, sizeof(UINT64), 0)) { }   g_pDeviceContext->End(pQuery_TD);   while( S_OK == g_pDeviceContext->GetData(pQuery_TD, &dataQuery_t, sizeof(UINT64), 0)) { } data is not returning(
  7. what type of data used to D3D11_QUERY_TIMESTAMP_DISJOINT query ?
  8. How to calculate time rendering on the graphics card, like there is interface allowing it to make ?
  9. NEvOl

    Anisotropic filtering

    What can you say about EWA filter, whether it is good for the software implementation ?
  10. i trying generate texture2d using function CeateTexture2D: ID3D11Texture2D* CreateTexture2D(ID3D11Device *pDevice, ID3D11Texture2D *srcText) { D3D11_TEXTURE2D_DESC srcTD; ZeroMemory(&srcTD, sizeof(srcTD)); srcText->GetDesc(&srcTD);   UINT width = srcTD.Width/2; if(!width) width = 1; UINT height = srcTD.Height/2; if(!height) height = 1; float stepU = srcTD.Width/(float)width; float stepV = srcTD.Height/(float)height; float sUV = stepU*stepV;   int sizeVBox = ceil(stepV); int sizeUBox = ceil(stepU); struct ColorTexels { XMCOLOR color; float weight; ColorTexels() { weight = 0; } }; ColorTexels **colorBox = new ColorTexels*[sizeVBox]; for(int i = 0; i < sizeVBox; i++) colorBox[i] = new ColorTexels[sizeUBox];   XMCOLOR *dstBuffTexels = new XMCOLOR[width * height];   D3D11_MAPPED_SUBRESOURCE ms; ZeroMemory(&ms, sizeof(ms));   if(FAILED(g_pd3d11DeviceContext->Map(srcText, 0, D3D11_MAP_READ, 0, &ms))) return 0;   XMCOLOR *srcBuffTexels = new XMCOLOR[srcTD.Width * srcTD.Height];   memcpy(srcBuffTexels, ms.pData, ms.DepthPitch);   g_pd3d11DeviceContext->Unmap(srcText, 0);   for(int i = 0; i < height; i++) for(int j = 0; j < width; j++) { float bU = stepU * j; float eU = bU + stepU;   float bV = stepV * i; float eV = bV + stepV;   float sumU = bU, sumV = bV; float sU, sV; dstBuffTexels[width*i+j] = 0;   for(int k = 0; k < sizeVBox; k++) { for(int q = 0; q < sizeUBox; q++) { colorBox[k][q].color = srcBuffTexels[srcTD.Width*((int)bV+k) + (int)bU+q];   if((int)(bU+q) + 1 <= stepU + bU) sU = (int)(bU+q) + 1 - sumU; else sU = eU - (int)eU;   if((int)(bV+k) + 1 <= stepV+ bV) sV = (int)(bV+k) + 1 - sumV; else sV = eV - (int)eV;   sumU += sU;   colorBox[k][q].weight = (sU*sV)/sUV;   } sumU = bU; sumV += sV; } for(int e = 0; e < sizeVBox; e++) for(int r = 0; r <sizeUBox; r++) { colorBox[e][r].color.b *= colorBox[e][r].weight; colorBox[e][r].color.r *= colorBox[e][r].weight; colorBox[e][r].color.g *= colorBox[e][r].weight; dstBuffTexels[width*i+j] = dstBuffTexels[width*i+j] + colorBox[e][r].color; }   }   delete []srcBuffTexels;   for(int i = 0; i < sizeVBox; i++) delete []colorBox[i]; delete []colorBox;   ID3D11Texture2D *text = NULL;   D3D11_SUBRESOURCE_DATA sd; ZeroMemory(&sd, sizeof(sd)); sd.pSysMem = (void*)dstBuffTexels; sd.SysMemPitch = width*sizeof(dstBuffTexels); sd.SysMemSlicePitch = width*height*sizeof(dstBuffTexels);   D3D11_TEXTURE2D_DESC td; ZeroMemory(&td, sizeof(td));     td.Width = width;     td.Height = height;     td.MipLevels = 1;     td.ArraySize = 1;       td.SampleDesc.Count = 1;     td.SampleDesc.Quality = 0;     td.Usage = D3D11_USAGE_STAGING;     td.Format = DXGI_FORMAT_R8G8B8A8_UNORM;     td.BindFlags = 0;   td.CPUAccessFlags = D3D11_CPU_ACCESS_READ;     td.MiscFlags = 0;     if(FAILED(pDevice->CreateTexture2D(&td, &sd, &text))) { delete []dstBuffTexels; return 0; } else { delete []dstBuffTexels; return text; } } if source texture is not large all working correctly, but if use texture with resolution 2048?2048 or 1200x900 then an exception: Access violation reading location. here: for(UINT i = 0; i <= numMipLevel; i++) { D3D11_MAPPED_SUBRESOURCE ms; ZeroMemory(&ms, sizeof(ms)); if(FAILED(g_pd3d11DeviceContext->Map(g_pMassTextures[i], 0, D3D11_MAP_READ, 0, &ms))) break;   g_pd3d11DeviceContext->UpdateSubresource(textArray, D3D11CalcSubresource(0, i, 1), 0, ms.pData, ms.RowPitch, ms.DepthPitch);//here there  an exception on second iteration   g_pd3d11DeviceContext->Unmap(g_pMassTextures[i], 0); } here's all the code: D3DX11_IMAGE_LOAD_INFO ili; ZeroMemory(&ili, sizeof(ili)); ili.BindFlags = 0; ili.Height = D3DX11_FROM_FILE; ili.Format = DXGI_FORMAT_R8G8B8A8_UNORM; ili.Width = D3DX11_FROM_FILE; ili.Depth = D3DX11_FROM_FILE; ili.FirstMipLevel = 0; ili.MipLevels = 1; ili.BindFlags = 0; ili.CpuAccessFlags = D3D11_CPU_ACCESS_READ; ili.Usage = D3D11_USAGE_STAGING; ili.MiscFlags = 0; ili.Filter = D3DX11_FILTER_NONE; ili.MipFilter =  D3DX11_FILTER_NONE; ili.pSrcInfo = 0;   ID3D11Texture2D *pSrcText2D;   if(FAILED(D3DX11CreateTextureFromFile(g_pd3d11Device, L"1.jpg", &ili, NULL, (ID3D11Resource**)&pSrcText2D, NULL))) return 0;   int numMipLevel = CreateMipMap(pSrcText2D);   D3D11_TEXTURE2D_DESC td; pSrcText2D->GetDesc(&td);   ID3D11Texture2D *textArray = 0; D3D11_TEXTURE2D_DESC tdArray;   ZeroMemory(&tdArray,sizeof(tdArray)); tdArray.ArraySize = numMipLevel+1; tdArray.Format = td.Format; tdArray.Height = td.Height; tdArray.Width = td.Width; tdArray.CPUAccessFlags = 0; tdArray.MiscFlags = 0; tdArray.SampleDesc.Count = 1; tdArray.SampleDesc.Quality = 0; tdArray.Usage = D3D11_USAGE_DEFAULT; tdArray.BindFlags = D3D11_BIND_SHADER_RESOURCE; tdArray.MipLevels = td.MipLevels;   if(FAILED(g_pd3d11Device->CreateTexture2D(&tdArray, NULL, &textArray))) return 0; for(UINT i = 0; i <= numMipLevel; i++) { D3D11_MAPPED_SUBRESOURCE ms; ZeroMemory(&ms, sizeof(ms)); if(FAILED(g_pd3d11DeviceContext->Map(g_pMassTextures[i], 0, D3D11_MAP_READ, 0, &ms))) break;   g_pd3d11DeviceContext->UpdateSubresource(textArray, D3D11CalcSubresource(0, i, 1), 0, ms.pData, ms.RowPitch, ms.DepthPitch);//here there is an exception on second iteration   g_pd3d11DeviceContext->Unmap(g_pMassTextures[i], 0); }   int CreateMipMap(ID3D11Texture2D *texture) { D3D11_TEXTURE2D_DESC td;   texture->GetDesc(&td);   UINT width = td.Width; UINT height = td.Height;   float numMipLevel = (int)(log10((float)width)/log10((float)2));   if((int)(log10((float)height)/log10((float)2)) > numMipLevel) numMipLevel = (int)log10((float)height)/log10((float)2);     g_pMassTextures.push_back(texture);   for(int i = 1; i <= numMipLevel; i++) g_pMassTextures.push_back(CreateTexture2D(g_pd3d11Device, g_pMassTextures[i-1]));       return numMipLevel; }
  11. NEvOl

    software generation Mip map

    I correctly create texture in function CreateTexture2D ?
  12. NEvOl

    software generation Mip map

    I think main priblem in CreateTexture2D function.
  13. NEvOl

    software generation Mip map

    for(UINT i = 0; i <= numMipLevel; i++) { D3D11_MAPPED_SUBRESOURCE ms; ZeroMemory(&ms, sizeof(ms)); if(FAILED(g_pd3d11DeviceContext->Map(g_pMassTextures[i], 0, D3D11_MAP_READ, 0, &ms))) break;   g_pd3d11DeviceContext->UpdateSubresource(textArray, D3D11CalcSubresource(0, i, 1), 0, ms.pData, ms.RowPitch, ms.DepthPitch);//here there  an exception on second iteration   g_pd3d11DeviceContext->Unmap(g_pMassTextures[i], 0); }
  14. NEvOl

    software generation Mip map

    somebody help please, i don't understand, what the problem(
  • 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!