Commit graph

361 commits

Author SHA1 Message Date
clayjohn
eb9c2b878a Automatically transform Skeleton2D calculations so pivots are not needed 2023-01-27 14:55:22 -08:00
Rémi Verschelde
4b0363312e
Merge pull request #71455 from BastiaanOlij/fix_stereo_screen_depth
Make screen texture and depth texture work in Multiview
2023-01-26 01:11:02 +01:00
Bastiaan Olij
85c478e170 Make screen texture and depth texture work in Multiview 2023-01-25 13:35:01 +11:00
Hendrik Brucker
4bd01a93dc Fix some SpotLight3D issues (clustering artifacts, light leak) 2023-01-24 01:08:32 +01:00
clayjohn
faea9f5c10 Remove SCREEN_TEXTURE, DEPTH_TEXTURE, and NORMAL_ROUGHNESS_TEXTURE
in favour of texture hints
2023-01-18 19:52:47 -08:00
Rémi Verschelde
226daf9b59
GLES3: Fix canvas shader use of undefined draw_data
Fixes #71551.
2023-01-17 13:17:53 +01:00
jainl28patel
390f83bf5a fix normal map not flipping in sprite2D 2023-01-14 11:51:56 +05:30
clayjohn
b6a1aa15b1 Use instanced array buffer instead of UBO for canvas item batching
This simplifies the generated shader code which increases both performance and compile time on low end devices
2022-12-15 08:25:44 -08:00
Rémi Verschelde
4454498d1e
OpenGL: Fix scene shader error when using Omni or Spot but not both
Fixes #69886.
2022-12-11 10:39:39 +01:00
clayjohn
975a8f9ada Clean up specialization constants in OpenGL scene renderer
Also add support for disabling omni and spot lights when not used
2022-12-05 18:10:13 -08:00
Rémi Verschelde
0697d6f8cd
Merge pull request #69521 from clayjohn/GLES3-glsl
Expose emulated *Unorm4x8 glsl functions in non-android builds
2022-12-05 10:13:38 +01:00
clayjohn
7bc11b5fe8 Exposure emulated *Unorm4x8 glsl functions in non-android builds
Originally these functions were exposed on all GLSL ES 300 devices. However, that causes a build error as Android devices expose the *Unorm4x8 functions despite them not being in the ES 300 spec
2022-12-04 14:05:14 -08:00
NumbuhFour
1b09fd5410 Implement CAMERA_VISIBLE_LAYERS as built-in shader variable 2022-12-03 22:41:27 -08:00
Rémi Verschelde
daf168f4c8
Merge pull request #69522 from clayjohn/IBL-black-metal
Allow black metallic materials to reflect IBL
2022-12-03 12:46:30 +01:00
Rémi Verschelde
29ddbfa19a
Merge pull request #69514 from clayjohn/IBL-roughness
Properly remap roughness when reading from radiance map
2022-12-03 12:46:25 +01:00
clayjohn
1e05dd3504 Allow black metallic materials to reflect IBL 2022-12-02 19:54:59 -08:00
clayjohn
b2b89d7294 Properly remap roughness when reading from radiance map
This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3
2022-12-02 15:39:20 -08:00
Rémi Verschelde
8177e5d7de
Merge pull request #69325 from clayjohn/GLES3-skeletons
Add Skeletons and Blend Shapes to the OpenGL renderer
2022-12-01 23:22:42 +01:00
clayjohn
9141984e7e Enable GLES3 on Android
Add necessary build flags and switch from using a
GLES2 context to a GLES3 one.

This also enables building for OpenXR

Co-authored-by: m4gr3d <fhuyakou@gmail.com>
Co-authored-by: dsnopek <dsnopek@gmail.com>
2022-11-29 14:18:24 -08:00
clayjohn
f33ffd9ab4 Add Skeletons and Blend Shapes to the OpenGL renderer
This uses a similar multipass approach to blend shapes
as Godot 3.x, the major difference here is that we
need to convert the normals and tangents to octahedral
for rendering.

Skeletons work the same as the Vulkan renderer except the bones
are stored in a texture as they were in 3.x.
2022-11-29 09:45:03 -08:00
clayjohn
e81a1e5b5a Expose model_matrix in GLES3 scene fragment shader 2022-11-21 09:56:08 -08:00
Rémi Verschelde
3a43d44656
Merge pull request #68830 from Ayush-singla27/issuebranch
fixed incorrect mesh normals in shaders
2022-11-20 11:35:52 +01:00
clayjohn
0e5a98cdd8 Fix drawing of 2D skeletons in the RD renderer.
Also clean up skeleton code in preparation for adding them to GLES3

Properly update Mesh2D AABBs when skeleton is updated
2022-11-18 23:36:40 -08:00
Ayush Singla
75ba0a7957 fixed incorrect mesh normals in shaders 2022-11-19 11:06:03 +05:30
clayjohn
9ce57050a5 Add GPUParticles to the OpenGL3 renderer.
This includes collision (2D SDF, Box, Sphere, Heightmap),
attraction (Box, Sphere), and all sorting modes.

