2.5




º®ËªÒýÇæµØÐÎäÖȾ




                   ʹÓÃý³Ì»¯×ÅÉ«




                                                                  Johan Andersson
                                   äÖȾ¼Ü¹Ê¦,ͼÐÎÒýÇæ²¿,EA DICE




                                                                                          battlefield
                                                                                                    Ȧ




                                                                                                         Ȧ




                                                                                         zXr0
                                                                                    Áã                        »á
Xbox 360 & PS3
·¨ÏßÂ˾µ




           ¼òµ¥&¿ìËÙĽ»²æ¹ýÂÆ÷




                                                                 ÔÚ¶½ÇÏßɲ»×¼È·,µ«ÒѾ-¹»ÓÃÁË




                                 ½á¹ûÊÇÀç¿Õ¼ä(world-space)·¨Ïß




                                 float3 filterNormal(float2 uv, float texelSize, float texelAspect)
                                 {
                                     float4 h;
                                     h[0] = hmap.Sample(bilSampler, uv + texelSize*float2( 0,-1)).r;
                                     h[1] = hmap.Sample(bilSampler, uv + texelSize*float2(-1, 0)).r;
                                     h[2] = hmap.Sample(bilSampler, uv + texelSize*float2( 1, 0)).r;
                                     h[3] = hmap.Sample(bilSampler, uv + texelSize*float2( 0, 1)).r;

                                                                       float3 n;
                                                                       n.z = (h[0] - h[3]) * texelAspect;
                                                                       n.x = (h[1] - h[2]) * texelAspect;
                                                                       n.y = 2;
                                                                       return normalize(n);
                                 }
Photoshop Overlay blend
                    Photoshopµþ¼ÓÈÚºÏ




                                             ʺÏÈÚ¸ßÆµ½




                                        µ±»ùãÕÚÖΪ0.0»ò1.0ʱ,²»Ó°ÏìÇøò




                                                                            ¶ÔÓگ̬Á÷¿ØÖƺÜÃ




                                                                                                                              ¸²ÇÈÚºÏóµÄ½á¹û
´ÓÆÂ¶ÈÖеýĻù¡ÕÚ

                                                                                                      ϸ½ÚÕÖ




                                                                         float overlayBlend(float base, float value, float opacity)
                                                                         {
                                                                             float a = base < 0.5 ? 2*base*value : 1 - 2*(1-base)*(1-value);
                                                                             return lerp(base, a, opacity);
                                                                         }
UndergrowthϵͳЧ¹û




No undergrowth          With undergrowth
16x16m cell
       cells
UndergrowthϵͳÄʱ´ú




           GPUäÖȾ4-8¸öµØÐβÄÖÊÕÚ¼°




µØÐη¨Ïß




                                        °üÀ¨CELL¸²¸ÇøÓò




                                                3x 64x64 ARGB8888 ¶àÄ¿±êäÖȾ




                                                                                                                                           Generated mask

           CPU/SPUɨÃèÕû¸ö²ÄÖʺ͵Àý·¼




                                                                               Ìî³äʵÀýת»ºåÇø




                                                                                                 Á¼ºÃµÄDX10Á÷Êä³ö




                                                                                                                                             Normalmap
More care for shader antialiasing
Battlefield
                 Ȧ    Õ½µØÐÂÎÅÍø
                      µã»÷Á´½Ó½øÈë
                  Ȧ
Áã                 »á

      zXr0
http://hi.baidu.com/h0nker




                      ÁªÏµµçÓÊ:johan.andersson@dice.se

寒霜引擎地形渲染使用过程化着色

  • 1.
    2.5 º®ËªÒýÇæµØÐÎäÖȾ ʹÓÃý³Ì»¯×ÅÉ« Johan Andersson äÖȾ¼Ü¹Ê¦,ͼÐÎÒýÇæ²¿,EA DICE battlefield Ȧ Ȧ zXr0 Áã »á
  • 5.
  • 19.
    ·¨ÏßÂ˾µ ¼òµ¥&¿ìËÙĽ»²æ¹ýÂÆ÷ ÔÚ¶½ÇÏßɲ»×¼È·,µ«ÒѾ-¹»ÓÃÁË ½á¹ûÊÇÀç¿Õ¼ä(world-space)·¨Ïß float3 filterNormal(float2 uv, float texelSize, float texelAspect) { float4 h; h[0] = hmap.Sample(bilSampler, uv + texelSize*float2( 0,-1)).r; h[1] = hmap.Sample(bilSampler, uv + texelSize*float2(-1, 0)).r; h[2] = hmap.Sample(bilSampler, uv + texelSize*float2( 1, 0)).r; h[3] = hmap.Sample(bilSampler, uv + texelSize*float2( 0, 1)).r; float3 n; n.z = (h[0] - h[3]) * texelAspect; n.x = (h[1] - h[2]) * texelAspect; n.y = 2; return normalize(n); }
  • 28.
    Photoshop Overlay blend Photoshopµþ¼ÓÈÚºÏ ÊºÏÈÚ¸ßÆµ½ µ±»ùãÕÚÖΪ0.0»ò1.0ʱ,²»Ó°ÏìÇøò ¶ÔÓگ̬Á÷¿ØÖƺÜà ¸²ÇÈÚºÏóµÄ½á¹û ´ÓÆÂ¶ÈÖеýĻù¡ÕÚ Ï¸½ÚÕÖ float overlayBlend(float base, float value, float opacity) { float a = base < 0.5 ? 2*base*value : 1 - 2*(1-base)*(1-value); return lerp(base, a, opacity); }
  • 43.
  • 45.
  • 46.
    UndergrowthϵͳÄʱ´ú GPUäÖȾ4-8¸öµØÐβÄÖÊÕÚ¼° µØÐη¨Ïß °üÀ¨CELL¸²¸ÇøÓò 3x 64x64 ARGB8888 ¶àÄ¿±êäÖȾ Generated mask CPU/SPUɨÃèÕû¸ö²ÄÖʺ͵Àý·¼ Ìî³äʵÀýת»ºåÇø Á¼ºÃµÄDX10Á÷Êä³ö Normalmap
  • 51.
    More care forshader antialiasing
  • 52.
    Battlefield Ȧ Õ½µØÐÂÎÅÍø µã»÷Á´½Ó½øÈë Ȧ Áã »á zXr0 http://hi.baidu.com/h0nker ÁªÏµµçÓÊ:johan.andersson@dice.se