Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Tunisia hawker

Member Since 16 Nov 2011
Offline Last Active Jul 24 2013 01:23 AM

Posts I've Made

In Topic: How to orthogonalize to non-orthogonal matrix using HLSL

25 January 2013 - 12:36 AM

you have the matrix you are sending to the shader right? can't you do it in C++ code and send the resulting matrix as an extra parameter to the shader?

I can't.The matrix itself was generate in shader.In fact, I 'm trying to do normal mapping without precomputed tangent attribute in vertex buffer.The technique can be found in ShaderX5, Chapter2.6.It provides a non-orthogonal tangent-to-local matrix,so I'm trying to get the local-to-tangent matrix so that I can do lighting calculations in tangent space.

In Topic: UV mirror issues with normalmap , using nonprecomputed tangent space calculating

13 November 2012 - 09:59 PM

Thanks for replying my problem.
Things are not the way I thought.The problem is not about UV seams at all,but the UV directions.The truth is I was using directx sampling texture directions to calculate my Binormal,that is having a V direction from top to down.But I haven't check my resources.They are bulit in Maya,which have a down-to-top V direction.So it's OK with color and fails correct normal mapping.Without my artist,I could never know this.Posted Image

In Topic: How to modify the surface data using LockRect

04 September 2012 - 02:58 AM

My mistake.More time spend when modifing data,so the render data for next frame wasn't updated properly, which bothered me 2 days.

In Topic: How to modify the surface data using LockRect

03 September 2012 - 06:36 PM

It runs without errror or any waring,but shows wrong result.
I rendered some colorful particles to the RT and saved it to file.But when I modified the pixel before saving,the colors of particles all change to yelllow(the start color).I guess maybe something happens when surface being wirtten,or the calculation takes too much time during locking rect and cause problem.
[source lang="java"]LPDIRECT3DTEXTURE9 pCopyTexture = NULL; LPDIRECT3DSURFACE9 pCopySurface = NULL; g_pd3dDevice->CreateTexture(width,height,0,D3DUSAGE_DYNAMIC,D3DFMT_A8R8G8B8,D3DPOOL_SYSTEMMEM,&pCopyTexture,NULL); pCopyTexture->GetSurfaceLevel(0,&pCopySurface); hResult = g_pd3dDevice->GetRenderTargetData(pRenderSurface,pCopySurface); D3DLOCKED_RECT rect; if(S_OK == pCopySurface->LockRect(&rect,NULL,D3DLOCK_DONOTWAIT)) { DWORD* pColor = (DWORD*)rect.pBits; for( UINT y = 0 ; y < height ; y++ ) { for(UINT x = 0 ; x < width ; x++ ) { DWORD color = pColor[y*rect.Pitch/4+x]; D3DCOLOR dwcolor = color; //D3DXCOLOR fColor = Color2Value(dwcolor); //if(fColor.a > 0) //{ // fColor.r /= fColor.a; // fColor.g /= fColor.a; // fColor.b /= fColor.a; // float radio = 1; // if(fColor.r > radio) // radio = fColor.r; // if(fColor.g > radio) // radio = fColor.g; // if(fColor.b > radio) // radio = fColor.b; // fColor.r /= radio; // fColor.g /= radio; // fColor.b /= radio; // fColor.a /= radio; //} //dwcolor = Value2Color(fColor); pColor[y*rect.Pitch/4+x] = dwcolor; } } pCopySurface->UnlockRect(); } hResult = D3DXSaveSurfaceToFile(pTexPathName,texFormat,pCopySurface,NULL,NULL); g_pd3dDevice->SetRenderTarget(0,pBackBuffer);[/source]
Here is my new code,copy data to another surface in system memory and get colorful paticles.And I get yellow paticles with comment code.I'm not sure of D3DLOCK flag here.
Btw,I was trying to get a non-premultiplied alpha texture of 3D rendering scenes.So here I used separate alpha calculating but not good for Add blend mode(src is SRCALPHA,dest is ONE).Any suggestions will be great thankful.

In Topic: Location of D3DTS_WORLD value in register

27 August 2012 - 07:18 PM

Thanks! I'll change my code anyway.