欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > PPT文档下载
    分享到微信 分享到微博 分享到QQ空间

    Advanced D3D10 Rendering.ppt

    • 资源ID:378071       资源大小:257.50KB        全文页数:27页
    • 资源格式: PPT        下载积分:2000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要2000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Advanced D3D10 Rendering.ppt

    1、Advanced D3D10 Rendering,Emil PerssonMay 24, 2007,Advanced D3D10 Rendering,2,May 24, 2007,Overview,Introduction to D3D10 Rendering techniques in D3D10 Optimizations,Advanced D3D10 Rendering,3,May 24, 2007,Introduction,Best D3D revision yet! Clean and powerful API Lots of new features SM 4.0 New geom

    2、etry shader Stream Out Texture arrays Render to volume texture MSAA individual sample access Constant buffers Sampler state decoupled from texture unit Dual-source blending Etc,Advanced D3D10 Rendering,4,May 24, 2007,Clean API,Vista only Everything is mandatory (almost) No legacy hardware support Cl

    3、ean starting point for future evolution of the API Limited market short-term Some old features deprecated Fixed function Assembly shaders Alpha test Triangle fans Point sprites Clip planes,Advanced D3D10 Rendering,5,May 24, 2007,Dealing with deprecated features,Fixed function Write a few ber-shaders

    4、 Assembly shaders Convert to HLSL Alpha test Use discard or clip() in pixel shader Use alpha-to-coverage Triangle fans Seldom used anyway, usually just for a quad Convert to triangle list or strip Point sprites Expand point to 2 triangles in GS Clip planes Use clip distance and/or cull distance,Adva

    5、nced D3D10 Rendering,6,May 24, 2007,SM 4.0,Geometry shader Processes a full primitive (point, line, triangle) Has access to adjacency information (optional) Useful for silhouette detection, shadow volume extrusion etc. May output multiple primitives Output limitation is 1024 floats May output nothin

    6、g (to kill primitive),Advanced D3D10 Rendering,7,May 24, 2007,SM 4.0,Infinite instruction count Very long shaders may have lower throughput though Integer and bitwise instruction Indexable temporaries Allows for local arrays May be used to emulate a stack Useful system generated values SV_VertexID S

    7、V_PrimitiveID SV_InstanceID SV_Position (Like VPOS, but now .zw are defined too) SV_IsFrontFace (Like VFACE) SV_RenderTargetArrayIndex SV_ViewportArrayIndex SV_ClipDistance SV_CullDistance,Advanced D3D10 Rendering,8,May 24, 2007,SM 4.0,Integer ,Advanced D3D10 Rendering,9,May 24, 2007,Pixel center,Ha

    8、lf pixel offset is gone! Affects SV_Position as well Now matches OpenGLDX10 DX9,Advanced D3D10 Rendering,10,May 24, 2007,Pixel center,Pixels and texels align TexCoord = SV_Position.xy / float2(width, height)Texel center Screenspace,Advanced D3D10 Rendering,11,May 24, 2007,The small batch problem,D3D

    9、10 designed to minimize batch overhead Pulls work from draw time to creation time Validation Shader input/output configuration Immutable State Objects Input layout Rasterizer state Sampler state Depth stencil state Blend state,Advanced D3D10 Rendering,12,May 24, 2007,The small batch problem,D3D10 al

    10、so provides tools to reduce draw calls Improved instancing interface Geometry shader More shader resources Constant indexing in PS Render target arrays Texture arrays,Advanced D3D10 Rendering,13,May 24, 2007,Rendering techniques in D3D10,Advanced D3D10 Rendering,14,May 24, 2007,Global Illumination,A

    11、dvanced D3D10 Rendering,15,May 24, 2007,Global Illumination,Probes on a volume grid across the sceneEach probe captures light environment into a tiny “cubemap” Probes are converted to Spherical Harmonics coefficients Indirect lighting is computed using interpolated SH coefficients Do the same in pro

    12、be passes to get multiple light bounces,Advanced D3D10 Rendering,16,May 24, 2007,Global Illumination,Awful lot of work Each probe is 6 slices. We need loads of probes. Sample scene has over 300 probes Solution Use geometry shader to reduce work Distribute work across multiple frames Sample updates 4

    13、0 cubes per frame Scatter updates to hide artifacts Skip over “empty” space probes,Advanced D3D10 Rendering,17,May 24, 2007,Global Illumination,The Geometry Shader advantage 40 cubes x 6 faces x n draw calls = Pain DX9 style unrealistic even for simple scenes Update multiple slices per pass with GS

    14、GS output limit is 1024 floats Keep number of interpolators down to maximize primitive count Managed to update 5 probes (30 slices) per pass 8 passes is more manageable than 240 .,Advanced D3D10 Rendering,18,May 24, 2007,Post tone-mapping resolve,D3D10 allows for custom AA resolves Can drastically i

    15、mprove HDR AA quality Standard resolve occurs before tone-mapping Ideally resolve should be done after tone-mappingStandard resolve Custom resolve,Advanced D3D10 Rendering,19,May 24, 2007,Post-tonemapping resolve,Texture2DMS tHDR;float4 main(float4 pos: SV_Position) : SV_Targetint3 coord;coord.xy =

    16、(int2) pos.xy;coord.z = 0;/ Tone-map individual samples and sum it upfloat4 sum = 0;unrollfor (int i = 0; i SAMPLES; i+)float4 c = tHDR.Load(coord, i);sum.rgb += 1.0 exp2(-exposure * c.rgb);/ Averagesum *= (1.0 / SAMPLES);/ sRGBsum.rgb = pow(sum.rgb, 1.0 / 2.2);return sum;,Advanced D3D10 Rendering,2

    17、0,May 24, 2007,Optimizations,Advanced D3D10 Rendering,21,May 24, 2007,Geometry shader,GS optimizations Input/output usually the bottleneck Reduce outputs with frustum and/or backface culling Keep input small by packing data TexCoord could be 2x16 bits in an uint Or use for instance asuint(normal.w)

    18、Merge to full float4 vectors Dont do 2x float2 Keep output small Could be faster to trade for some work in PS Pass just position, dont interpolate both lightVec and viewVec Or even back-project SV_Position.xyz to world space in PS Small output means more work fits within 1024 floats limit,Advanced D

    19、3D10 Rendering,22,May 24, 2007,GS frustum and backface culling,/ Transform to clip spacefloat4 pos3;pos0 = mul(mvp, In0.pos);pos1 = mul(mvp, In1.pos);pos2 = mul(mvp, In2.pos);/ Use frustum culling to improve performancefloat4 t0 = saturate(pos0.xyxy * float4(-1, -1, 1, 1) - pos0.w);float4 t1 = satur

    20、ate(pos1.xyxy * float4(-1, -1, 1, 1) - pos1.w);float4 t2 = saturate(pos2.xyxy * float4(-1, -1, 1, 1) - pos2.w);float4 t = t0 * t1 * t2;branchif (!any(t)/ Use backface culling to improve performancefloat2 d0 = pos1.xy * pos0.w - pos0.xy * pos1.w;float2 d1 = pos2.xy * pos0.w - pos0.xy * pos2.w;branchi

    21、f (d1.x * d0.y d0.x * d1.y | min(min(pos0.w, pos1.w), pos2.w) 0.0)/ Output primitive here .,Advanced D3D10 Rendering,23,May 24, 2007,Miscellaneous optimizations,Pre-baked constant buffers Dont update per-material constants in DX9 style PS dont need to return float4 anymore Use float3 if you only car

    22、e about RGB May reduce instruction count Use GS to reduce draw calls Single pass render-to-cubemap Update multiple render targets per pass,Advanced D3D10 Rendering,24,May 24, 2007,The new shader compiler,SM4 shader compiler preserves semantics better This means more responsibility for you guys Be ca

    23、reful about your assumptions Periodically check the resulting assembly D3D10DisassembleShader() Use GPUShaderAnalyzer for performance critical shaders,Advanced D3D10 Rendering,25,May 24, 2007,The new shader compiler,HLSL code:float4 main(float4 t: TEXCOORD0) : SV_Targetif (t.x t.y)return t.xyzw;else

    24、return t.wzyx;,DX9 assembly:add r0.x, -v0.x, v0.ycmp oC0, r0.x, v0.wzyx, v0,DX10 assembly:lt r0.x, v0.y, v0.xif_nz r0.x / - Did you really want a branch here?mov o0.xyzw, v0.xyzwret else mov o0.xyzw, v0.wzyxret endif,Example:,Advanced D3D10 Rendering,26,May 24, 2007,The new shader compiler,Use branc

    25、h, flatten, unroll & loop to control output code This is not for everyone Poor use could reduce performance Make sure you know what youre doing Only use if youre familiar with assembly code Verify that you get the code you expect Always benchmark both options,New DX10 assembly (using flatten):lt r0.x, v0.y, v0.xmovc o0.xyzw, r0.xxxx, v0.xyzw, v0.wzyxret,Advanced D3D10 Rendering,27,May 24, 2007,Questions?,


    注意事项

    本文(Advanced D3D10 Rendering.ppt)为本站会员(wealthynice100)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1 

    收起
    展开