Commit graph

51 commits

Author SHA1 Message Date
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
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
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
clayjohn
2b8b1d7c46 added MultiMeshInstance2D node for using MultiMesh in 2D 2019-06-03 12:11:54 -07:00
clayjohn
b804c491b7 fixed pixel snap precision artifact 2019-03-04 07:18:02 -08:00
Hein-Pieter van Braam
a83e77fded Explicitly use floating point numbers in the our shaders
We need to be explicit about using floating point numbers in our shaders
for compatibility with mobile GLES drivers.
2019-02-24 23:35:10 +00:00
JFonS
32e7641667 Revert back to ignoring LIGHT_VEC for 2D shadows 2019-02-21 12:16:10 +01:00
JFonS
076a342a4e Make LIGHT_VEC affect 2D shadows again 2019-02-10 21:14:32 +01:00
QbieShay
7c55228f5c fixed uv missing in vertex shader of canvas. 2018-12-13 07:48:30 +01:00
Rémi Verschelde
dd06f6ee70 Fix style issues and signature mismatch 2018-11-28 10:21:07 +01:00
Juan Linietsky
e6bc152de8 NORMALMAP was not working (no normal being used detected), fixes #9263 2018-11-27 18:05:20 -03:00
JFonS
cbfb7bd613 Make 2D particles work OOTB (again) 2018-11-13 23:25:05 +01:00
JFonS
85ce4a67ed Remove animation loop from ParticlesMaterial + improvements to CPUParticles2D
Remove animation loop from ParticlesMaterial and move it to
SpatialMaterial for 3D particles and Particles2D for the 2D case.

Added animation to CPUParticles2D as well as the "Convert to
CPUParticles2D" to the PAarticles2D menu.
2018-11-04 15:58:12 +01:00
Rémi Verschelde
ac2a4771d5 GLES2: Implement pixel snap 2D option 2018-10-02 15:53:24 +02:00
JFonS
8f4f79c767 Fix lighting of rotated particles in 2D
Custom instance transform was not taken into account for normal map
calculation. Also renamed `extra_matrix2` to `extra_matrix_instance` for
more clarity.
2018-09-18 22:58:13 +02:00
Rémi Verschelde
4226d56ca9 Style: Enable clang-format on GLSL shaders
As of clang-format 6.0.1, putting the `/* clang-format off */` hint
around our "invalid" `[vertex]` and `[shader]` statements isn't enough
to prevent a bogus indent of the next comments and first valid statement,
so we need to enclose that first valid statement in the unformatted chunk.
2018-08-27 07:34:14 +02:00
Rémi Verschelde
1b6d75a599 Style: Fix code formatting in GLES3 shaders 2018-08-24 13:42:18 +02:00
JFonS
4421a6661d Move light 2D rotation to vertex shader 2018-07-05 11:12:04 +02:00
JFonS
ac18444c7e Fix regression of 2D light height 2018-07-04 23:31:27 +02:00
JFonS
e9a3cf8feb Fix rotation of 2D lights 2018-06-19 11:24:51 +02:00
Juan Linietsky
3bd0ca2a2d Skeletal deform working 2018-05-04 11:54:21 -03:00
Juan Linietsky
b3e4bc562c Skeleton for 2D WIP 2018-05-03 17:29:56 -03:00
Pieter-Jan Briers
25ba49fd88 Fixes canvas light shaders.
Fixes #16904

Restore more out functionality, fix built-ins.

