Planetside Software Forums

General => Terragen Animation => Topic started by: yesmine on May 27, 2014, 01:26:50 am

Title: Flicker in animations, and what exactly is it?
Post by: yesmine on May 27, 2014, 01:26:50 am
I've been reading about and viewing some samples of animation in Terragen 3, and was curious about what causes the flickering that some people have had problems with. It looks to be on smaller surfaces; there was one mention of reflectivity of the trees/leaves, though I don't think that turned out to be the case, but Global Illumination seems to get mentioned a lot as having some bearing on it.

I suppose it's what makes leaves look like they are trembling or flickering rapidly, perhaps light falling on them is somehow being recalculated between frames, though it's just my guess. But it seems to only be at certain times when there is bright light hitting at the right angle. Whatever the case, I couldn't find any definitive answer to why it could happen. I'd like to know if there has been any conclusive determination of what causes it and if it can definitely be avoided, or is it just inherent in animations?
Thanks.
Title: Re: Flicker in animations, and what exactly is it?
Post by: N-drju on May 27, 2014, 03:36:55 am
I believe so. It is an animation-specific issue as there is nothing in still images that can flicker. ;) I can only tell you that in animations you can straighten this up if you precalculate and use GI cache file. Basically this process precalculates GI and saves it as a single file for you to use later on. In my understanding GI cache file is simply an information for TG to use exact same lighting in whatever frame or image that you work on. Still, it comes in handy in still images if you're doing crops and have shades differences between them. :) Also, you can use a single GI cache file in several projects where you have similar "lighting conditions."

Have you read this already?
http://www.planetside.co.uk/wiki/index.php?title=Terragen_2_Global_Illumination#Rendering_with_GI_cache_files
Title: Re: Flicker in animations, and what exactly is it?
Post by: Hannes on May 27, 2014, 04:17:22 am
Yes, GI is a big factor here, but if you're talking about leaves here, the leaf texture may also be a reason for the flickering issue. It sounds weird, but I already heard that if a texture image is too high res, then animations may flicker as well. Some kind of antialiasing flicker? Just a thought...
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on May 27, 2014, 10:20:34 pm
I've heard that the flicker is mostly caused by aliasing issues, specifically when there are details that are smaller than a pixel (which distant foliage is really notorious for).
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on June 01, 2014, 11:17:14 pm
There are multiple sources of flicker, as others have alluded to. The biggest is often Global Illumination (if used), which will cause potentially large lighting changes across big areas of the image between frames. This causes very noticeable flicker, especially in clouds. The solution to this is GI Caching, which is documented at the link above, and not much more needs to be said about it. It is one problem we have addressed fairly well, fortunately.

In Terragen in particular, another major source of "flicker" could be shadow or geometry "popping", in other words dramatic changes of shadow casting or geometry shape between frames. For shadows this is usually caused by geometry that is off-camera and casting a shadow and being reduced in detail by optimization algorithms in the renderer (imagine if you had to render 360 degrees around your camera at full detail for every render, a large part of the rendering process would be spent on parts you never see!). There are some settings in Terragen to address situations where this happens, they include the "Ray detail region padding" and GI region padding and they're disabled by default since they increase render times. For geometry popping, this can be due to detail being too low, to differing calculations between frames based on some missing or incorrect setting (e.g. Detail Blending is set to 0), or to other render optimizations which can be tuned as well. The Check Animation button on the Render Sequence tab usually helps setup good animation settings that avoid flicker, however with strong or very small-scale displacements the settings it automatically enables can actually be detrimental unfortunately. We're working on improving that, but for now you'll definitely want to render a set of sparse test frames after changing render settings using Check Animation.

