Gradient smoothness

I’m doing some curve gradient but I feel i dont get as smooth gradients as I’d like.

In the image render attached you see quite distinct breaks in the gradient where the CPoints are. Below is a screenshot of the Gradient editor for the frame and there you see a much smoother gradient.
I’ve tried unticking the Fast checkbox for the Gradient along with trying all other settings without getting any better result.
I can get a better result if I add a lot of CPoints and manually tries to smooth the gradient out but since I want to animate it this is not a solution I would like to do.

So, is it possible to get smoother gradients without adding a lot of CPoints?

Yes, I’ve noticed it too and don’t know how to solve it or why is it due to. I think that the problem is that the colors that you select in the Cpoints list are not in a “smooth color curve”. It is like a bline, you choose the vector positions but the tangents can produce a non smooth curve is they are not properly tweaked. The color transition in a Cpoint depends on the Cpoint itself and also on the previous an the next color. So for a given previous and a next color and positions there is only one color, position pair compatible with a smooth looking. Any other combination would produce a non smooth looking.
Can you do it with Gimp or Inkscape for example?



Well, I can get by anyway, I’m doing quite some processing of the gradients afterwards so it isn’t so obvious in the finals anyway.
I was more curious if there were any way to get past this issue in synfig.

Hi all - I am seeing this non-smooth gradient issue was noted 11 years ago. I am still experiencing it now when I render any gradients in my videos as mp4s. Has anyone found any tricks to make gradients come out looking smooth when you render? It happens with exporting from synfig to video file like mp4, but also even happens if I export as a PNG sequence and then make a video file. Any thoughts?

This sort of a weird example but in this 360 video of brain anatomy I did, if you navigate down and around below the brain at the purplish/reddish background, you can see there are those sort of strata or lines in the coloring there. I didnt want those there - I had just put in a smooth gradient.

Wait, it is a compression issue, is it not? If you export your work to png and then open one of the files, will this gradient issue still be noticeable? Also, what render parameters do you use (target, parameters, quality, anti-aliasing)?

One more thing, the overall quality of the video is very poor despite big resolution, like it was upscaled or something. How do you make those 360 videos? Maybe problem is in software that converts mp4 to 360 format? I personally never did those kinds of videos, so I don’t really know what I am talking about.

Hey Svarov thank you for your quick response.

It is not just with the 360 videos, but with any video i make. I just made a fresh gradient to confirm again. When I export as a png I can see little lines along the gradient, but they are subtle in the test I did and not that bad at all…but when i animate the gradient to move around and export a video, that’s when those ridges become really apparent (of course in my example it looks subtle now so I feel silly but you can still see what happens!).

If you can educate me on what anti-aliasing is and any other parts of my parameters/settings that might be impacting this, I would be grateful! I have tried previously just ramping up the Quality really high and that didn’t help.

Thank you for any ideas!

For file size, etc I am providing as google drive links:
gif - other type of weird lines!:

Can you upload Synfig file (.sifz) with example of bad gradient? I can’t quite understand if you have the same issue as original poster or not. Appears to be different since you don’t seem to use a lot of CPoints in your test render.

In short, keep anti-aliasing and quality as default. Anti-aliasing higher than 1 produces very subtle improvements you’ll never notice. Quality parameter is reversed: 1 means best, 9 is the worst. Quality from 1 to 3 is almost indistinguishable from each other, so stick with 3.

The more important thing here is codec. It is better to set it to mpeg4/H.264 (lossless) or png because Synfig doesn’t allow you to specify encoder’s options, so who knows what quality (level of lossy compression) it sets encoders to (XviD/DivX in your case).

But you did say that png produces bad result also, so it’s hard for me to keep guessing without example.

Okay thank you for those explanations. (Maybe a separate issue: Unfortunately when I switch to the lossless codec, the resulting file is one my computer cannot play?)

Anywho, here is a .sifz file of a basic gradient animated. Also to be clear, in my screen within synfig it is nice and smooth, and when I use preview window it is nice and smooth. Only when rendering does it get the lines. Thank you again.

Gradient test.sifz (1.1 KB)

So it’s a simple linear gradient? I honestly thought you had some crazy setup… Oh well, the issue in your case seems to be the codec. I played a bit with it and lines in gradient produced by mpeg4/DivX is more noticeable then in H.264 (lossless), especially in the end of animation.

So we’re going to suffer a bit, but in the end you should get more decent looking gradients. I don’t have a Mac, but I think I know how to solve the playback issue you’re having. Follow me:

  1. Render your work as GradientLossless.mp4 (for example)/ffmpeg/H.264 (lossless), quality 3, anti-aliasing 1.
  2. Now you have GradientLossless.mp4 that you cannot play. Are you familiar with command line? If so, use the following ffmpeg line to convert GradientLossless.mp4 to lossy version: *path to ffmpeg*/ffmpeg -i "*full path to the file*/Gradient test.mp4" -c:v libx264 -preset medium -crf 17 GradientLossy.mp4
  3. You should be able to play the converted file. The ‘-crf 17’ option stands for high quality, so even though it’s technically ‘lossy’ now, you shouldn’t notice any difference between this and lossless version (if you could play it in the first place of course).

Try above solution and tell me if it’s better now. In my tests I was still able to see some ‘lines’ in the end of animation you provided even with lossless codec, so yeah, no perfect gradient for us. Strangely enough, the ‘png’ render gives better results then ‘mp4/lossless’ which should be the same in theory.

Hey sorry for the delayed response - I successfully got a lossless mp4 to play (when I tried with a different video I was able to see it without using ffmpeg actually - strange) but the gradient lines were similar. Sounds like this is just intrinsic to the rendering - ah well. Thank you very much for all of your efforts.