Commit graph

309 commits

Author SHA1 Message Date
lawnjelly
e88b4f330e Poly colors fixes
This adds support for custom shaders for polys, and properly handles modulate in the case of large FVF and modulate FVF.

It also fixes poly vertex colors not being sent to OpenGL.
2020-11-13 13:23:28 +00:00
Rémi Verschelde
c43b2ab603
Merge pull request #42942 from Calinou/add-viewport-debanding-3.2
Add a debanding property to Viewport for GLES3
2020-10-30 11:47:57 +01:00
Rémi Verschelde
efdc5f0f89
Merge pull request #43054 from lawnjelly/ewok_fix_largefvf
Fix transforms in custom shaders using large FVF
2020-10-28 09:49:36 +01:00
lawnjelly
f4cb88e232 Fix transforms in custom shaders using large FVF
In small batches using hardware transform, vertices would be drawn in incorrect positions due to the item transform being applied twice - once in the transform uniform, and once from the transform passed as a vertex attribute.

This PR alters the shader to ignore uniform transforms when using large FVF.
2020-10-25 12:57:42 +00:00
clayjohn
505d469e50 Remove extra exposure multiply in FXAA 2020-10-24 13:11:27 -07:00
Hugo Locurcio
2dbc329704
Add a debanding property to Viewport for GLES3
It can be enabled in the Project Settings
(`rendering/quality/filters/use_debanding`). It's disabled
by default as it has a small performance impact and can make
PNG screenshots much larger (due to how dithering works).

As a result, it should be enabled only when banding is noticeable enough.

Since debanding requires a HDR viewport to work, it's only supported
in the GLES3 backend.
2020-10-20 19:07:15 +02:00
Hugo Locurcio
af45c97652
Add fast approximate antialiasing (FXAA) to Viewport
This backports FXAA from the `master` branch.

Co-authored-by: Clay John <claynjohn@gmail.com>
2020-10-20 14:54:52 +02:00
Rémi Verschelde
f442dc062a
Merge pull request #42056 from Yetizone/negative_lights_behavior
tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
2020-10-19 22:40:24 +02:00
Rémi Verschelde
123942f61f
Merge pull request #42119 from lawnjelly/ewok3
Unified GLES3 / GLES2 Batching
2020-10-19 15:01:10 +02:00
Rémi Verschelde
4a92d2111b
Merge pull request #38954 from puchik/ssr-far-clip
Check if screen space reflection has passed far clip
2020-10-18 20:48:44 +02:00
Juan Linietsky
8ca98dd1a0
Merge pull request #41892 from puchik/ssr-edge-fade
Fade screen-space reflection towards inner margin
2020-10-18 14:50:20 -03:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
Yetizone
e6a860deb6 tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
Color values can become negative in the case of negative lights which
leads to undesired behaviour.
2020-09-15 15:46:30 +03:00
Arman
cf7bb2c51f Fade screen-space reflection towards inner margin
- Fade reflection towards inner margin and clip it at screen edges instead of external margin.
- Round edges of the fade margin if both are being cut off to prevent sharp corners.
2020-09-08 15:29:36 -07:00
lawnjelly
674327b78f GLES3 fix normal map flipping with nvidia workaround
When not using TEXTURE_RECT path, flips have to sent via another method to the shader, to ensure that normal maps are correctly adjusted for direction. This PR adds an extra vertex attribute, LIGHT_ANGLE.

For nvidia workarounds, where the shader still has access to the final transform and extra matrix, the LIGHT_ANGLE can be 0 (no adjustment), 180 degrees for a horizontal flip, and negative indicates a vertical flip.

