Readme.rtf 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. {\rtf1\ansi\ansicpg1252\deff0\deftab709{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
  2. {\colortbl ;\red192\green192\blue192;\red0\green153\blue255;\red102\green102\blue102;\red0\green0\blue0;}
  3. {\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\cf1\lang1033\b\i\f0\fs14\par
  4. \cf0\b0\i0\fs24\par
  5. \par
  6. \cf2\b\i\fs18\par
  7. \cf0\b0\i0\fs24\par
  8. \pard\qc\cf2\b\i\fs18\par
  9. \b0\i0\fs52 Hard Surface Shader Pack \par
  10. \cf1\b\i\fs18 All assets and shader code created by Bruno Rime for the Unity3D engine.\cf0\b0\i0\par
  11. \cf1\b\i Email Address brunorime@gmail.com\par
  12. \par
  13. \pard\cf2\i0 Hard Surface Shader Pack Overview\i\fs24\par
  14. \cf0\b0\i0\fs20\par
  15. \fs18 The Hard Surface shader pack has been designed to reproduce the surface and lighting qualities of any hard surface, including reflections, refractions, specular highlights, light transfer and much more. Perfect for special effects and presentation pieces .\par
  16. \fs24\par
  17. \fs18 The shader pack is ideal for applications where surfaces such as glass, metals, plastics, ceramics or even waxes need to be reproduced. The pack is available in three formats, each tailored to suit your own budget and requirements. \par
  18. \par
  19. \cf2\b\fs24 Feature Descriptions\b0\i\par
  20. \cf0\i0\fs18\par
  21. \cf2\b Shader Model 2 Fallback.\par
  22. \cf0\b0 A feature that enables the shader pack to run on older and some mobile platforms, when Shader Model 3 hardware is unavailable.\par
  23. \i\fs16\par
  24. \cf2\b\i0\fs18 Upgrade & Downgrade Compatible\cf0\b0\fs24\par
  25. \fs18 All Hard Surface shaders are interchangeable and will allow you to swap shaders on the fly to suit your performance or visual requirements without having to re-adjust your material properties.\par
  26. \fs24\par
  27. \cf2\b\fs18 Non Additive Reflections\par
  28. \cf0\b0 The method used in the Hard Surface Shader pack differs from the standard reflection model in that it always ensures the light reflected from a surface is never more than the total light energy of the scene. What does this mean for you? Quite simply it means that your reflections won't blow out in brightly lit scenes, while the same material will work properly in all lighting conditions. Finally, it's possible to easily create white reflective surfaces, without major headaches.\par
  29. \par
  30. \cf2\b Opaque & Transparent Variations & Light Transfer\cf0\b0\par
  31. Because of the unique way that the shader pack has been designed, it is now easy to reproduce not only Opaque or Transparent surfaces, but everything in between as well. Semi-translucent surfaces, such as wax and porcelain, are able to be emulated using the Opaque shader set where the alpha property controls light transfer, but retains opacity. The Transparent shader set allows for Opacity & Light Transfer to occur, giving you full control over surfaces such as Glass or gems like jade etc.\par
  32. \cf3\i\fs16\par
  33. \cf2\b\i0\fs18 Diffuse, Alpha, Bump Specular, Gloss, Reflection Properties and Masks\cf0\b0\fs24\par
  34. \fs18 The Hard Surface shader pack features multiple variations of all the above combinations utilizing both slider properties and texture masks, giving you the ability to choose the exact feature set you require for your application without having to carry any extra performance overheads.\par
  35. \fs24\par
  36. \cf2\b\fs18 Metallic Reflections\cf0\b0\par
  37. A unique feature of the Hard surface shader pack is the metallic reflections property. It allows you to capture how reflections differ on surfaces of varying conductivity. A range of surfaces from gold to plastic can be achieved accurately and most importantly, easily.\par
  38. \cf2\b\par
  39. Fresnel Reflections\cf0\b0\f1\fs24\par
  40. \f0\fs18 For many surfaces the more obtuse the reflection angle becomes the more reflective the surface appears. The Fresnel reflection slider enables you to control these types of reflections to achieve a greater level of realism.\par
  41. \cf2\b\par
  42. Edge Alpha\par
  43. \cf0\b0 To capture surfaces like wax it is important to have control over both the light transfer and opacity of surface edges. The Edge Alpha property gives you this control.\par
  44. \cf3\i\fs16\par
  45. \cf0\i0\fs18\par
  46. \cf2\b Z-primed Transparent Surfaces.\par
  47. \cf0\b0 This feature ensures that back facing surfaces won't draw over front facing surfaces. It also cleans up ugly internal faces that might normally ruin a great looking asset. This is especially important on complex shapes like characters.\fs24\par
  48. \pard\qc\cf2\b\fs18\par
  49. \pard Uncompiled Shaders (Standard & Pro only)\par
  50. \cf0\b0 You paid for it, so you get full access to the Hard Surface Shader Code. Fully commented shaders and .cginc files will enable you to customize and merge Hard surface shaders with your own. Whether it's for professional, educational or just for your own curiosity, the full architecture is available for you to use.\par
  51. \fs24\par
  52. \cf2\b\fs18 Back-face rendering (Standard & Pro only)\par
  53. \cf0\b0 An important addition to the Standard & Pro packs for replicating transparent surfaces is back-face rendering combined with Z priming. This allows for glitch free rendering of complex and detailed surfaces. On Direct X platforms using Shader model 3, back faces also feature a simple light diffusion effect based on opacity.\par
  54. \cf3\i\fs16\par
  55. \pard\qc\cf0\i0\par
  56. \pard\cf2\b\fs18 Draw First & Draw Last Variations (Standard & Pro only)\par
  57. \cf4\b0 Shader variations to get you out of a tangle when the unity render refuses to play nicely. Forces the draw order of the Surface to ensure it renders when you need it to, especially useful for special effects or when you have multiple transparent/reflective surfaces that you need greater control over.\par
  58. \cf0\f1\fs24\par
  59. \cf2\b\f0\fs18 Screen Space Real-time Reflection (Pro Only)\par
  60. \cf4\b0 Reflects any visible surface to the camera without having to re-render the scene! Fast and effective on any curved surface. Works particularly well on cars and characters. No scripts or extra scene management required. Takes into consideration all Hard surface reflective properties including Fresnel influence and Texture masks.\par
  61. \cf0\fs24\par
  62. \cf2\b\fs18 Screen Space Real-time Refraction (Pro Only)\par
  63. \cf4\b0 Refracts any surface drawn before and behind the refractive surface. Comes with a Density property slider and takes into consideration all Hard Surface properties. It even self-refracts internal and back facing surfaces.\par
  64. \cf3\i\fs16\par
  65. \cf2\b\i0\fs18 Chromatic Aberration (Pro Only)\par
  66. \cf4\b0 Simulates the separation of Red, Green & Blue light through refractive surfaces. A key visual indicator of a surface's density.\par
  67. \cf3\i\fs16\par
  68. \cf0\i0\fs18\tab\tab\tab\tab\tab\tab\par
  69. \cf2\b\fs24 FAQ\par
  70. \fs18\par
  71. \i\fs20 Advantages of screen spaced reflections.\par
  72. \i0\par
  73. \fs18 How is it that Screen space reflections are so much faster to render than other methods?\par
  74. \cf4\b0 Screen space reflections utilize the existing frame buffer to generate the reflection, where as other methods require the scene to be redrawn to a render texture from the point of view of each asset. In some applications traditional reflections require up to 6 scene redraws per reflective asset, often resulting in very poor frame-rates. \par
  75. \cf0\fs24\par
  76. \cf2\b\fs18 Are Screen space reflections self reflecting?\par
  77. \cf4\b0 Screen space reflections are self reflecting, unlike most other methods. This is an advantage for complex shapes where self reflection adds an extra layer of realism to the result.\par
  78. \cf2\par
  79. \b How is it that you are able to render normally expensive effects like chromatic aberration without the cost?\par
  80. \cf4\b0 Once the 2D reflection vector has been calculated, it is very easy to modify to create special effects. In the case of the chromatic aberration,\b \b0 the vector is merely scaled to look up each of the RGB components of the light source. For a traditional 3D reflection vector, each look up for the RGB components would require a complete recalculation of the reflection vector.\par
  81. \cf2\par
  82. \b Will screen spaced techniques work with augmented reality?\par
  83. \cf4\b0 Yes it will, because of the 2D nature of the effect. Any image source can be used to generate the reflection and or refraction. Your virtual objects can literally be reflecting or refracting your real world real-time captures!\par
  84. \cf0\fs24\par
  85. \cf2\b\fs18 Will the world pos have an effect on my reflective assets and batching?\par
  86. \cf4\b0 No it won't. Unlike traditional methods that render the scene from the position of the reflective asset, Screen Space techniques don't generate any asset specific render targets. Because of this, multiple assets can share the same material and exist in completely unrelated world positions. If these assets are marked static in the Unity editor, they will batch render, saving you draw calls and gaining you performance.\par
  87. \cf2\b\par
  88. \b0\par
  89. \b\i\fs20 Limitations of screen space reflections.\par
  90. \i0\fs18\par
  91. Why aren\rquote t the screen space reflections always visible from all angles?\par
  92. \cf4\b0 Screen space techniques utilize what's visible to the camera. In the case of the reflections, only objects visible to the camera can be reflected in other surfaces. To fill in the gaps, the Hard surface shaders fall back to a cube map when the reflection vector points towards the camera.\par
  93. \cf2\b\par
  94. \b0\fs24 \b\fs18 I'm getting stretched reflections on flat surfaces?\b0\fs24\par
  95. \cf4\fs18 This artifact is a limitation of the screen space technique, which is essentially a 2D effect. Because there is very little angle variation on flat surfaces, the 2D reflection vector will remain relatively fixed over the surface. This results in the stretching effect. I recommend using other reflection techniques to achieve mirror perfect floor reflections. However if the reflection is subtle enough or warped by a normal map, the screen space technique will often be satisfactory and many times faster to render. It's worth noting that the Hard surface shaders can utilize cube maps with real-time updates should you choose to create them.\par
  96. \cf2\par
  97. \b Some Transparent surfaces aren\rquote t being reflected in my opaque surfaces?\par
  98. \cf4\b0 Because the reflection is generated from a screen capture, if the Asset hasn\rquote t been drawn yet, it can't be reflected. Transparent surfaces are normally drawn after opaque surfaces, resulting in the reflection not being visible.\par
  99. \cf0\fs24\par
  100. \cf2\b\i\fs20 Known Issues.\par
  101. \fs18\par
  102. \i0 Depth based image effects don't always work with transparent assets.\par
  103. \cf4\b0 Currently Unity 3.3 doesn\rquote t recognize assets in the transparent render-queue that have zwrite enabled, this results in effects like DOF overwriting them. As this wasn't the case in Unity 3.2 and it also happens with the standard unity shaders I am unable to offer a solution. I am working with the Unity developers to resolve this issue.\par
  104. \cf0\fs24\par
  105. \cf2\b\fs18 Depth based image effects will occasionally and randomly flip the grabpass buffer.\par
  106. \cf4\b0 The Unity developers are aware of this bug and are currently working on a fix. Unfortunately, it is very hard to reproduce consistently, which has made it difficult to track down. Again this bug is not limited to the Hard Surface shader package and also exists in the standard Unity shaders / image effects.\par
  107. \cf0\fs24\par
  108. \cf2\b Tips & Tricks\cf0\b0\par
  109. \cf2\b\par
  110. \fs18 Performance\par
  111. \cf4\b0\par
  112. \cf0 Hard surface shaders are forward lighting based, even so, they will work perfectly in a deferred lighting scene. Because of this, the biggest performance impact on the shaders comes from the number of lights the surface interacts with. Try to keep this as low as possible. (I'm looking into the possibility of creating deferred based versions of the opaque shaders for a future release)\par
  113. \fs24\par
  114. \fs18 Whenever possible, mark your assets as static in the Unity Editor. This will enable the Unity Engine to batch render objects that share the same material. This greatly reduces draw calls and improves performance.\par
  115. \fs24\par
  116. \fs18 Use only the shader variation that you need to. A great feature of the Hard surface shader package is the large selection of shader variations. Each shader has been optimized for its specific application and it is well worth selecting the specific shader for the task. The image below shows how effective lower specification shaders can look if used the right way.\fs24\par
  117. \f1\par
  118. \cf2\b\f0 Material Editor Properties\cf0\b0\f1\par
  119. \cf4\f0\fs18\par
  120. \cf2\b Main Colour (Red, Green, Blue, Alpha)\par
  121. \cf4\b0 RGB: Multiplies the diffuse colour or texture. Also determines the amount of light reflected or absorbed. Black = 100% absorption, white = 100% light reflected or transferred.\par
  122. \cf0\fs24\par
  123. \fs18 A: Multiplies the Diffuse Alpha. Also determines the amount of light transfer. 0 alpha = 100% light transfer, 256 alpha = no light transfer. On Transparent surfaces the Alpha value also determines the surfaces transparency and the amount of diffusion for back-face detail on D3D hardware.\par
  124. \fs24\par
  125. \cf4\i\fs18 Tip:\par
  126. \pard\li420\cf3\i0 Use low alpha values with high RGB values to produce bright glass.\par
  127. \pard\fi438 A low alpha value while using an opaque shader will produce a wax like effect and let the light pass through the surface.\par
  128. \pard\cf4\par
  129. \cf2\b Specular Colour (Red, Green, Blue)\par
  130. \cf4\b0 Multiplies the lights source's Specular colour.\par
  131. \cf0\fs24\par
  132. \cf4\i\fs18 Tip:\par
  133. \pard\li420\cf3\i0 Make the specular colour similar to the Diffuse/Main colour for a Metallic surface effect.\par
  134. \pard\li427 Use specular colours that are different to the Diffuse/Main colour to create pearl like paint effects.\par
  135. \pard\cf0 Use a White specular colour to create plastic like surfaces.\f1\fs24\par
  136. \cf4\f0\fs18 \par
  137. \cf2\b Shininess Slider\b0\f1\fs24\par
  138. \cf4\f0\fs18 Modifies the specular highlight falloff size. (Left: Large broad highlight, Right: Concentrated small highlight)\par
  139. \cf0\fs24\par
  140. \cf4\i\fs18 Tip:\par
  141. \pard\li420\cf3\i0 The more polished a surface the smaller the specular highlight should be.\par
  142. \pard\fi438\cf0 Very diffuse surfaces like chalk have a very broad specular highlight.\par
  143. \pard\cf4\par
  144. \cf2\b Gloss Slider\par
  145. \cf4\b0 Slide the slider from left to right to modify the intensity of the specular highlight. (Left: no highlight, Right: full intensity highlight)\par
  146. \cf0\fs24\par
  147. \cf4\i\fs18 Tip:\par
  148. \pard\li420\cf3\i0 Gloss and reflection are very similar. Normally a very glossy surface will also be very reflective.\par
  149. \pard\cf4\par
  150. \cf2\b Reflection Slider\par
  151. \cf4\b0 Modifies the overall strength of the reflections. (Left: No reflections, Right: Full reflections)\par
  152. \cf0\fs24\par
  153. \cf2\b\fs18 Reflection Cube map\par
  154. \cf4\b0 A texture that is used to represent distant object reflections. Also helps Pro screen space reflections by creating an impression of the reflection sources that are behind the camera.\par
  155. \cf0\fs24\par
  156. \cf4\i\fs18 Tip:\par
  157. \pard\li420\cf3\i0 Simple reflection maps often look better than noisy complicated ones.\par
  158. \pard\li427 Often the Sky-box texture for a scene makes an ideal Reflection Cube map.\par
  159. \pard\cf4\par
  160. \cf0\fs24\par
  161. \cf2\b\fs18 Fresnel Reflection Slider\par
  162. \cf4\b0 Boosts the reflection & gloss value based on surface normal and camera/eye vector. Fall off for the Fresnel Reflection is controlled by the Fresnel/Edge Alpha Falloff Slider. (Left: No Fresnel reflection, Right: Strong Fresnel reflection)\par
  163. \cf0\fs24\par
  164. \cf4\i\fs18 Tip: \par
  165. \pard\li420\cf3\i0 Even very diffuse surfaces at obtuse angles to the eye can be quite reflective. Subtle use of Fresnel reflection on even chalky surfaces can add a great deal of realism.\par
  166. \pard\li404 Clever use of Fresnel Reflection can be used to create a refined version of rim lighting, which also looks more realistic and reacts better to extreme lighting conditions. This is very handy for surfaces like Hair.\par
  167. \pard\cf4\par
  168. \cf2\b Edge Alpha Slider\par
  169. \cf4\b0 Modifies the Alpha of a surface using the Fresnel/Edge Alpha Falloff value.\par
  170. \cf0\fs24\par
  171. \cf4\i\fs18 Tip:\par
  172. \pard\li420\cf3\i0 Use the Edge/Alpha slider to let more light pass through the areas of a surface the are perpendicular to the camera. Useful for Wax and ceramic like surfaces.\par
  173. \pard\cf4\par
  174. \cf2\b Metallic Slider\par
  175. \cf4\b0 The more conductive a surface is, the more it will tint the reflection by its diffuse colour. (Left: Reflection will be the sources colour, Right: Reflection will be tinted by the diffuse colour)\par
  176. \cf0\fs24\par
  177. \cf4\i\fs18 Tip:\par
  178. \pard\li420\cf3\i0 Plastics, waxes and ceramics are not very conductive and won't tint a reflection very much.\par
  179. \pard\li438\cf0 Metals such as gold are very conductive and tint reflections almost completely.\par
  180. \pard\cf4\par
  181. \cf2\b Diffuse Texture Map\par
  182. \cf4\b0 (RGB) Use to create per pixel diffuse colour variation. (A) Use to set opacity and light transference properties.\par
  183. \cf0\fs24\par
  184. \cf4\i\fs18 Tip:\par
  185. \pard\li420\cf3\i0 A Diffuse texture that features RGB variation and has little to no alpha will still show interesting surface variations on transparent surfaces. It can be used to create streaks and highlights that will only show under specific lighting conditions such as being back lit\cf4 .\par
  186. \pard\par
  187. \cf2\b Normal Texture Map\par
  188. \cf4\b0 Use to create per pixel normal variation.\par
  189. \cf0\fs24\par
  190. \cf4\i\fs18 Tip:\par
  191. \pard\li420\cf3\i0 Use a normal map on a large flat surface to add some noise to the normals, if reflection stretching becomes an issue.\par
  192. \pard\cf4\par
  193. \cf2\b Spec(R) Gloss(A) Reflect(B)\par
  194. \cf4\b0 Use to create Specular/Gloss/Reflection per pixel variation.\par
  195. \cf0\fs24\par
  196. \fs18\tab Red Channel = Specular \par
  197. \tab Green Channel = Gloss\f1\fs24\par
  198. \f0\fs18\tab Blue Channel = Reflection\f1\fs24\par
  199. \par
  200. \cf4\i\f0\fs18 Tip:\par
  201. \pard\li420\cf3\i0 Look to the \ldblquote Samplescene Metals.unity\rdblquote file for examples on how achieve surfaces like rust and brushed steel.\par
  202. \pard\cf4\par
  203. \cf0\fs24\par
  204. \cf2\b\fs18 Density / Refraction Slider \par
  205. \cf4\b0 Changes the amount of refraction a surface will have. (Left: Less dense, Middle: Equal to atmosphere, Right: More dense). \par
  206. \cf0\fs24\par
  207. \cf4\i\fs18 Tip:\par
  208. \pard\li420\cf3\i0 Refractions are based on the front face surface angle and do not take into consideration the back face angle or the thickness of the surface. Because of this, higher density values are generally needed for larger objects.\par
  209. \pard\cf0\fs24\par
  210. \cf4\fs18\par
  211. \cf0\fs24\par
  212. \pard\qc\cf1\b\i\fs14 All assets and shader code created by Bruno Rime for the Unity3D engine.\par
  213. Email Address brunorime@gmail.com\par
  214. \pard\fs18\par
  215. \cf4\b0\i0 \par
  216. \cf0\f1\fs24\par
  217. \par
  218. \par
  219. }