Commit graph

138 commits

Author SHA1 Message Date
Rémi Verschelde
10b1f823bc
Merge pull request #80323 from garychia/canvas_point_size
Ensure `POINT_SIZE` takes effect in the canvas item shader
2023-08-21 08:21:14 +02:00
Dario
e2984af013 Add motion vector support for animated surfaces like skeletons or blend shapes.
Extends mesh instances that required custom vertex buffers to create two alternating buffers that are written to and binds them to use them as the previous vertex buffer when generating motion vectors.
2023-08-16 11:37:42 -03:00
clayjohn
40d70bf9b8 Fallback to linear color texture when using 2D HDR and MSDF font 2023-08-15 11:08:29 +02:00
clayjohn
57eb762bae Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance

Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear.
This is necessary for proper HDR screen support in the future.
2023-08-07 11:24:03 +02:00
Chia-Hsiang Cheng
0cf57e1927 Ensure POINT_SIZE takes effect 2023-08-06 16:44:16 +08:00
Yuri Sizov
bb15241e06 Merge pull request #77740 from ChibiDenDen/simplify_vulkan
Replace sampler arrays with constant sampler elements, simplify and reuse code for all shaders
2023-07-12 17:16:12 +02:00
ChibiDenDen
35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +03:00
Yuri Sizov
f6dcd7f51a
Merge pull request #75181 from dalexeev/fix-light-only-mode
Fix "Light Only" mode of `CanvasItemMaterial`
2023-05-27 17:28:29 +02:00
Allen Pestaluky
4e19f34856 Changed Subtract blend mode of Forward+ and Mobile renderers to match behaviour of the Godot 3 and Compatibility renderers
The OpenGL implementation has used GL_FUNC_REVERSE_SUBTRACT for a long time, but the new RenderingDevice abstraction used by the Vulkan renderers had been mistakenly set to BLEND_OP_SUBTRACT instead of BLEND_OP_REVERSE_SUBTRACT.

Fixes #77448
2023-05-26 10:50:35 -04:00
Danil Alexeev
43b0702a02
Fix "Light Only" mode of CanvasItemMaterial 2023-05-13 09:06:09 +03:00
James Christie
68149328f1 Set value of line_point_count outside of initialization 2023-03-16 01:20:41 -04:00
SlugFiller
f25508befb Fixes a canvas item set to clip children being drawn as black if no children are visible 2023-03-07 09:53:26 +02:00
Rémi Verschelde
5e57205365
Merge pull request #73478 from NewDefectus/master
Use the original canvas to calculate light positioning
2023-02-21 21:14:51 +01:00
Alon Ran
2d7db30f0d Use the original canvas to calculate light positioning 2023-02-21 11:57:16 +02:00
Yuri Rubinsky
94831c7209 Forbid passing multiview sampler to the custom function in shaders 2023-02-21 11:23:17 +03:00
clayjohn
dfbf439081 Avoid shading CanvasGroup nodes twice 2023-02-03 15:40:42 -08:00
clayjohn
cfd5fe0f29 Avoid crash when CanvasTexture used with light decal atlas
The decal atlas is used for Light2Ds, decals, and Light3Ds
2023-01-30 20:59:53 -08:00
clayjohn
eb9c2b878a Automatically transform Skeleton2D calculations so pivots are not needed 2023-01-27 14:55:22 -08:00
clayjohn
d3c3fa32af Stop incrementing light_count once max number of lights are reached in 2D canvas renderer 2023-01-20 17:04:00 -08: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
jainl28patel
390f83bf5a fix normal map not flipping in sprite2D 2023-01-14 11:51:56 +05:30
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
clayjohn
41021b07be Avoid updating particles during 2D rendering
In 2D the particle uniform set isn't obtained until the render pass. So in 2D just avoid rendering if not updated yet.
2022-12-22 12:04:34 -07:00
clayjohn
1b330820bf Implement render_target_was_used API so that Viewports can properly check if they have been used.
For the RD renderer, this does not work for Viewports used in scene shaders yet
2022-12-16 09:50:45 -08:00
Yuri Rubinsky
56954485ed Refactor ShaderData & fix the sorting of shader uniforms 2022-12-15 10:02:59 +03:00
clayjohn
0a88c68d0a Detect and report if 2D particles use the screen SDF
This ensures that the SDF is updated even if not used in a canvas_item shader
2022-12-07 10:03:08 -08:00
Markus Sauermann
28af870750 Code simplifications found by cppcheck
They are based on:
- Boolean arithmetic simplifications
- setting variables that are not accessed
- constant variables
2022-11-21 08:43:36 +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
Rémi Verschelde
1691a33eb9
Merge pull request #67374 from MrBlockers/fix-draw-primitive
Fix draw_primitive ignoring texture argument
2022-11-11 10:43:18 +01: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
e1caa8797b
Merge pull request #67043 from clayjohn/clip_children
Improve behaviour of clip_children by clipping to parent alpha value but still retaining parent color
2022-10-27 09:59:27 -07:00
MrBlockers
0c4fd03f40 Fix draw_primitive ignoring texture argument 2022-10-21 21:35:13 -04:00
Aaron Franke
7f9a8c99c9
Clean up Basis from Euler code 2022-10-21 17:54:49 -05:00
clayjohn
b6f44859d7 Implement multiple clip_children modes for CanvasItems 2022-10-14 08:02:28 -07:00
clayjohn
09b1a6f85f Improve behaviour of clip_children by clipping
to parent alpha value, but still retaining
parent color
2022-10-13 18:35:12 -07:00
Rémi Verschelde
8017827144 SCons: Re-enable treating #warning as error with werror
Replace all TODO uses of `#warning` by proper TODO comments, and will open
matching bug reports to keep track of them.