Requested changes, I think?
2018-04-13 15:18:28 +02:00
MrCdK
408f4cb146 Set correct types on a couple variables inside the canvas.glsl 2018-01-12 22:02:28 +01:00
Juan Linietsky
2c226e4edf Some fixes to improve precision and speed on Android. Fixes precision issues on Mali and PowerVR. 2018-01-02 18:45:00 -03:00
Guilherme Silva
ffe827ab5a Fix pixel snap not being used in 3.0 2017-12-19 15:18:07 -02:00
Juan Linietsky
7eabbeb5af remove half_texpixel in canvas since no longer used 2017-11-12 08:29:28 -03:00
Nathan Warden
6adaf8f47a Fixed a bug where clamp_uv was clamping one pixel short, stretching the last pixels. 2017-11-11 07:28:48 -05:00
Juan Linietsky
d4e20555e8 Ability to set a custom FOV makes it possible to use sky on orthogonal view. Closes #9186 2017-09-29 18:56:52 -03:00
Juan Linietsky
ddadc782ba Fix frame selection in 2D particles, closes #10668 2017-09-06 08:31:11 -03:00
Henrik Andersson
e0a19a77e5 Don't compare float to int 2017-09-04 22:21:55 +02:00
letheed
3a188015be add shadow_filter variant PCF7 2017-09-01 15:01:24 +02:00
Rémi Verschelde
82208c1e8b Merge pull request #10417 from bojidar-bg/x-fix-tilemap-transpose
Implement texture UV transpose in the gles3 renderer
2017-08-31 13:17:39 +02:00
Bojidar Marinov
92a42668f2
Implement texture UV transpose in the gles3 renderer
Now tilemap rotations work again \o/
2017-08-29 14:51:35 +03:00
letheed
a5d765db4f fix shadow filter pcf5 implemented as pcf7 2017-08-25 02:34:28 +02:00
Fabio Alessandrelli
9b9a723c77 Some fixes for shaders and WebGL2
Add padding to UBO data to be multiple of 16 bytes
Add precision definition for samplers
Replace texture2D (deprecated) with texture in shaders
2017-08-11 23:26:24 +02:00
Robert Hernandez
ffe8f8ca21 Fixed NinePatches not working on HTML5 2017-06-28 19:17:59 -04:00
Juan Linietsky
3ce046ee0c -Fixed SCREEN_TEXTURE and other related 2D shader parameters.
-Fixded BackBuffercopy object
2017-06-26 22:58:46 -03:00
Juan Linietsky
f27d2a3355 -Moved NinePatch to shader, saves a ton of draw calls rendering UI
-Implemented missing stretch modes, now tile and tile fit work
2017-06-21 23:37:25 -03:00
Juan Linietsky
95560e02c5 2D GPU Particles working.. 2017-06-21 16:26:26 -03:00
Juan Linietsky
0288be1e76 Texture rect_region drawing now clamps UV to avoid bleeding. This avoids scenarios like single-texture tilemap tiles leaking pixels to the next tile when filter is enabled on it. 2017-06-18 22:55:02 -03:00
Juan Linietsky
5c6cac4e53 Add normalmap support for drawing in all low level primitives. Only added support in Sprite so far. 2017-06-17 23:27:42 -03:00
Juan Linietsky
80929d36be TIME constant reverted to a single float, fixes #9123 2017-06-16 08:30:21 -03:00
Juan Linietsky
f8bd488457 Merge pull request #9109 from RandomShaper/optimize-2d-lighting
Add AT_LIGHT_PASS builtin to canvas shaders
2017-06-14 21:16:09 -03:00
Pedro J. Estébanez
93ffd9023f Add AT_LIGHT_PASS builtin to canvas shaders
This one allows for complex shaders paired with a simple lighting shader to skip code that would otherwise be pointlessly (and wastefully) run during the light pass.

Depending on your game (number of items and lights), this can yield some performance gain.
2017-06-15 02:03:15 +02:00
Juan Linietsky
a8a1f2e2a8 -Fixed occluder rendering, closes #8560
-Ability to smooth out 2D shadow filters
2017-06-13 01:23:04 -03:00
Juan Linietsky
c03131fc9f Rework shading modes and change location of light shader 2017-06-01 18:56:02 -03:00
Rémi Verschelde
93ab45b6b5 Style: Fix whole-line commented code
They do not play well with clang-format which aligns the `//` part
with the rest of the code block, thus producing badly indented commented code.
2017-01-14 14:52:23 +01:00
Juan Linietsky
1527cf8c0d 2D Shaders are working again using the new syntax, though all is buggy in general 2016-10-10 18:31:01 -03:00