Other sources of flicker or "sparkle" or other inconsistencies between frames often come down to some form of "aliasing" or noise, which are both related to undersampling, or not having enough "samples" in the rendering process to accurately represent the object/texture/shadow/etc. in question. Aliasing is a broad term in "signal processing", and more specifically in computer graphics ( http://en.wikipedia.org/wiki/Aliasing ), but for this consideration it basically boils down to circumstances which cause samples of an object/texture/cloud/etc. to vary between frames to a larger degree than would be expected based on the motion of the animation. Aliasing also happens in still images however. There is edge and texture aliasing for example, as well as shadow aliasing due to undersampling, cloud/volumetrics aliasing, and more. Many settings can help with each of these problems. For general edge aliasing, you would want to just increase the overall Antialiasing amount for example. For noise in clouds, you'd increase cloud Quality in the Quality tab. For noise in atmosphere/shadows, increase Atmosphere samples. For noise in soft shadows, increase soft shadow samples and/or reduce Sample Jitter.

Ultimately there are a few major categories of potential problem that can manifest in many different ways and to varying degrees. Use of extreme settings, e.g. strong displacement, big, thick, dense clouds, etc. can exacerbate these problems. It's best to start with the Renderer defaults, use the Check Animation button, render some sparse frame sequences at full detail and resolution (i.e. every 10th or 20th frame) to check for problems, and then to focus specifically on each issue found to address it, rather than for example cranking up all possible settings to max to avoid any *possible* problems ahead of time. The latter is just a recipe for insane render times.

I hope that helps. If you have specific examples of flicker you want more detailed feedback on, just post them here.

- Oshyan
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on June 02, 2014, 09:23:00 pm
Oshyan,
Is there any way you or someone equally knowledgeable could put together a summary in the FAQ of exactly what all the different renderer settings control?  I know that some of them are covered, but a number of the more obscure ones in the render node's internal network that are changed with the 'check animation' button are a complete mystery.
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on June 02, 2014, 09:40:54 pm
Matt would be the one to do that as he understands those settings best. Hopefully he'll have time to do so soon.

- Oshyan
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on June 28, 2014, 11:56:56 am
Sorry to revive this one, but I am having some persistent flicker issues with an animation I'm working on.  As you can see in the file, the tree bank that appears on the left near the end of the sequence is a flickering nightmare.  I've already solved issues with shadow pop (increased the detail padding) but despite using the cubic b-spline filter and an AA setting of 8 the tree flicker persists.  Any ideas what I'm doing wrong, or is this the type of scene that is going to flicker no matter what I do because of the fine details in the trees?

BTW, the attached .tgd file does not have the tree or grass models due to size, but all the render settings are what I am currently using.

[vimeo]http://vimeo.com/99414371[/vimeo]

Note: the Vimeo compression removed most of the flickering so it is just a reference to how the camera is moving.
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on July 01, 2014, 05:44:10 pm
It's hard to say for sure what is causing that. It looks like a very thin strip of beach in the sun, an area of high contrast against the dark and shadowy trees behind. If that's the case you could consider just adding a few more trees to shadow that line. If that's not a good solution for you, there may be other settings that can help, but it's hard to say for sure without being able to do tests on the scene as you have it. I have the models you're using actually, but I can't reproduce the scene without the .TER. If that's not too big (try compressing to .7z before uploading), it would be great to have that for better troubleshooting. You can also email it to support@planetside.co.uk if it's too large for posting here.

- Oshyan
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on July 01, 2014, 07:23:59 pm
Oshyan, Is this the file you're looking for?

[attachurl=1]

Should just barely fit under the limit.
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on July 01, 2014, 11:41:04 pm
Yep, that's the one. OK, so looking at this file, I think my initial impression of your issue is pretty correct. You have a very narrow line of very bright sand (beach) that is in heavy shadow from nearby trees. The trees have fine vegetation and are casting shadows on to the beach and leaving only a thin bright line, which is hard to antialias (smooth out) effectively. I rendered that section in a crop of a 3000 pixel wide image and it shows that the line is very thin indeed, so it will be hard to deal with inherently.

Your render settings in general look good, I would not necessarily recommend changing any of them just to fix that one issue. If you did want to change one thing to improve it, it would be to increase detail to 1, but that's going to really increase your render time. Turning on Soft Shadows also helps a bit in some respects, but again increases render time. So I would instead recommend trying to change what is happening on that far beach, either by adding more trees to put the beach totally in shadow, removing some trees from the population with the instance editing tools so that there is more light there and thus a wider (and easier to antialias) line of beach, or even changing the color of the beach, either in general, or in that specific area (e.g. with a Painted Shader masking an additional Surface Layer).

- Oshyan
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on July 02, 2014, 12:46:40 am
Thanks Oshyan.  Any suggestions on reducing the flickering in the trees in the middleground and background?
Title: Re: Flicker in animations, and what exactly is it?
Post by: Tangled-Universe on July 07, 2014, 04:45:05 am
As far as I know any kind of noise/sparkling/flickering in vegetation is likely due to AA settings.
You're using AA8 which generally should give good results, so that's may be a bit surprising.
You can try a bunch of frames with AA12.
Don't simply change AA from 8 to 12 in the main render settings, because you have your sampling method customised, but I think you are aware of this.
So go to the sampling settings dialogue and double-click on "customised sampling" checkbox and you'll see that TG automatically re-determines the optimal pixel noise threshold for the new AA setting. For AA12 this is 0.025. Now again, set sampling method to 1/16th first.

The drawback of increasing the AA is that you are also using defer atmo and thus atmosphere rendering may become slower.

Atmosphere can contribute to the issues you are experiencing, so you may choose first to leave them untouched and see if the issue resolves.
Then you can disable defer atmo and increase atmosphere samples to 32 or 48 and do some tests again.
This will quite likely give better rendertimes, but may introduce noise in shadows.

On the other hand, you only use 10 atmosphere samples and in some cases you can even speed things up by increasing the number of atmosphere samples. That feels counter-intuitive, but with 1/16th first samples it might just mean that with the first AA-pass there are sufficient atmosphere samples already present! This means the noise is below the pixel noise threshold and thus no need to apply more AA to the respective pixels. This is how the adaptive AA works in TG.

So there are a couple of things to explore and try out.
Luckily, you'll develop a general sense for these settings over time, which allow you to choose "correct" settings more quickly.

Regarding your animation...

Quite nice animation :) You may consider giving the camera a bit more forward/backward movement and perhaps some rotation on the Y-axis, just to make it a bit more dynamic.

