15. Art of mobile game.
• 2011年,仅由包括我在内的两名开发者开发的原型。Unity3D 3.0
原型开发:3D艺术家一名 + 本人
被当选为NVIDIA TEGRA 4 Global contents
2011年的当时,也称为次世代
游戏最重要的还是趣味性,比较乏味
所以,收益不好
16. Art of mobile game.
• 在2011年,其实,也对Shader做了诸多的的改善。
• 特别是金属质感表现,或者皮肤表现等。
17. Art of mobile game.
• 适用于手游美术的Shader?
• 2012年,大多数的智能手机仅支持opengl-es 2.0。
• 2014年,随着opengl-es 2.0 extention版本的登场,部分旗舰机型开始支持opengl-es
3.0。
• 2016年之后,支持opengl-es 3.0以上的机型比重急剧上涨。
• 未来,支持opengl-es 3.1以上的智能手机会成为主流登场。
• 智能手机厂商也得拿出新的卖点,也会大力开展Vulkan营销。
• 照相机像素的竞争已经走到尽头了,剩下的就是显卡性能了。
• 电池在2016年更新过一次,暂时应该不会有大的动静。(除非等苹果开发完成wifi充
电技术。)
18. Art of mobile game.
• 手游美术中常用的Matcap shader.(Paraboloid view dependency shader)
• 性能层面的好处:尽管命令不少,实际从性能层面考虑,性价比还是挺高的。
也因2005年Pixologic Zbrush中应用的材质球系统而出名。
19. Art of mobile game.
• 手游美术中常用的Matcap shader.(Paraboloid view dependency shader)
https://www.clicktorelease.com/code/spherical-normal-mapping/#
20. Art of mobile game.
• 手游美术中常用的Matcap shader.(Paraboloid view dependency shader)
• 性能层面的好处:尽管命令不少,实际从性能层面考虑,性价比还是挺高的。
• 始于2004年发表的Parabolic reflection。
• 优点:
• 运算快(完全代替灯光)
• 缺点:
• 灯光效果从属于视角方向。
21. Art of mobile game.
• 手游美术中常用的Matcap shader.(Paraboloid view dependency shader)
• 应用案例(韩国)
• 多数2.5D游戏都有使用
• 自行修正效果使用。
跑男 (2012年) : 手游 测试Demo (2012年) : 手游
22. Art of mobile game.
• 手游美术中常用的Matcap shader.(Paraboloid view dependency shader)
• 重要的是制作怎样的Matcap lit-sphere信息来使用。
存在多种制作方法。
• 可以手工在Photoshop里面画。
用Matcap creation工具来制作。(http://www.zbrushcentral.com/showthread.php?92157-MaCrea-Material-Creation-
Tool)
• 在Zbrush中使用Grab来确保素材。
• Perspective correction中是有问题的
23. Art of mobile game.
• Compare of Reflection method.
Source build for Compare through LYS from Knald tech.
24. Art of mobile game.
• Compare of Reflection method.
Source build for Compare through LYS from Knald tech.
25. Art of mobile game.
• Compare of Reflection method.
Matcap with debugging coordinate.
26. Art of mobile game.
• Compare of Reflection method.
Matcap Direct access reflection probe Roughness map combined
27. Art of mobile game.
• Compare of Reflection method.
• 非Standard shader的时候,给粗糙度贴图乘以常数2.5左右的值。
28. Art of mobile game.
• Matcap shader.(Parabolic view dependency shader)的扩展
Dual paraboloid mapping.
Real-time rendering-Third edition.
29. Art of mobile game.
• Dual Matcap shader.(Dual Paraboloid view in-dependency shader的扩展
• 相比于Cubemap,手机设备性能层面是有优势的。(特别是实时捕捉的时候)
2015年,Eurographics会议上,Gratin开发者们发表过实际应用案例。
• 本人在实现过程中也检索到了。– 看来大家的想法都类似。
C.J. Zubiaga, A. Muñoz, L. Belcour, C. Bosch and P. Barla / MatCap Decomposition forDynamic Appearance Manipulation / The Eurographics Association 2015.
30. Art of mobile game.
• Dual Matcap shader.(Dual Paraboloid view in-dependency shader)的扩展
• Experimental of Debug view
// calculate the front paraboloid map texture coordinates
float2 front;
front.x = R.x / (R.z + 1);
front.y = R.y / (R.z + 1);
front.x = .5f * front.x + .5f; //bias and scale to correctly sample a d3d texture
front.y = -.5f * front.y + .5f;
// calculate the back paraboloid map texture coordinates
float2 back;
back.x = R.x / (1 - R.z);
back.y = R.y / (1 - R.z);
back.x = .5f * back.x + .5f; //bias and scale to correctly sample a d3d texture
back.y = -.5f * back.y + .5f;
float4 forward = tex2D( FrontTex, front ); // sample the front paraboloid map
float4 backward = tex2D( BackTex, back ); // sample the back paraboloid map
float4 finalColor = max(forward, backward);
http://members.gamedev.net/JasonZ/Paraboloid/DualParaboloidMappingInTheVertexShader.pdf
34. Art of mobile game.
• Tweak mesh normal to each vertex
• 没有法线贴图,网格顶点很小的时候,Matcap表现的错误是比较严重的。
• 以整体块感为基准,调整顶点法线信息。
35. Art of mobile game.
• Tweak mesh normal to each vertex
• 变形的顶点信息用来表现角色的高低远近。
• 以整体块感为基准,调整顶点法线信息。
36. Art of mobile game.
• Progress node graph structure.
37. Art of mobile game.
• Using vertex color data.
• Radiosity data to vertex.
• Store vertex color data from Radiosity.
Radiosity Lighting
Mesh vertex
Baking vertex color
Get vertex color
Composite with pixel
Shader side
DCC Side
38. Art of mobile game.
• Using vertex color data.
Radiosity Lighting
Mesh vertex
Baking vertex
color
Get vertex color
Composite with
pixel
Shader side
DCC Side
39. Art of mobile game.
• Using vertex color data.
Radiosity Lighting
Mesh vertex
Baking vertex
color
Get vertex color
Composite with
pixel
Shader side
DCC Side
42. Art of mobile game.
• 获取SH信息 (Access of Spherical Harmonic data information )
Setting to Light Probes
Light setup
Bake Light map
Store into LightingData as Binary
Get SH data via
SphericalHarmonicsL2[]
Debugging to SH data table.
SH 9 Coefficient.
SH coefficient * 9 vector interpolation = 27 value stored
light probe
Direct access through shader code : half3 ShadeSH9 (half4 normal) {}
43. Art of mobile game.
• 根据需要的灯光信息烘培
• Generally pbr shading on mobile devices does not enough evident expression of shading.
• Using Baked Lighting it very useful for evident shading on mobile but that is not essential.
44. Art of mobile game.
• Press to C key You guys could be see to baked shading from Base Color.
• Substance Painter currently provide kind of two option of baked lighting filters such as baked lighting and baked lighting environment.
• This is new feature of baked lighting.
• Just turn on to color that will be use to
composite layer or some stuff if you useable.
• 根据需要的灯光信息烘培
49. Mobile PBR Look-dev for intermediate.
• 为艺术家制作标准场景
• 尽可能还原Substance Painter的工作环境。
• IBL选定工作
• White balance.
• 精密度设定
• Unity 5.6 LookDev的使用
50. Mobile PBR Look-dev for intermediate.
• White Balance
PBR中环境光是比较重要的。
• 为了设定质感,要选用已经进行白平衡处理的IBL素材来使用。
Wrong white balance Corrected white balance
51. Mobile PBR Look-dev for intermediate.
• TC = Kelvin = Color temperature
• TC值越高,越蓝,TC值越低越红。
• 和主美一起选定标准工作用色温。
一般在[Daylight – Direct mid summer sunlight] 和 [Average Summer Sunlight]之间决定。
정.
52. Mobile PBR Look-dev for intermediate.
• Color temperature check.
• Overcast daylight和Clear blue-sky sunlight IBL source的Color temperature check。
在Asset store中下载Unity technology提供的IBL素材。
• 直接使用HDR panorama摄影的时候,用LightRoom和Photomatrix等来尽可能校正白平衡。
53. Mobile PBR Look-dev for intermediate.
• Color temperature check.
• 使用Color chart。
54. Mobile PBR Look-dev for intermediate.
• Color temperature check.
Unity3D 5.6 experimental LookDev - 白色颜色和Colour check.
59. Mobile PBR Look-dev for intermediate.
Same IBL with same exposure value.
Back and Front lighting compare with single IBL.
Using unity3D 5.6 LOOK DEV
Different IBL with same exposure value.
Different IBL with Different exposure value.
60. Mobile PBR Look-dev for intermediate.
• 2015年以后发售的大部分手机硬件都支持PBR
• Iphone 5s以上
• 安卓SDK4.3以上
• Opengl es 2.0 extension中部分机型支持PBR
Texcubelod( )
Texcubebias( )
ddxx , ddyy 大部分不支持,支持😞
• PBR渲染跟线性空间渲染、Tone mapping、HDR等都有密切的关系。
结论就是要确保PBR渲染的稳定性的话,推荐使用Opengl es 3.X以上。
62. Essential of optimizing and tip.
• IPC评测和比较
• 在PowerVR 6芯片组和PowerVR 8芯片组中都编译进行了比较。
• 提升速度的芯片组ALU结构改善和编译器。
Features
•Architecture improvements for better DDR compatibility
•Full support for Compute APIs – OpenCL1.2 EP,
OpenVX1.1, Vulkan1.0
•Broad and complete graphics API support – OpenGL ES
1.1/2.0/3.2, Vulkan1.0
•Extended Design Optimization Kit (DOK)s – Enabling
wide range of clock frequencies across process
technologies
•Hardware virtualization
•Hardware security
63. Essential of optimizing and tip.
• Shader code unit test with disassemble…
• IPC
• 即每一时钟周期内所执行的指令多少。
• Test tool : PowerVR tools & SDK.
• ((rimFactor * rimFactor) + (rimFactor * (rimFactor * 0.425))) * _RimPower * _GlowColor;
//half r_c = pow(rimFactor , _RimPower) * _GlowColor; 是power函数代码
64. Essential of optimizing and tip.
• Light Model 用 Basic Lambert lighting model.
• Select compiler
66. Essential of optimizing and tip.
• PVRShaderEditor Disassembly check ( Before Optimal )
Per-line Cycle Estimate Total : 32/26f : Series 6 31/24f : Series 8XE
67. Essential of optimizing and tip.
• PVRShaderEditor Disassembly check ( After Optimal )
Per-line Cycle Estimate Total : 31 : Series 6 30 : Series 8XE
75. Essential of optimizing and tip.
• VBO Compare
• 要确认顶点信息数量会随着UV Shell结构的不同而不一样。
• 保证UV Shell的最小化对于VBO或者性能都是有帮助的。
114 verts 120 verts
76. Essential of optimizing and tip.
• Normal texture issues…
• Standard shader最终执行归一化。
• Mobile shader最终不执行归一化。
Uncompressed PNG or TGA
Normal data type = bumpmap
DXTnm for PC platform as DX11 Swizzle R to W as normal.xy to normal.wy
Packednormal for opengl-es
Standard shader have normalizing
o.Normal = normalize(o.Normal);
o.Normal = unpackNormal(X); //not normalize
Compressed normal texture
(PVRTC,ETC,ASTC,ATC,DXT)
Compression affect to modulated
of T-space information
White point artifact of specular shading on mobile
devices.
1. o.Normal = normalize(unpackNormal(X));
77. Essential of optimizing and tip.
• Normal texture issues…
• 贴图格式别,视觉化评测
• 现象确认
• 检查法线贴图资源本身有没有问题
before after
78. Essential of optimizing and tip.
Pre normalized just texture result but compressed result
have ugly from pvrtc.
Additional Normalized in shader code result that pretty
good. But some loss to performance.
Pre normalized just texture and compressed via ASTC
is little better than PVRTC
Not normalize and 24bit true with half sizing texture
used that pretty nice but some loss to small detail.
Mobile screen is so small size compare to pc monitor.
• Normal texture issues…
• 试验的最终目标是不在Mobile shader上面增加关于像素法线的归一化命令。
79. Essential of optimizing and tip.
• Normal texture issues…
UnpackNormalDXT5nm : PCE : 8UnpackNormal : PCE : 6
80. Essential of optimizing and tip.
• Normal texture issues…
• 格式别容量和指令增加与否的比较。
FORMAT SIZE BANDWIDTH OF MEM Requirement of
instructor
RGB PVRTC 4bit 1024 0.7mb normalize
RGB ASTC 4*4 1024 1.3mb normalize
True24bit 512 0.98mb none
今天演讲的主题主要可以分为三部分。
因为演讲时间有限,所以我把这三点也做了浓缩。
其实,我们平时接触的大多数图形学技术,都可以通过谷歌社区、GDC、SIGGRAPH等,检索到相关发表过的论文,很多都是我们已经知道的内容。
如果,在位的哪位对图形学有兴趣的话,那么,当你读完GPU PRO 7为止的话,就会觉得,大部分现阶段流行的Shader技法,其实也没有那么难。
更何况,Shader技术以PBR为基点,逐渐在此范围之内得到广泛的应用,2018年,程序式处理技法应该会成为流行趋势。
接下里,我们再以回顾的心态,来着重谈谈Shader和美术表现。
Art of mobile game 에서는 아티스트를 위한 과거와 현재 그리고 미래를 이야기 합니다.
당연히 미술적인 표현에 중점을 뒀습니다.
Essential of optimizing shader for expert 에서는 세이더 디자이너가 알면 좋을 에뮬레이터 상에서 세이더 코드를 디어셈블리 확인 하며 명령어를 최소화 하는 접근을 다룹니다.
Mobile PBR Look-dev for intermediate 에서는 유니티 5.6 에 추가 된 Look-Dev 을 살펴 보고 HDR 표준 정보의 White point balance 그리고 관계 된 몇 가지 PBR 에 대한 내용들을 살펴 볼 것입니다.
对于手游美术这块,想为艺术家们讲下过去、现在、将来,当然主要集中于美术表现。
作为专家,必须要知道的Shader优化方法主要包含了以下内容,确认代码反汇编,优化使用最少的指令。
最后一部分的话,我们主要一起来看下Unity5.6中新增的Look-Dev,HDR标准信息的White point balance和其有关的几个PBR相关的内容。