gles2_gles3_differences.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. .. _doc_gles2_gles3_differences:
  2. Differences between GLES2 and GLES3
  3. ===================================
  4. This page documents the differences between GLES2 and GLES3 that are by design and are not the result
  5. of bugs. There may be differences that are unintentional, but they should be reported as bugs.
  6. .. note:: "GLES2" and "GLES3" are the names used in Godot for the two OpenGL-based rendering backends.
  7. In terms of graphics APIs, the GLES2 backend maps to OpenGL 2.1 on desktop, OpenGL ES 2.0 on
  8. mobile and WebGL 1.0 on the web. The GLES3 backend maps to OpenGL 3.3 on desktop, OpenGL ES
  9. 3.0 on mobile and WebGL 2.0 on the web.
  10. Particles
  11. ---------
  12. GLES2 cannot use the :ref:`Particles <class_Particles>` or :ref:`Particles2D <class_Particles2D>` nodes
  13. as they require advanced GPU features. Instead, use :ref:`CPUParticles <class_CPUParticles>` or
  14. :ref:`CPUParticles2D <class_CPUParticles2D>`, which provides a similar interface to a
  15. :ref:`ParticlesMaterial <class_ParticlesMaterial>`.
  16. .. tip:: Particles and Particles2D can be converted to their CPU equivalent node with the "Convert to
  17. CPUParticles" option in the editor.
  18. ``SCREEN_TEXTURE`` mip-maps
  19. ---------------------------
  20. In GLES2, ``SCREEN_TEXTURE`` (accessed via a :ref:`ShaderMaterial <class_ShaderMaterial>`) does not have
  21. computed mip-maps. So when accessing at a different LOD, the texture will not appear blurry.
  22. ``DEPTH_TEXTURE``
  23. -----------------
  24. While GLES2 supports ``DEPTH_TEXTURE`` in shaders, it may not work on some old hardware (especially mobile).
  25. Color space
  26. -----------
  27. GLES2 and GLES3 are in different color spaces. This means that colors will appear slightly
  28. different between them especially when lighting is used.
  29. If your game is going to use both GLES2 and GLES3, you can use an ``if``
  30. statement check and see if the output is in sRGB, using ``OUTPUT_IS_SRGB``. ``OUTPUT_IS_SRGB`` is
  31. ``true`` in GLES2 and ``false`` in GLES3.
  32. HDR
  33. ---
  34. GLES is not capable of using High Dynamic Range (HDR) rendering features. If HDR is set for your
  35. project, or for a given viewport, Godot will still user Low Dynamic Range (LDR) which limits
  36. viewport values to the ``0-1`` range.
  37. SpatialMaterial features
  38. ------------------------
  39. In GLES2, the following advanced rendering features in the :ref:`SpatialMaterial <class_SpatialMaterial>` are missing:
  40. - Refraction
  41. - Subsurface scattering
  42. - Anisotropy
  43. - Clearcoat
  44. - Depth mapping
  45. When using SpatialMaterials they will not even appear in the editor.
  46. In custom :ref:`ShaderMaterials <class_ShaderMaterial>`, you can set values for these features but they
  47. will be non-functional. For example, you will still be able to set the ``SSS`` built-in (which normally adds
  48. subsurface scattering) in your shader, but nothing will happen.
  49. Environment features
  50. --------------------
  51. In GLES2, the following features in the :ref:`Environment <class_Environment>` are missing:
  52. - Auto exposure
  53. - Tonemapping
  54. - Screen space reflections
  55. - Screen space ambient occlusion
  56. - Depth of field
  57. - Glow (also known as bloom)
  58. - Adjustment
  59. That means that in GLES2 environments you can only set:
  60. - Sky (including procedural sky)
  61. - Ambient light
  62. - Fog
  63. GIProbes
  64. --------
  65. :ref:`GIProbes <class_GIProbe>` do not work in GLES2. Instead use :ref:`Baked Lightmaps <class_BakedLightmap>`.
  66. For a description of how baked lightmaps work see the :ref:`Baked Lightmaps tutorial <doc_baked_lightmaps>`.
  67. Contact shadows
  68. ---------------
  69. The ``shadow_contact`` property of :ref:`Lights <class_Light>` is not supported in GLES2 and so does nothing.
  70. Light performance
  71. -----------------
  72. In GLES2, performance scales poorly with several lights, as each light is processed in a separate render
  73. pass (in opposition to GLES3 which is all done in a single pass). Try to limit scenes to as few lights as
  74. possible in order to achieve greatest performance.
  75. Texture compression
  76. -------------------
  77. On mobile, GLES2 requires ETC texture compression, while GLES3 requires ETC2. ETC2 is enabled by default,
  78. so if exporting to mobile using GLES2 make sure to set the project setting
  79. ``rendering/vram_compression/import_etc`` and then reimport textures.
  80. Blend shapes
  81. ------------
  82. Blend shapes are not supported in GLES2.
  83. Shading language
  84. ----------------
  85. GLES3 provides many built-in functions that GLES2 does not. Below is a list of functions
  86. that are not available or are have limited support in GLES2.
  87. For a complete list of built-in GLSL functions see the :ref:`Shading Language doc <doc_shading_language>`.
  88. +------------------------------------------------------------------------+--------------------------------------------------+
  89. | Function | Note |
  90. +========================================================================+==================================================+
  91. | vec_type **sinh** ( vec_type ) | |
  92. +------------------------------------------------------------------------+--------------------------------------------------+
  93. | vec_type **cosh** ( vec_type ) | |
  94. +------------------------------------------------------------------------+--------------------------------------------------+
  95. | vec_type **tanh** ( vec_type ) | |
  96. +------------------------------------------------------------------------+--------------------------------------------------+
  97. | vec_type **asinh** ( vec_type ) | |
  98. +------------------------------------------------------------------------+--------------------------------------------------+
  99. | vec_type **acosh** ( vec_type ) | |
  100. +------------------------------------------------------------------------+--------------------------------------------------+
  101. | vec_type **atanh** ( vec_type ) | |
  102. +------------------------------------------------------------------------+--------------------------------------------------+
  103. | vec_type **round** ( vec_type ) | |
  104. +------------------------------------------------------------------------+--------------------------------------------------+
  105. | vec_type **roundEven** ( vec_type ) | |
  106. +------------------------------------------------------------------------+--------------------------------------------------+
  107. | vec_type **trunc** ( vec_type ) | |
  108. +------------------------------------------------------------------------+--------------------------------------------------+
  109. | vec_type **modf** ( vec_type x, out vec_type i ) | |
  110. +------------------------------------------------------------------------+--------------------------------------------------+
  111. | vec_bool_type **isnan** ( vec_type ) | |
  112. +------------------------------------------------------------------------+--------------------------------------------------+
  113. | vec_bool_type **isinf** ( vec_type ) | |
  114. +------------------------------------------------------------------------+--------------------------------------------------+
  115. | vec_int_type **floatBitsToInt** ( vec_type ) | |
  116. +------------------------------------------------------------------------+--------------------------------------------------+
  117. | vec_uint_type **floatBitsToUint** ( vec_type ) | |
  118. +------------------------------------------------------------------------+--------------------------------------------------+
  119. | vec_type **intBitsToFloat** ( vec_int_type ) | |
  120. +------------------------------------------------------------------------+--------------------------------------------------+
  121. | vec_type **uintBitsToFloat** ( vec_uint_type ) | |
  122. +------------------------------------------------------------------------+--------------------------------------------------+
  123. | mat_type **outerProduct** ( vec_type, vec_type ) | |
  124. +------------------------------------------------------------------------+--------------------------------------------------+
  125. | mat_type **transpose** ( mat_type ) | |
  126. +------------------------------------------------------------------------+--------------------------------------------------+
  127. | float **determinant** ( mat_type ) | |
  128. +------------------------------------------------------------------------+--------------------------------------------------+
  129. | mat_type **inverse** ( mat_type ) | |
  130. +------------------------------------------------------------------------+--------------------------------------------------+
  131. | ivec2 **textureSize** ( sampler2D_type s, int lod ) | |
  132. +------------------------------------------------------------------------+--------------------------------------------------+
  133. | ivec2 **textureSize** ( samplerCube s, int lod ) | |
  134. +------------------------------------------------------------------------+--------------------------------------------------+
  135. | vec4_type **texture** ( sampler2D_type s, vec2 uv [, float bias] ) | **bias** not available in vertex shader |
  136. +------------------------------------------------------------------------+--------------------------------------------------+
  137. | vec4_type **texture** ( samplerCube s, vec3 uv [, float bias] ) | **bias** not available in vertex shader |
  138. +------------------------------------------------------------------------+--------------------------------------------------+
  139. | vec4_type **textureProj** ( sampler2D_type s, vec3 uv [, float bias] ) | **bias** not available in vertex shader |
  140. +------------------------------------------------------------------------+--------------------------------------------------+
  141. | vec4_type **textureProj** ( sampler2D_type s, vec4 uv [, float bias] ) | **bias** not available in vertex shader |
  142. +------------------------------------------------------------------------+--------------------------------------------------+
  143. | vec4_type **textureLod** ( sampler2D_type s, vec2 uv, float lod ) | Only available in vertex shader on some hardware |
  144. +------------------------------------------------------------------------+--------------------------------------------------+
  145. | vec4_type **textureLod** ( samplerCube s, vec3 uv, float lod ) | Only available in vertex shader on some hardware |
  146. +------------------------------------------------------------------------+--------------------------------------------------+
  147. | vec4_type **textureProjLod** ( sampler2D_type s, vec3 uv, float lod ) | Only available in vertex shader |
  148. +------------------------------------------------------------------------+--------------------------------------------------+
  149. | vec4_type **textureProjLod** ( sampler2D_type s, vec4 uv, float lod ) | Only available in vertex shader |
  150. +------------------------------------------------------------------------+--------------------------------------------------+
  151. | vec4_type **texelFetch** ( sampler2D_type s, ivec2 uv, int lod ) | |
  152. +------------------------------------------------------------------------+--------------------------------------------------+
  153. | vec_type **dFdx** ( vec_type ) | |
  154. +------------------------------------------------------------------------+--------------------------------------------------+
  155. | vec_type **dFdy** ( vec_type ) | |
  156. +------------------------------------------------------------------------+--------------------------------------------------+
  157. | vec_type **fwidth** ( vec_type ) | |
  158. +------------------------------------------------------------------------+--------------------------------------------------+
  159. Godot also provides many built-in variables and render modes. Some cannot be supported in GLES2. Below is a list of
  160. built-in variables and render modes that, when written to, will have no effect or could even cause issues when using
  161. the GLES2 backend.
  162. +----------------------------+
  163. | Variable / Render Mode |
  164. +============================+
  165. | ``ensure_correct_normals`` |
  166. +----------------------------+
  167. | ``INSTANCE_ID`` |
  168. +----------------------------+
  169. | ``DEPTH`` |
  170. +----------------------------+
  171. | ``ANISOTROPY`` |
  172. +----------------------------+
  173. | ``ANISOTROPY_FLOW`` |
  174. +----------------------------+
  175. | ``SSS_STRENGTH`` |
  176. +----------------------------+