db123

Members
  • Content count

    115
  • Joined

  • Last visited

Community Reputation

222 Neutral

About db123

  • Rank
    Member
  1. This is often the case. The environment is often unwrapped on one or more textures. The environmap-geometry needs therefor an additional set of uv-coords and an association to the right lightmap. When rendering, you sample the lightmap like any other texture and use the information to simulate one or more lights. The most simplest way to render a lightmap is just to mulitply the light data with the underlying texture.   so i need save the uv information for every objects, when i render this object, i can use this uv to find the light info in that texture?
  2. i have a simple question about lightmap. i know lightmap save the static light information about a level, but how to save this information? is it save light info to one texture for a level? is it save light info to one texture for a light source? is it save light info to one texture for a level object? when i render the level, how to find the static light info from that texture? thank you~~
  3. I think that if i created a virtual machine which is support asm shader code, may be i can replay the pixel shader process
  4. i found there are two shader debugger: the first one : https://developer.nvidia.com/nv-shader-debugger the second one: pix for windows http://www.chromium.org/developers/how-tos/debugging/pix-for-windows   they can debug pixel shader code like cpu code, i want to know, what is the principle of this, if i want to implement a shader debugger, where is the start point?    
  5. thank you, i have implement it in ue3 with your method. i try to use a rendering method, but the camera can't move, so...
  6. [attachment=23568:1.jpg]   this picture is a gif, you can click it to view animation. [attachment=23569:2.gif]     [attachment=23570:3.jpg] [attachment=23571:4.jpg]
  7. i have notice that unreal engine have a transparent mask slot on its material root expression, and it implement this mask by discard instruction.   is this discard instruction or clip function equal to alpha test?     but in unity engine documents, it recommend use alphablend to implement transparent than alphatest, because alphatest is slowly than alphablend on mobile device.   what's the reason cause this phenomenon?
  8. void FD3D9EventQuery::IssueEvent() { if( Query ) { Query->Issue(D3DISSUE_END); } } void FD3D9EventQuery::WaitForCompletion() { if( Query ) { UBOOL bRenderingIsFinished = FALSE; while ( D3DRHI->GetQueryData(Query,&bRenderingIsFinished,sizeof(bRenderingIsFinished),TRUE) && !bRenderingIsFinished ) { } } }
  9. i fount unreal engine code here:   http://www.cabalchronicle.com/download/InfinityBlade_UE3_WIN&IOS_SRC_By_MeGaMaX/InfinityBlade/Development/Src/D3D9Drv/Src/D3D9Viewport.cpp void FD3D9DynamicRHI::EndDrawingViewport(FViewportRHIParamRef ViewportRHI,UBOOL bPresent,UBOOL bLockToVsync) { DYNAMIC_CAST_D3D9RESOURCE(Viewport,Viewport); SCOPE_CYCLE_COUNTER(STAT_D3D9PresentTime); GPUFrameTiming.EndTiming(); extern DWORD GGPUFrameTime; if ( GPUFrameTiming.IsSupported() ) { QWORD GPUTiming = GPUFrameTiming.GetTiming(); QWORD GPUFreq = GPUFrameTiming.GetTimingFrequency(); GGPUFrameTime = appTrunc( DOUBLE(GPUTiming) / DOUBLE(GPUFreq) / GSecondsPerCycle ); } else { GGPUFrameTime = 0; } check(DrawingViewport.GetReference() == Viewport); DrawingViewport = NULL; // Clear references the device might have to resources. Direct3DDevice->SetRenderTarget(0,*BackBuffer); Direct3DDevice->SetDepthStencilSurface(NULL); UnsetPSTextures(); UnsetVSTextures(); Direct3DDevice->SetVertexShader(NULL); ResetVertexStreams(); Direct3DDevice->SetIndices(NULL); Direct3DDevice->SetPixelShader(NULL); #if WITH_PANORAMA extern void appPanoramaRenderHookRender(void); // Allow G4WLive to render the Live Guide as needed (or toasts) appPanoramaRenderHookRender(); #endif // Tell D3D we're done rendering. Direct3DDevice->EndScene(); if(bPresent) { // Present the back buffer to the viewport window. HRESULT Result = S_OK; if(Viewport->IsFullscreen()) { Result = Direct3DDevice->Present(NULL,NULL,NULL,NULL); } else { RECT DestRect; if(GetClientRect((HWND)Viewport->GetWindowHandle(),&DestRect)) { RECT SourceRect; SourceRect.left = SourceRect.top = 0; SourceRect.right = Viewport->GetSizeX(); SourceRect.bottom = Viewport->GetSizeY(); // Only present to the viewport if its client area isn't zero-sized. if(DestRect.right > 0 && DestRect.bottom > 0) { Result = Direct3DDevice->Present(&SourceRect,NULL,(HWND)Viewport->GetWindowHandle(),NULL); } } } // Detect a lost device. if(Result == D3DERR_DEVICELOST || Result == E_FAIL) { // This variable is checked periodically by the main thread. bDeviceLost = TRUE; } else { VERIFYD3D9RESULT(Result); } } // Wait for the GPU to finish rendering the previous frame before finishing this frame. FrameSyncEvent.WaitForCompletion(); FrameSyncEvent.IssueEvent(); // If the input latency timer has been triggered, block until the GPU is completely // finished displaying this frame and calculate the delta time. if ( GInputLatencyTimer.RenderThreadTrigger ) { FrameSyncEvent.WaitForCompletion(); DWORD EndTime = appCycles(); GInputLatencyTimer.DeltaTime = EndTime - GInputLatencyTimer.StartTime; GInputLatencyTimer.RenderThreadTrigger = FALSE; } } what the effect of this code: FrameSyncEvent.WaitForCompletion(); FrameSyncEvent.IssueEvent(); if i comment them, the engine works well too.   so i want to know why they do this ?
  10. i have create a simple scene, a simple mesh with a simple point light, and compute lighting by phong mode. and then, i have create a simple hdr post process effect which is reference to the demo HDRRendering in nvidia sdk 10: http://developer.download.nvidia.com/SDK/10/direct3d/samples.html   but this technique just make my scene more brightness which include the dark area. and then , i find a article : HDRRenderingInOpenGL:   https://www.google.com.hk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=61&cad=rja&uact=8&ved=0CCYQFjAAODw&url=http%3a%2f%2ftransporter-game%2egooglecode%2ecom%2ffiles%2fHDRRenderingInOpenGL%2epdf&ei=LNlYU7ePMqWbigepqYDoDQ&usg=AFQjCNG4iEoIWlA-fC5e8skaUMJd-ErSDQ&bvm=bv.65397613,d.aGc   it said that if we want to use hdr, we must have a hdr input texture, and all the input textures in that demo is .hdr format.   if i create the render target by RGBA16F, and render my scene on this surface, is this surface a hdr input texture?
  11. in directx9, if i want to clear a surface, i must set this surface as current rendertarget, and clear it. but in directx11, there is a render target view. i find that some codes clear all rendertargetview before set them to be current render target: like this: void injectRSM( ID3D10Device *device, const ReflectiveShadowMap &rsm ) { stateBlock->Capture(); LPVs[0].clear( device ); LPVs[0].setRenderTarget( device ); // set the viewport D3D10_VIEWPORT viewport; viewport.TopLeftX = viewport.TopLeftY = 0; viewport.Width = width; viewport.Height = height; viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; device->RSSetViewports( 1, &viewport ); }   is there any difference about this order?
  12. i realize that in d3dx math library or xnamath library, there matrix is saved row major in memory. in effect framework, when we set a matrix parameter by effect interface setvarible, it will transpose the target matrix. if i am not use effect framework, i must set shader parameter by SetVertexConstantF...   but when i use effect framework, i must transform vertices by this code: OutPosition = mul( InPosition, mViewProj );  in normal shader code without effect framework, i must use: OutPosition = mul( mViewProj, InPosition ); if i change the order of this , it will work incorrectly.   i found some article, they sait that hlsl store matrix as column major. if it is true, i think i must use pre-multiply matrix: OutPosition = mul( mViewProj, InPosition ); but when i debug this in pix or nsight, i found that the marix parameter is store in register as it in the memory, for example: if mViewProj is: x0 y0 z0 w0 x1 y1 z1 w1 x2 y2 z2 w2 x3 y3 z3 w3 in vertex shader register: c0:x0 y0 z0 w0 c1:x1 y1 z1 w1 c2:x2 y2 z2 w2 c3:x3 y3 z3 w3   it looks like store as row major. why?     is this conflict with the basic rules of matrix multiplication:    column major: matrix * vec    row major : vec * matrix.          
  13. my operation system is windows 7 64bit sp1 graphics card : gtx660.