Unterschiede zwischen GLES2 und GLES3

Diese Seite dokumentiert die Unterschiede zwischen GLES2 und GLES3, diese sind beabsichtigt und keine Fehler. Es kann unbeabsichtigte Unterschiede geben, die jedoch als Fehler gemeldet werden sollten.

Bemerkung

"GLES2" and "GLES3" are the names used in Godot for the two OpenGL-based rendering backends. In terms of graphics APIs, the GLES2 backend maps to OpenGL 2.1 on desktop, OpenGL ES 2.0 on mobile and WebGL 1.0 on the web. The GLES3 backend maps to OpenGL 3.3 on desktop, OpenGL ES 3.0 on mobile and WebGL 2.0 on the web.

Partikel

GLES2 cannot use the Particles or Particles2D nodes as they require advanced GPU features. Instead, use CPUParticles or CPUParticles2D, which provides a similar interface to a ParticlesMaterial.

Tipp

Partikel und Partikel2D können mit der Editor-Option "In CPU-Partikel konvertieren" in ihren CPU-äquivalenten Node konvertiert werden.

SCREEN_TEXTURE MipMaps

In GLES2, SCREEN_TEXTURE (accessed via a ShaderMaterial) does not have computed mip-maps. So when accessing at a different LOD, the texture will not appear blurry.

DEPTH_TEXTURE

While GLES2 supports DEPTH_TEXTURE in shaders, it may not work on some old hardware (especially mobile).

Farbraum

GLES2 and GLES3 are in different color spaces. This means that colors will appear slightly different between them especially when lighting is used.

If your game is going to use both GLES2 and GLES3, you can use an if statement check and see if the output is in sRGB, using OUTPUT_IS_SRGB. OUTPUT_IS_SRGB is true in GLES2 and false in GLES3.

HDR

GLES2 is not capable of using High Dynamic Range (HDR) rendering features. If HDR is set for your project, or for a given viewport, Godot will still use Low Dynamic Range (LDR) which limits viewport values to the 0-1 range.

The Viewport Debanding property and associated project setting will also have no effect when HDR is disabled. This means debanding can't be used in GLES2.

SpatialMaterial-Funktionen

In GLES2 fehlen die folgenden erweiterten Rendering-Funktionen in SpatialMaterial:

  • Brechung

  • Streuung unter der Oberfläche

  • Anisotropie

  • Klarlack

  • Tiefenabbildung

Bei Verwendung von SpatialMaterials werden diese nicht einmal im Editor angezeigt.

In custom ShaderMaterials, you can set values for these features but they will be non-functional. For example, you will still be able to set the SSS built-in (which normally adds subsurface scattering) in your shader, but nothing will happen.

Umgebungsmerkmale

In GLES2 fehlen die folgenden Funktionen in der Umgebung:

  • Automatische Belichtung

  • Tonemapping

  • Reflexionen im Bildschirmraum

  • Bildschirmbereich Umgebungsokklusion

Das bedeutet, dass Sie in GLES2-Umgebungen nur Folgendes einstellen können:

  • Himmel (inkl. proceduralem Himmel)

  • Lichter hinzufügen (ambient light)

  • Nebel

  • Tiefenschärfe

  • Glühen (oder auch blühen)

  • Einstellung

GI-Proben

GIProbes do not work in GLES2. Instead use Baked Lightmaps. For a description of how baked lightmaps work see the Baked Lightmaps tutorial.

Kontakt-Schatten

The shadow_contact property of Lights is not supported in GLES2 and so does nothing.

Lichtleistung

In GLES2, performance scales poorly with several lights, as each light is processed in a separate render pass (in opposition to GLES3 which is all done in a single pass). Try to limit scenes to as few lights as possible in order to achieve greatest performance.

Texturkomprimierung

On mobile, GLES2 requires ETC texture compression, while GLES3 requires ETC2. ETC2 is enabled by default, so if exporting to mobile using GLES2 make sure to set the project setting rendering/vram_compression/import_etc and then reimport textures.

Warnung

Since ETC doesn't support transparency, you must reimport textures that contain an alpha channel to use the Uncompressed, Lossy or Lossless compression mode (instead of Video RAM). This can be done in the Import dock after selecting them in the FileSystem dock.

Übergangsformen

In GLES2, blend shapes are implemented on the CPU instead of the GPU. Accordingly, they may not perform as well as blend shapes in GLES3. To avoid performance issues when using blend shapes in GLES2, try to minimize the number of blend shapes that are updated each frame.

Shader-Sprache

GLES3 bietet viele integrierte Funktionen, die GLES2 nicht bietet. Unten finden Sie eine Liste der Funktionen, die in GLES2 nicht verfügbar sind oder nur eingeschränkt unterstützt werden.

Genauere Informationen über Godots Shader-Sprache gibt es im eigenen Artikel: Shading Language.

Funktion

vec_type modf ( vec_type x, out vec_type i )

vec_int_type floatBitsToInt ( vec_type x )

vec_uint_type floatBitsToUint ( vec_type x )

vec_type intBitsToFloat ( vec_int_type x )

vec_type uintBitsToFloat ( vec_uint_type x )

ivec2 textureSize ( sampler2D_type s, int lod )

Siehe Problemumgehung unten

ivec2 textureSize ( samplerCube s, int lod )

Siehe Problemumgehung unten

vec4_type texture ( sampler_type s, vec_type uv [, float bias] )

bias nicht verfügbar im Vertex Shader

vec4_type textureProj ( sampler_type s, vec_type uv [, float bias] )

vec4_type textureLod ( sampler_type s, vec_type uv, float lod )

Nur in Vertex Shader auf bestimmter Hardware verfügbar

vec4_type textureProjLod ( sampler_type s, vec_type uv, float lod )

vec4_type textureGrad ( sampler_type s, vec_type uv, vec_type dPdx, vec_type dPdy )

vec_type dFdx ( vec_type p )

vec_type dFdy ( vec_type p )

vec_type fwidth ( vec_type p )

Bemerkung

Funktionen, die nicht in GLES2 GLSL enthalten sind, wurden mit Godots eigener Shader-Standardbibliothek hinzugefügt. Diese Funktionen können in GLES2 im Vergleich zu GLES3 schlechter abschneiden.

textureSize() Problemungehung

GLES2 does not support textureSize(). You can get the size of a texture the old fashioned way by passing in a uniform with the texture size yourself.

// In the shader:
uniform sampler2D textureName;
uniform vec2 textureName_size;
# In GDScript:
material_name.set_shader_param("textureName", my_texture)
material_name.set_shader_param("textureName_size", my_texture_size)

Eingebaute Variablen und Render-Modi

Godot also provides many built-in variables and render modes. Some cannot be supported in GLES2. Below is a list of built-in variables and render modes that, when written to, will have no effect or could even cause issues when using the GLES2 backend.

Variable / Render Mode

ensure_correct_normals

INSTANCE_ID

DEPTH

ANISOTROPY

ANISOTROPY_FLOW

SSS_STRENGTH