This does not include 3D SDF collisions, trails, or
manual emission.
2022-11-14 23:28:25 -08:00
clayjohn
2ec234ff67 Add 2D shadows and canvas SDF to OpenGL3 renderer
This is an initial implementation based on the current RD implementation

Performance will improve later
2022-10-28 11:33:23 -07:00
Clay John
0d711cad30
Merge pull request #66107 from devloglogan/ambient-light-disabled-fix
Fix ambient_light_disabled render mode flag
2022-10-27 10:08:29 -07:00
David Snopek
398ee08375 Add multiview to the opengl3 driver 2022-10-21 21:00:32 -05:00
clayjohn
978aa05a99 Fix error in Web builds that resulting in 2D
objects not drawing in the GLES3 backend.

Issue came from not binding a light UBO when using the DISABLE_LIGHTING
code path
2022-10-14 11:18:27 -07:00
clayjohn
e600fb93a5 Add 2D lights to OpenGL3 canvas renderer
This is an initial implementation using the same single-pass approach as the RenderingDevice.
2022-10-12 17:55:01 -07:00
clayjohn
154b9c1c91 Use a giant UBO to optimize performance in 2D
This removes the countless small UBO writes we had before
and replaces them with a single large write per render pass.

This results in much faster rendering on low-end devices
but improves speed on all devices.
2022-10-06 11:24:45 -07:00
clayjohn
c8f0f27a0b Properly expose TEXTURE_PIXEL_SIZE in Opengl3 renderer 2022-10-03 19:13:17 -07:00
Logan Lang
e61d8b6f53 enabled ambient_light_disabled render mode flag 2022-09-19 17:12:32 -05:00
clayjohn
8fa76a5272 Move debanding into internal sky shader code so that it is applied after everything else.
This ensures that the debanding does not scale with exposure or any other effect.
2022-09-13 10:39:04 -07:00
clayjohn
97be1fb7b6 Apply energy conservation to LAMBERT_WRAP and TOON diffuse modes by dividing by PI 2022-09-12 08:45:40 -07:00
clayjohn
fea48cdfc6 Fix rendering when using WebGL2.
Fixes include using proper depth buffer format in 3D (this had previously been fixed already but the changes were lost in a rebase), Remove unused lighting and shadowing code in 2D, and update 2D UBOs using glBufferSubData so that they remain the appropriate size.
2022-09-06 14:42:08 -07:00
clayjohn
385ee5c70b Implement Physical Light Units as an optional setting.
This allows light sources to be specified in physical light units in addition to the regular energy multiplier. In order to avoid loss of precision at high values, brightness values are premultiplied by an exposure normalization value.

In support of Physical Light Units this PR also renames CameraEffects to CameraAttributes.
2022-08-31 12:14:46 -07:00
bruvzg
bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
Omar El Sheikh
f1fda97c33 Implement Octahedral on OpenGL3 2022-08-13 10:20:14 -07:00
Rémi Verschelde
8734ef1f7a
Merge pull request #62547 from clayjohn/ref_vec_pbr 2022-08-08 10:18:32 +02:00
Hugo Locurcio
baaa7503c7
Add a shadow opacity property to Light3D
This can be used to make shadows translucent for a specific light.

The light distance fade system also uses this to smoothly fade the shadow
when the light fade transition distance is greater than 0.
2022-08-07 11:06:32 +02:00
clayjohn
4b80cb4aa3 Fix various bugs in GLES3 renderer that stopped it from running on web 2022-08-01 16:45:32 -04:00
Rémi Verschelde
677f565ce8
Merge pull request #63587 from clayjohn/specular-occlusion
Treat specular less than 0.02 as occlusion
2022-08-01 07:54:57 +02:00
clayjohn
0c65ed38a6 Treat specular less than 0.02 as occlusion
This is a very common hack used in almost all PBR renderers to allow removing specular contribution in dielectric materials
2022-07-31 15:45:21 -07:00
Hugo Locurcio
4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
Rémi Verschelde
d7a1acd229
Merge pull request #62364 from clayjohn/GLES3-sky-optimization 2022-07-27 12:39:58 +02:00
Rémi Verschelde
6bbfd160b0 SCons: Properly track codegen script dependency for generated GLSL headers 2022-07-02 16:01:48 +02:00
clayjohn
93c82ab4b9 Evaluate specular reflections using specular dominant direction instead of assuming mirror reflections 2022-06-29 23:36:18 -07:00
clayjohn
88830509d1 Precompute on the CPU as much as possible for the Cubemap filter shader 2022-06-22 16:46:27 -07:00
clayjohn
5f52936350 Implement MultiMesh in 3D and flesh out MultiMesh functions 2022-06-14 21:23:20 -07:00