HDR Defered Shading (using MRT)

http://http.download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/Direct3D9/DeferredShading.zip

HDR Deferred ShadingHDR Defered Shading (using MRT)

This sample shows high dynamic range (HDR) lighting combined with deferred shading. Deferred shading is a technique where the components of the lighting equation (surface attributes like the normal, position, albedo, etc.) are rendered into multiple screensized render targets (MRTs). Lighting is then done using geometrically simple passes over these MRT buffers, fetching the components of the lighting equation and outputting lighting results. This results in less shaded depth complexity, less geometry processing, better batching, and a cleaner rendering pipeline. The high dynamic range comes from the lighting passes being accumulated using fp16 blending into a floating point render target, after which tone mapping and a bloom effect are done using fp16 filtering to get the HDR results into the displayable 0..1 range.

  HDR Defered Shading (using MRT) HDR Defered Shading (using MRT)

HDR Defered Shading (using MRT)

User Guide

Video  
Download

MRT0: Diffuse

MRT1: Normals

MRT2: Depth

Final scene

If use vs2008 to compile, there is a compilation error as below:

fatal error C1083: :“dxerr9.h”: No such file or directory

这个问题主要是头文件中“dxerr9.h”是D3DX9的版本,而你有可能用了比它更新的版本,比如D10或者D11。因为在后续版本汇总把err头文件改成了“DxErr.h”这个可以到DirectX的安装目录/Include下去确认。所以需要改的是将相应的头文件和附加项改掉。

1、将头文件include<dxerr9.h>改成include<DxErr.h> 无关大小写;

2、将附加项中的DxErr9.lib改成DxErr.lib:如果你用的VS2008或者VS2010 Project/Properties/Linker/Input/Additional Dependencies , 然后打开改动。

这样就可以运行了。

Next error is about DirectSound8:

这个是因为win7和directx10及directx11不支持IDirectSound8,将IDirectSound8改为IDirectSound,LPDIRECTSOUND8改为LPDIRECTSOUND,反正碰到与sound相关的,将后面的8去掉,编译通过没问题

1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(36) : error C2143: 语法错误 : 缺少“;”(在“*”的前面)
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(36) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(36) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : error C2146: 语法错误 : 缺少“;”(在标识符“GetDirectSound”的前面)
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : error C2433: “CSoundManager::LPDIRECTSOUND8”: 不允许在数据声明中使用“inline”
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : warning C4183: “GetDirectSound”: 缺少返回类型;假定为返回“int”的成员函数
1>d:\\deferredshading\libs\inc\dxut\dxutsound.h(43) : error C2065: “m_pDS”: 未声明的标识符
1>d:\program files\microsoft visual studio 9.0\vc\include\tchar.h(26) : fatal error C1189: #error : Need to include strsafe.h after tchar.h

Next error :

=========

d:\program files\microsoft visual studio 9.0\vc\include\tchar.h(26) : fatal error C1189: #error :  Need to include strsafe.h after tchar.h

solution:  d:\deferredshading\demos\direct3d9\inc\shared\dxstdafx.h,  add the two line below before #include <d3d9.h>

#include <windows.h>

#include <tchar.h>

Now, compilation pass, but there is link error

1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "long __cdecl DXUTCreateWindow(wchar_t const *,struct HINSTANCE__ *,struct HICON__ *,struct HMENU__ *,int,int)" (?DXUTCreateWindow@@YAJPB_WPAUHINSTANCE__@@PAUHICON__@@PAUHMENU__@@HH@Z),该符号在函数 _WinMain@16 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "public: long __thiscall CDXUTDialog::AddStatic(int,wchar_t const *,int,int,int,int,bool,class CDXUTStatic * *)" (?AddStatic@CDXUTDialog@@QAEJHPB_WHHHH_NPAPAVCDXUTStatic@@@Z),该符号在函数 "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "public: long __thiscall CDXUTListBox::AddItem(wchar_t const *,void *)" (?AddItem@CDXUTListBox@@QAEJPB_WPAX@Z),该符号在函数 "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "public: long __thiscall CDXUTDialog::AddButton(int,wchar_t const *,int,int,int,int,unsigned int,bool,class CDXUTButton * *)" (?AddButton@CDXUTDialog@@QAEJHPB_WHHHHI_NPAPAVCDXUTButton@@@Z),该符号在函数 "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "long __stdcall DXUTTrace(char const *,unsigned long,long,wchar_t const *,bool)" (?DXUTTrace@@YGJPBDKJPB_W_N@Z),该符号在函数 "long __stdcall OnCreateDevice(struct IDirect3DDevice9 *,struct _D3DSURFACE_DESC const *,void *)" (?OnCreateDevice@@YGJPAUIDirect3DDevice9@@PBU_D3DSURFACE_DESC@@PAX@Z) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "wchar_t const * __cdecl DXUTGetDeviceStats(void)" (?DXUTGetDeviceStats@@YAPB_WXZ),该符号在函数 "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "public: long __thiscall CDXUTTextHelper::DrawTextLine(wchar_t const *)" (?DrawTextLine@CDXUTTextHelper@@QAEJPB_W@Z),该符号在函数 "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "wchar_t const * __cdecl DXUTGetFrameStats(void)" (?DXUTGetFrameStats@@YAPB_WXZ),该符号在函数 "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) 中被引用
1>DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号 "public: long __thiscall CDXUTStatic::SetText(wchar_t const *)" (?SetText@CDXUTStatic@@QAEJPB_W@Z),该符号在函数 "void __stdcall OnGUIEvent(unsigned int,int,class CDXUTControl *,void *)" (?OnGUIEvent@@YGXIHPAVCDXUTControl@@PAX@Z) 中被引用
1>../../bin/debug/DeferredShading.exe : fatal error LNK1120: 9 个无法解析的外部命令

dumpbin /ALL  DXUT.lib  > dxut.log, found the symbol name doesn't match btw *.obj and DXUT.lib

AE984 ?AddStatic@CDXUTDialog@@QAEJHPBGHHHH_NPAPAVCDXUTStatic@@@Z

6 ?__LINE__Var@?1??DXUTCreateWindow@@YAJPBGPAUHINSTANCE__@@PAUHICON__@@PAUHMENU__@@HH@Z@4JA

遇到个NV demo的 vs2008 链接问题
发现是符号名称不完全匹配,不知道vs的编译器是怎么产生symbol的有没有什么
DeferredShadingApp.obj : error LNK2019: 无法解析的外部符号"long __cdecl DXUTCreateWindow(wchar_t const *,struct HINSTANCE__ *,struct HICON__ *,struct HMENU__ *,int,int)" (?DXUTCreateWindow@@YAJPB_WPAUHINSTANCE__@@PAUHICON__@@PAUHMENU__@@HH@Z),该符号在函数_WinMain@16 中被引用
然后在DXUT.lib里
这个函数的符号名稍微有不同
DXUT.lib 里, 1594BC ?DXUTCreateWindow@@YAJPBGPAUHINSTANCE__@@PAUHICON__@@PAUHMENU__@@HH@Z

还是找NVDSK 9.5,然后重新编译DXUT再看看

http://developer.download.nvidia.com/SDK/9.5?M=A

上一篇:synchronize的心得


下一篇:redis list命令操作