For batching path, the LIGHT_ANGLE can be used to directly specify the light angle for normal mapping, even when the final transform and extra matrix have been baked into vertex positions, so the same shader can be used for both.
2020-08-23 07:54:58 +01:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Arman
48ffd3d157 Check if screen space reflection has passed far clip
Before "accepting" the reflection, check if it's within our view (prevent tracing environment and creating artifacts).
2020-06-04 00:52:16 -07:00
Pedro J. Estébanez
d8be5a9986 Add MODULATE builtin to canvas item shaders 2020-05-04 00:10:24 +02:00
Rémi Verschelde
4faaf6089a Remove unused #if 0'ed code 2020-01-21 21:41:54 +01:00
Rémi Verschelde
90a224c6eb
Merge pull request #35310 from akien-mga/gles3-irradiance-small-optimization
GLES3: Slight optimization to irradiance compute
2020-01-19 18:55:51 +01:00
Rémi Verschelde
dc4db4ab45 GLES3: Slight optimization to irradiance compute
All the calculations leading up to `mipLevel` are only relevant for
Panorama mode. Similarly, the `source_resolution` uniform is only
needed for that mode.
2020-01-19 11:03:11 +01:00
clayjohn
0979411cad reduce complexity of irradiance map generation 2020-01-18 16:51:52 -08:00
clayjohn
796d35d8b3 Fix generation of irradiance map 2020-01-12 14:45:31 -08:00
Rémi Verschelde
2d6586ec78
Merge pull request #34551 from MadEqua/fix-light-with-skeleton
Fix 2D lighting when using skeleton.
2020-01-03 08:32:29 +01:00
Tritium Oxide
bb6f04c9f5
Fix wrong return type
`ERROR: _display_error_with_code: CanvasShaderGLES3: Fragment Program Compilation Failed:
0:166(2): error: `return' with wrong type int, in function `map_ninepatch_axis' returning float`  caused by #34704
2020-01-01 19:14:51 +07:00
Rémi Verschelde
e4907e50fe GLES3: Fix false positive in ninepatch axis stretch code
See #34704.
2020-01-01 11:49:58 +01:00
Winston
c9fe11dec1
Use correct omni light attenuation
fixes godotengine/godot#34683
2019-12-29 17:22:34 +01:00
Bruno Lourenço
f26c9d650b Fix 2D lighting when using skeleton. 2019-12-23 00:00:18 +00:00
Rémi Verschelde
e21872f4b9
Merge pull request #34527 from MadEqua/fix-gles3-light-cutoff
Fix GLES3 light cutoff.
2019-12-21 23:40:15 +01:00
Bruno Lourenço
d47374385c Fix GLES3 light cutoff. 2019-12-21 20:52:54 +00:00
Bruno Lourenço
d7f9d71be2 Fix contact shadow when light is outside of viewport. 2019-12-21 16:55:41 +00:00
clayjohn
676f647c74 Add a default POINT_SIZE 2019-12-10 23:08:20 -08:00
Rémi Verschelde
65e6efaa3b
Merge pull request #33836 from clayjohn/blinn-fix
Fix Specular Blinn function
2019-12-03 07:50:37 +01:00
PouleyKetchoupp
299b85c46f Disable shadow map sampling when shadows are not used in GLES3
Fixes #20742
2019-11-29 06:21:17 +01:00
clayjohn
334d41d7cc Fix Specular Blinn function 2019-11-22 22:03:26 -08:00
clayjohn
203fb1b348 Fix GL error by properly using float uniform 2019-11-21 07:44:09 -08:00
clayjohn
cd40154890 Fix issues with environment mapping 2019-11-19 22:30:48 -08:00
Rémi Verschelde
a39aeade5b
Merge pull request #32170 from puthre/ninepatch-fix
GLES2 & GLES3 Fixes ninepatch margins for high resolution textures.
2019-10-09 08:33:56 +02:00
Valentin Zagura
100d05cbec GLES3 Fixes for ninepatch margins when patch size is smaller than the patch texture resolution
Scaled ninepatch margins in screen space to be relative of the ninepatch size when the patch size is smaller than the patch texture resolution.
2019-10-07 13:19:27 +01:00
Rémi Verschelde
823c3def72 Fix copyright headers and style issues 2019-09-24 11:52:06 +02:00
Rémi Verschelde
159470df08
Merge pull request #32275 from godotengine/skin_support
Added skin support and simplified APIs to override bone position + glTF 2.0 import fixes
2019-09-23 15:02:15 +02:00
Rémi Verschelde
28265fb526
Merge pull request #31202 from azagaya/light-data
Create shadow_vec for altering shadow computation
2019-09-19 20:03:04 +02:00
Juan Linietsky
d81ddaf33e Added skin support and simplified APIs to override bone position. 2019-09-18 19:46:32 -03:00
azagaya
b835868067 Create shadow_vec for altering shadow computation
In 2.1 and 3.0, light_vec could be modified for altering shadow_computations.
But it broke shadows when rotating light. shadow_vec would do the same, but without breaking
shadows in rotated lights if not used.

Add inverse light transformation to shadow vec, so it's not affected when rotating lights;

Added usage define for shadow vec.

For shadow vec working properly when rotating a light, it's needed to multiply it by light_matrix normalized. Added usage define in order to don't do that if shadow_vec not used.
2019-09-06 13:55:49 -03:00
Holger Dammertz
aa3ef8893b Removed clamping of the Linear tonemapping when KEEP_3D_LINEAR
Changed the behaviour of the Linear tonemapping operator to not clamp to [0, 1] range
in the case when KEEP_3D_LINEAR is defined. This allows to render values > 1.0 in
floating point texture targets (via Viewport) for further processing or saving high
dynamic range data into files. This only works when no color conversion is active.
2019-08-29 18:14:19 +02:00
Holger Dammertz
8fb80788df changed the constant scale of cube_normal to -1.0 instead of -1000000.0; this fixes a rendering issue on oculus quest and does not change the computation as the vector is normalized afterwards.
Adapted the comment above the code to reflect the change made as it already mentioned that z could be set to 1.
2019-08-17 14:01:55 +02:00
RaphaelHunter
47df933c27 update algorithm about paking float to vec4 to fix shadow shift and change rgba_shdow options 2019-07-28 11:43:01 +08:00
BastiaanOlij
02ea99129e Adding a new Camera Server implementation to Godot.
This is a new singleton where camera sources such as webcams or cameras on a mobile phone can register themselves with the Server.
Other parts of Godot can interact with this to obtain images from the camera as textures.
This work includes additions to the Visual Server to use this functionality to present the camera image in the background. This is specifically targetted at AR applications.
2019-06-15 21:30:32 +10:00
clayjohn
2b8b1d7c46 added MultiMeshInstance2D node for using MultiMesh in 2D 2019-06-03 12:11:54 -07:00
Rémi Verschelde
603bb98340
Merge pull request #29188 from Calinou/improve-ssao-performance-quality
Improve SSAO performance and quality
2019-05-30 14:27:25 +02:00