tooll3 / t3

Tooll 3 is an open source software to create realtime motion graphics.
MIT License
3.48k stars 193 forks source link

LinearGradient discontinuity #475

Open grant-h opened 1 month ago

grant-h commented 1 month ago

Describe the bug I am experiencing a discontinuity (that little black line) for LinearGradient. This manifests as flickering while changing the offset parameter to make it animated. Running on 3.9.3 under Wine so not sure if this is just for me.

Please complete the following information):

Screenshot from 2024-10-08 11-24-11

Patch

[{"Name":"Object","Id":"bf183f61-6536-4290-b7bd-ace26f0de2eb","Inputs":[],"Children":[{"Id":"609c6fe2-9706-48c0-82db-93debc626451"/*LinearGradient*/,"SymbolId":"2c3d2c26-ac45-42e9-8f13-6ea338333568","InputValues":[{"Id":"e47e9e63-9c94-4c29-9555-2452fa498d57"/*Gradient*/,"Type":"T3.Core.DataTypes.Gradient","Value":{"Gradient":{"Interpolation":"Smooth","Steps":[{"Id":"21d24dcd-f1c2-4596-bdc8-72800b9a7299","NormalizedPosition":0.0,"Color":{"R":0.0,"G":1.2159347E-11,"B":1E-06,"A":1.0}},{"Id":"fd66af7f-e9f4-4989-8a56-23dfb8f4a042","NormalizedPosition":1.0,"Color":{"R":1.0,"G":0.99999,"B":1.0,"A":1.0}}]}}},{"Id":"10d59d0f-a5a3-42e6-b874-345ab028978e"/*Width*/,"Type":"System.Single","Value":0.56},{"Id":"e4739314-4075-4d14-a80d-79e149081dac"/*SizeMode*/,"Type":"System.Int32","Value":1},{"Id":"5774969c-ef4d-482e-ab37-b3a84b09debb"/*PingPong*/,"Type":"System.Boolean","Value":true},{"Id":"7f3fe86d-f259-458a-908a-0a71d39ca678"/*Repeat*/,"Type":"System.Boolean","Value":true},{"Id":"abf3456d-35bc-49ec-9aa6-c5571fbb209a"/*Center*/,"Type":"System.Numerics.Vector2","Value":{"X":1.22,"Y":0.04}},{"Id":"c38647f6-c6ea-40a0-b872-0df6d4168c05"/*Offset*/,"Type":"System.Single","Value":0.93},{"Id":"29587763-5456-4d33-bfd4-5d47b133f1cd"/*OffsetMode*/,"Type":"System.Int32","Value":0},{"Id":"53afc8d9-f417-4628-9a97-220bec62919f"/*Resolution*/,"Type":"T3.Core.DataTypes.Vector.Int2","Value":{"X":850,"Y":480}}],"Outputs":[]}],"Connections":[]},{"Id":"bf183f61-6536-4290-b7bd-ace26f0de2eb"/*Object*/,"InputUis":[],"SymbolChildUis":[{"ChildId":"609c6fe2-9706-48c0-82db-93debc626451"/*LinearGradient*/,"Position":{"X":0.0,"Y":0.0}}],"OutputUis":[]}]
ylmrx commented 1 month ago

This happens on every systems. (not specific to wine execution)

it's due to rounding errors and float resolution when there's overlaps (ie. repeating gradients)

you can work-around it tweaking Center.y (resp. Center.x, if you have a vertical gradient) until it's out of the image.

I tried tweaking the shader in order to avoid those glitches (or drastically reducing them), to no avail.

grant-h commented 4 weeks ago

The glitches seem to flicker as the texture is scrolled in a way that seems out of range for typical data. It almost seems like some values are not initialized on the first frame or with certain floating point offsets. In short, this feels like a bug to me