Version: 2021.1
Compatibilidad del navegador con WebGL
Utilizando Audio en WebGL

Gráficas WebGL

WebGL is an API for rendering graphics in web browsers, which is based on the functionality of the OpenGL ES graphics library. WebGL 1.0 roughly matches OpenGL ES 2.0 functionality, and WebGL 2.0 roughly matches OpenGL ES 3.0 functionality.

Camera Clear

The default WebGL behaviour is to clear the drawing buffer after each frame. This means on Unity WebGL, the content of the frame buffer clears regardless of the Camera.clearFlags setting. However, you can change this behaviour at instantiation time. To do this, set webglContextAttributes.preserveDrawingBuffer to true in your WebGL template:

script.onload = () => {
       config['webglContextAttributes'] = {"preserveDrawingBuffer": true}; // Add this line to the index.html file in a WebGL Template
       createUnityInstance(canvas, config, (progress) => }

Deferred Rendering

Unity WebGL only supports Deferred Rendering Path if WebGL2.0 is available. On WebGL1.0, Unity WebGL runtime will fallback to Forward Rendering.

Global Illumination

Unity WebGL solamente soporta baked GI. El GI en tiempo real actualmente no es soportado en WebGL. Adicionalmente solamente los lightmaps No-direccionales son soportados.

Linear Rendering

Unity WebGL only supports linear color space rendering with WebGL 2.0. Linear color space rendering doesn’t have fallback support for WebGL 1.0. To build a WebGL player using linear color space rendering, you need to remove WebGL 1.0 API in the Player settings, open the Other Settings panel, disable the Automatic Graphics API setting.

Some web browsers don’t support sRGB DXT texture compression. This can decrease the quality of rendering performance when using linear rendering, due to runtime decompression of all the DXT textures.

MovieTextures (Texturas de película)

WebGL no soporta actualmente la reproducción de video utilizando la clase MovieTexture. Sin embargo, usted puede eficientemente reproducir video de vuelta en su contenido WebGL utilizando el elemento video de HTML5. Descargue este Asset Store package para un ejemplo de cómo hacerlo.

Restricciones del código Shader de WebGL

The WebGL 1.0 specification imposes some limitations on GLSLS shader code, which are more restrictive than many OpenGL ES 2.0 implementations. This is mostly relevant when you write your own shaders.

Específicamente, WebGL tiene restricciones en aquellos valores que serán utilizados como indices de arreglos o matrices: WebGL solamente permite un indexado dinámico con expresiones constantes, indices de bucles o una combinación. La única excepción es para un acceso uniforme en vertex shaders, el cual puede ser indexado utilizando cualquier expresión.

También, las restricciones aplican en el control de estructuras. El único tipo de bucles los cuales son permitidos son los bucles for, dónde el inicializador inicializa una variable a una constante, la actualización agrega una constante o resta una constante de la variable, y la prueba continua compara la variable a la constante. Los bucles for que no coincidan con estos criterios y los bucles while no están permitidos.

Renderización de fuentes

Unity WebGL soporta la renderización dinámica de fuentes como cualquier otra plataforma de Unity. No obstante, no tiene acceso a las fuentes instaladas en la maquina del usuario, por lo que cualquier fuente utilizada debe estar incluida en la carpeta del proyecto (incluyendo cualquier fuente fallback para caracteres internacionales, o versiones itálica/negrilla de las fuentes), y configuradas con nombres de fuentes fallback.

Anti-Aliasing

WebGL supports anti-aliasing on most (but not on all) combinations of browsers and GPUs. To use it, anti-aliasing must be enabled in the default Quality setting for the WebGL platform.

Note that on WebGL1.0 there are several limitations:

  • Switching Quality settings at runtime will not enable or disable anti-aliasing. It has to be set up in the default Quality setting loaded at player start up.

  • The different multi sampling levels (2x, 4x, etc..) have no effect in WebGL, it’s either on or off.

  • Any post-processing effect applied to the camera disables the built-in Anti-Aliasing.

  • HDR is not compatible with anti-aliasing so make sure the Allow HDR camera option is disabled.

There are no such limitations on WebGL2.0.

Reflection Probes

Los Reflection probes se soportan en WebGL, pero debido a limitaciones en la especificación de WebGL acerca de rendering a mipmaps específicos, los reflection probes en tiempo real suaves no se soportan (por lo que los reflection probes en tiempo real siempre generan reflexiones agudas, lo cual podría parecer de muy baja resolución). Los Reflection probes en tiempo real suaves requerirán WebGL 2.0.

Soporte a WebGL 2.0 (Experimental)

Unity includes support for the WebGL 2.0 API, which brings OpenGL ES 3.0-level rendering capabilities to the web.

By default, Unity WebGL builds support both WebGL 1.0 and WebGL 2.0 APIs, This can be configured in the WebGL Player settings under the Other Settings panel by disabling the Automatic Graphics API property.

When WebGL 2.0 is supported in browsers, content can benefit from a better quality in the Standard Shader, GPU Instancing support, directional lightmap support, no restrictions on indexing and loops in shader code, and better performance.

You can use SystemInfo.graphicsDeviceType at run time to determine whether the Unity instance is rendering with OpenGLES3 (WebGL2.0) or OpenGLES2 (WebGL1.0).


  • 2018–10–26 Page amended

  • Linear rendering for WebGL 2.0 added in 2017.2 NewIn20172

Compatibilidad del navegador con WebGL
Utilizando Audio en WebGL