We don't have a great track record fixing TODOs, but I'd wager we're even
worse for fixing these "TODO #warning" so we should prohibit this usage.
2022-10-10 16:12:26 +02:00
clayjohn
4765e5fa64 Allow clearing backbuffer after finishing CanvasGroup
This avoids an issue where having multiple CanvasGroups overlap
would create a weird artifact
2022-10-07 14:13:40 -07:00
Rémi Verschelde
ecd4ab1e14 Merge pull request #66683 from clayjohn/SRGB-canvasitem
Default CanvasItem materials to use sRGB space for uniform colors
2022-10-05 11:44:52 +02:00
Aaron Franke
2cea42cc7f
Rename Projection matrix to columns 2022-10-04 12:34:19 -05:00
clayjohn
06d0e56559 Default CanvasItem materials to not convert uniform colors to linear space.
The 2D renderer in Godot is totally in sRGB space so it is appropriate
to keep 2D uniform colors in sRGB space
2022-09-30 15:15:11 -07:00
clayjohn
1a0890122f Clean up canvas light shader API.
Expose LIGHT_ENERGY and LIGHT_IS_DIRECTIONAL.
Add LIGHT_DIRECTION
2022-09-28 11:46:58 -07:00
Hendrik Brucker
e235bca995 Fix/restore BackBufferCopy 2022-09-15 02:36:39 +02:00
Yuri Rubinsky
8191b3c110 Rename uniform to parameter across the engine 2022-09-01 11:42:57 +03:00
sakrel
728fb6ea95
Fix updating OccluderPolygon shapes 2022-08-29 03:51:53 +02:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
bruvzg
bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
Max Hilbrunner
019d6584ee
Merge pull request #64167 from clayjohn/screen-texture-hint
Add shader uniform hints for screen textures
2022-08-19 21:51:39 +02:00
clayjohn
028ef2edc8 Add shader uniform hints for screen textures so users can specify custom filter and repeat modes.
At this time, it works best in the Vulkan Renderers as they support using multiple samplers with the same texture.

In GLES3 this feature really only allows you to use the screen texture without mipmaps if you want to save the cost of generating them.
2022-08-09 12:29:49 -04:00
Hugo Locurcio
db22b7ded0
Rename shader parameter uniform setter/getter methods for consistency
`shader_uniform` is now consistenly used across both per-shader
and per-instance shader uniform methods. This makes methods easier
to find in the class reference when looking for them.
2022-08-04 23:17:06 +02:00