Difference between revisions of "Aggressive Optimizations"

From Verge3D Wiki
Jump to navigationJump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
Here is the list of aggressive optimizations you can use for your Verge3D apps when nothing else helped. All these techniques reduce quality of your apps, so use with caution! Normally, you should always stick to the "official" recommendations specified [https://www.soft8soft.com/docs/manual/en/introduction/Optimizing-WebGL-performance.html here] and [https://www.soft8soft.com/docs/manual/en/introduction/Performance-Bottlenecks.html here].
[[Category:Tutorials]]{{#seo:
|description=This guide includes quick & dirty hacks which you can use to boost the performance of your WebGL apps
|keywords=Optimizations, 3D, WebGL, 3DWeb, Web3D, Verge3D
|image=scissors.jpg
}}
[[File:scissors.jpg|right|thumb|600px|Cut off features slowing you down!]]
Here is the list of aggressive optimizations that you can use as quick & dirty hacks to boost the performance of your apps. All these techniques reduce rendering quality, so use them with caution! Normally, you should always be a patient optimizer and stick to the "official" recommendations specified [https://www.soft8soft.com/docs/manual/en/introduction/Optimizing-WebGL-performance.html here] and [https://www.soft8soft.com/docs/manual/en/introduction/Performance-Bottlenecks.html there].


== Disable shadows ==
== Disable shadows or reduce their quality ==


Can help a lot, especially if you use a lot of shadow sources, PCF (Poisson Disk) / ESM shadow algorithms, or shadows from the point lights.
Disabling shadows altogether can help a lot. However, if this hurts your feelings, follow these recommendations:
 
* Use smaller shadow maps ([https://www.soft8soft.com/wiki/index.php/Common_gotchas_with_Verge3D#Huge_shadow_maps see here why])
* Use just one light that casts shadows
* Use Basic or Bilinear shadow filtering instead of PCF (Poisson Disk) / ESM shadow ([https://www.soft8soft.com/docs/manual/en/blender/Shadows.html#shadow_filtering check out this info])
* Never cast shadows from the point lights!


== Disable post-processing ==
== Disable post-processing ==


It's not always about post-processing puzzles. Don't forget about Ambient Occlusion and Outlining which can be enabled in the modelling suite!
It's not always about the post-processing puzzles. Don't forget about [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#ambient_occlusion ambient occlusion] and [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#outline_rendering outlining] enabled in the modeling suite!
 
== Disable HDR rendering ==
 
We trust you [https://www.soft8soft.com/wiki/index.php/Common_gotchas_with_Verge3D#Enabling_HDR_Rendering_when_not_required never enable it] without proper thinking.
 
== Get rid of light probes ==
 
[https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#light_probes Reflection cubemaps] affect loading speed, while [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#reflection_plane_light_probes planes] affect both loading speed and rendering performance. Both consume extra GPU memory.
 
[[File:reflection_cubes_and_planes.jpg|900px]]
 
== Choose between IBL reflections and lights ==
 
Don't use them both in the same scene, stick to one of the following:
 
* Keep IBL map but remove all light sources. For better performance, you might also switch [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#ibl_environment_mode IBL mode] to "Light Probe + Cubemap".
 
OR:
 
* Keep light sources (preferably one light) but disable specular reflections from your IBL maps by switching [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#ibl_environment_mode IBL mode] to "Light Probe" (which provides only diffuse lighting).
 
== Set IBL cubemap size to 256 ==
 
Being quick and easy, and with almost no harm to quality, this makes your app less VRAM-hungry. See [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#global_rendering_properties_indirect here].
 
== Set View Transform from AgX/Filmic to Standard ==
 
Blender only. Perhaps you didn't even know about the [https://www.soft8soft.com/docs/manual/en/blender/Lighting-and-Rendering.html#global_rendering_properties_color_management existence] of this Blender setting... It's nothing serious, just minor FPS boost and minor reduction of the scene loading time. However, it is just a couple of clicks and brings you no quality harm (just slightly different scene look).


== Remove reflection cubemaps and planes ==
== Get rid of procedural textures ==


Reflection cubemaps affect loading speed, planes affect both loading speed and rendering performance.
The noise (and noise-like) textures are especially bad for performance - stick to the regular image textures with noise pattern. Node-based checker textures are OK.


== Reduce amount of rendered pixels ==
== No hardcore anti-aliasing ==


Use the [https://www.soft8soft.com/docs/manual/en/puzzles/System.html#set_screen_scale set screen puzzle] with value < 1 (say 0.5).
MSAA 16x is really bad for performance, use Auto, MSAA 4x, or FXAA. Disabling anti-aliasing altogether should be considered if you really don't mind about the quality.


== Use either light sources or HDR environment reflections ==
== Use ETC1S compression for all textures ==


Stick to one of them:
You'll surely get some artifacts with this compression algorithm, but the memory and network bandwidth savings are truly enormous. Just check this lamp out sampling courtesy of Khronos:  


* Keep light sources (preferably one light) but disable specular environment reflections by switching IBL mode: no PMREM, no Light Probe + Cubemap, use Light Probe which provides only diffuse lighting.
[[File:ktx-comparison.jpg|900px]]


* Remove all light sources. For better performance you might switch IBL mode to Light Probe + Cubemap.
The instructions are [https://www.soft8soft.com/docs/manual/en/introduction/Texture-Compression.html#tweaking_compression here].
 
== Reduce amount of rendered pixels ==
 
This one is brutal. Use the [https://www.soft8soft.com/docs/manual/en/puzzles/System.html#set_screen_scale set screen scale] puzzle with value < 1. Start with 0.75 continue to 0.5.


== Emission shading only ==
== Emission shading only ==


Absolute hardcore which can make your scene as fast as a lightning bolt. Bake everything to textures (ambient occlusion, lighting, diffuse) and use only emission shaders.
Absolute hardcore which can make your scene as fast as a lightning bolt. The idea is simple - bake everything to textures (ambient occlusion, lighting, diffuse) and use only emission shaders.
 
This is how good old 3D games were made back in 1990s. Still you can have decent quality because GPUs in 2020s can handle way more geometry and much larger textures.

Latest revision as of 19:55, 1 May 2024

Cut off features slowing you down!

Here is the list of aggressive optimizations that you can use as quick & dirty hacks to boost the performance of your apps. All these techniques reduce rendering quality, so use them with caution! Normally, you should always be a patient optimizer and stick to the "official" recommendations specified here and there.

Disable shadows or reduce their quality

Disabling shadows altogether can help a lot. However, if this hurts your feelings, follow these recommendations:

  • Use smaller shadow maps (see here why)
  • Use just one light that casts shadows
  • Use Basic or Bilinear shadow filtering instead of PCF (Poisson Disk) / ESM shadow (check out this info)
  • Never cast shadows from the point lights!

Disable post-processing

It's not always about the post-processing puzzles. Don't forget about ambient occlusion and outlining enabled in the modeling suite!

Disable HDR rendering

We trust you never enable it without proper thinking.

Get rid of light probes

Reflection cubemaps affect loading speed, while planes affect both loading speed and rendering performance. Both consume extra GPU memory.

Reflection cubes and planes.jpg

Choose between IBL reflections and lights

Don't use them both in the same scene, stick to one of the following:

  • Keep IBL map but remove all light sources. For better performance, you might also switch IBL mode to "Light Probe + Cubemap".

OR:

  • Keep light sources (preferably one light) but disable specular reflections from your IBL maps by switching IBL mode to "Light Probe" (which provides only diffuse lighting).

Set IBL cubemap size to 256

Being quick and easy, and with almost no harm to quality, this makes your app less VRAM-hungry. See here.

Set View Transform from AgX/Filmic to Standard

Blender only. Perhaps you didn't even know about the existence of this Blender setting... It's nothing serious, just minor FPS boost and minor reduction of the scene loading time. However, it is just a couple of clicks and brings you no quality harm (just slightly different scene look).

Get rid of procedural textures

The noise (and noise-like) textures are especially bad for performance - stick to the regular image textures with noise pattern. Node-based checker textures are OK.

No hardcore anti-aliasing

MSAA 16x is really bad for performance, use Auto, MSAA 4x, or FXAA. Disabling anti-aliasing altogether should be considered if you really don't mind about the quality.

Use ETC1S compression for all textures

You'll surely get some artifacts with this compression algorithm, but the memory and network bandwidth savings are truly enormous. Just check this lamp out sampling courtesy of Khronos:

Ktx-comparison.jpg

The instructions are here.

Reduce amount of rendered pixels

This one is brutal. Use the set screen scale puzzle with value < 1. Start with 0.75 continue to 0.5.

Emission shading only

Absolute hardcore which can make your scene as fast as a lightning bolt. The idea is simple - bake everything to textures (ambient occlusion, lighting, diffuse) and use only emission shaders.

This is how good old 3D games were made back in 1990s. Still you can have decent quality because GPUs in 2020s can handle way more geometry and much larger textures.