What I also like to do myself, but you need something like Nuke or After Effects for it (I have AE), is to animate it at a similar camera speed like you have but then use a retime tool like Kronos to slow down the animation.
Sometimes you can even slow it down 3-4 times, which makes your animation 3-4 times longer, for "free"! :)
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on July 07, 2014, 04:50:58 am
T-U has some good advice here for sure. Myself, I didn't really see this other flicker so much. Perhaps posting a less compressed/higher resolution test would be helpful in demonstrating it. You could even render just a crop of the area you see a problem.

- Oshyan
Title: Re: Flicker in animations, and what exactly is it?
Post by: Tangled-Universe on July 07, 2014, 07:12:26 am
Other suggestions I have and just came to my mind is that you can increase the GI's "strength on surface" to brighten up the shadows under the foliage. I would just bump it from 1 to 2.
If possible for you to post-process; render the animation in render elements.
If you do so then the element "surface indirect" represents the effect of GI on surfaces.
So if you have chosen a value for "strength on surface" for GI and you're not happy (too dark/light) then this render elements allows you to control this entirely in post. Awesome!
For example, if you think it's too dark then you can duplicate the layer and you'll have twice as much contribution of GI to the surfaces.
You can also simply adjust the exposure of the respective layer(s).

Soft shadows are indeed more expensive to render, as Oshyan pointed out, but if you wish to do so at some point then you can often get away with strongly reducing the sample jitter of the soft shadows. Even at 0 might work and also reduces the chance of flicker if I'm correct.
The downside is that it can give visible banding, but as long as the shadows are being cast on rough surfaces you'll barely notice, if at all.
Title: Re: Flicker in animations, and what exactly is it?
Post by: jdent02 on July 07, 2014, 08:19:11 am
T-U and Oshyan, great advice.  I found some other threads in the forums dealing with foliage flicker and the higher AA settings were mentioned as a possible solution.  Sometimes I forget that the sliders can be set outside of the 'recommended' range  ;D.  I bumped the AA up to 11 (with the customized sampling) and rendered without deferred atmosphere.  That took care of a lot of the problem.  It was still there, but greatly reduced.  I'm now re-rendering at AA 12 and that should do it.

T-U, I felt exactly the same way about the camera motion so I ended up redoing it.  It still moves quickly, but it spends more time ramping up in speed and hangs out in the trees longer (I just love the way the tree trunks and grass look).  I was considering rendering out the different layers as well, I just have to budget to see if my hard drive has enough space..........

Thanks again for the advice (and letting me hijack yesmine's thread).  Terragen's rendering engine is awesome, but it definitely requires a different way of thinking compared to the path tracers I'm used to.
Title: Re: Flicker in animations, and what exactly is it?
Post by: Oshyan on July 07, 2014, 03:27:27 pm
Soft Shadow Jitter should either be 0 or 1, values in-between aren't that useful. It's been turned into a checkbox for a future update. :D

- Oshyan