SlideShare a Scribd company logo
1 of 52
Download to read offline
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

More Related Content

Viewers also liked

Verona prof dev presentation singleton elad 540
Verona prof dev presentation singleton elad 540Verona prof dev presentation singleton elad 540
Verona prof dev presentation singleton elad 540Tracey Singleton
 
Courses not offered in verona
Courses not offered in veronaCourses not offered in verona
Courses not offered in veronaTracey Singleton
 
Sample letter ap program initiative
Sample letter ap program initiativeSample letter ap program initiative
Sample letter ap program initiativeTracey Singleton
 
寒霜引擎渲染架构与即时渲染程序的过程生成技术
寒霜引擎渲染架构与即时渲染程序的过程生成技术寒霜引擎渲染架构与即时渲染程序的过程生成技术
寒霜引擎渲染架构与即时渲染程序的过程生成技术zXr0
 
游戏的实时辐射度光能传递架构
游戏的实时辐射度光能传递架构游戏的实时辐射度光能传递架构
游戏的实时辐射度光能传递架构zXr0
 

Viewers also liked (11)

Apib gold star status
Apib gold star statusApib gold star status
Apib gold star status
 
Amartya Sen
Amartya SenAmartya Sen
Amartya Sen
 
Verona prof dev presentation singleton elad 540
Verona prof dev presentation singleton elad 540Verona prof dev presentation singleton elad 540
Verona prof dev presentation singleton elad 540
 
Courses not offered in verona
Courses not offered in veronaCourses not offered in verona
Courses not offered in verona
 
Tata Motors
Tata MotorsTata Motors
Tata Motors
 
Sample letter ap program initiative
Sample letter ap program initiativeSample letter ap program initiative
Sample letter ap program initiative
 
Mossad
MossadMossad
Mossad
 
Amartya Sen
Amartya SenAmartya Sen
Amartya Sen
 
Automobiles
AutomobilesAutomobiles
Automobiles
 
寒霜引擎渲染架构与即时渲染程序的过程生成技术
寒霜引擎渲染架构与即时渲染程序的过程生成技术寒霜引擎渲染架构与即时渲染程序的过程生成技术
寒霜引擎渲染架构与即时渲染程序的过程生成技术
 
游戏的实时辐射度光能传递架构
游戏的实时辐射度光能传递架构游戏的实时辐射度光能传递架构
游戏的实时辐射度光能传递架构
 

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

Similar to 寒霜引擎地形渲染使用过程化着色 (7)

Shibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼうShibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼう
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
Set
SetSet
Set
 
Td
TdTd
Td
 
Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案
 
とちぎRuby会議01(原)
とちぎRuby会議01(原)とちぎRuby会議01(原)
とちぎRuby会議01(原)
 
Lesson 32: Simplex Method II
Lesson 32: Simplex Method IILesson 32: Simplex Method II
Lesson 32: Simplex Method II
 

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

  • 1. 2.5 º®ËªÒýÇæµØÐÎäÖȾ ʹÓÃý³Ì»¯×ÅÉ« Johan Andersson äÖȾ¼Ü¹Ê¦,ͼÐÎÒýÇ沿,EA DICE battlefield Ȧ Ȧ zXr0 Áã »á
  • 2.
  • 3.
  • 4.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 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); }
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 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); }
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 44.
  • 45. 16x16m cell cells
  • 46. UndergrowthϵͳÄʱ´ú GPUäÖȾ4-8¸öµØÐβÄÖÊÕÚ¼° µØÐη¨Ïß °üÀ¨CELL¸²¸ÇøÓò 3x 64x64 ARGB8888 ¶àÄ¿±êäÖȾ Generated mask CPU/SPUɨÃèÕû¸ö²ÄÖʺ͵Àý·¼ Ìî³äʵÀýת»ºåÇø Á¼ºÃµÄDX10Á÷Êä³ö Normalmap
  • 47.
  • 48.
  • 49.
  • 50.
  • 51. More care for shader antialiasing
  • 52. Battlefield Ȧ Õ½µØÐÂÎÅÍø µã»÷Á´½Ó½øÈë Ȧ Áã »á zXr0 http://hi.baidu.com/h0nker ÁªÏµµçÓÊ:johan.andersson@dice.se