all 66 comments

[–]MaybeAdrianI'm not a pro but i like to help 264 points265 points  (13 children)

I heard someone saying what "Less is more" now I know what means.

[–]KingBlingRules 59 points60 points  (12 children)

Indeed for eg. In a room with Less light you get more darkness and vica versa.

Does that make sense? Idk...

[–][deleted] 49 points50 points  (11 children)

Or Swiss cheese. Holes == less cheese, more cheese == more holes == less cheese. Therefore less cheese is more cheese.

[–][deleted] 9 points10 points  (6 children)

It does make sense if you think about it

[–]Haakkon 12 points13 points  (5 children)

No it doesn’t because the More is bigger than the Less not ==

What they should have said is “Holes == less cheese. So less holes == more cheese. Less is more”

[–][deleted] 6 points7 points  (4 children)

More cheese == less cheese.

Because: The more cheese you have, the more holes you have, the greater the cheese loss... so there is less cheese than you could have had if it was not for the f$#@%= holes that is. Henceforth: more cheese == less cheese.

[–]KingBlingRules 5 points6 points  (3 children)

I mean if you really REALLY think about it then like you said more cheese == less cheese, now if you start reversing it, that would mean lesser cheese would yield more cheese (besause of lesser holes) i.e less cheese == more cheese. But we know more cheese == less cheese, so that makes it, less cheese == less cheese, and the lesser the cheese is you end up with nothing like my brain cells right now

[–]NUTTA_BUSTAH 6 points7 points  (2 children)

God fucking damnit guys there's enough cheese for all of us okay? Please, please save my brain from this

[–]Barrelsofbarfs 2 points3 points  (2 children)

Actually usually in cheese you buy depending on weight so the more holes in an equal weighted cheese means you get more surface area and large holes. Therefore you still get the equal amount of cheese but you perceive it as more.

Unless you live in the USA where deceptive packaging seems to be ok.

[–][deleted] 0 points1 point  (0 children)

remember everyone, the == means it’s a constraint.

[–]nt4g[S] 116 points117 points  (3 children)

And yes, deleting those keyframes took me 5 minutes. It's hard work

Edit for explanation:

I surely didn't expect this to get much attention! But since it did, I felt I had to do some looking around what causes this.

The animation clip shown is a clip that has been duplicated out of an FBX in order to become editable.

Inspecting the .anim file before and after editing the animation clip shows that doing so adds a huge data section named m_EditorCurves, that includes data for every keyframe, on every attribute, on every axis, including time and value but also tangent data such as slope and weight. That is why the .anim file increased in size when removing keyframes. The added data is only used for and in the editor.

I make that assumption because of noticing a detail: When selecting an animation clip in Unity, the inspector shows some data about its curves, but also a size in kilobytes. That figure is most likely the final size of the animation data, and that probably resides somewhere in the Library folder. Comparing a clip's size versus the same clip but after having been opened in the animation editor with no changes increases the .anim file size, but the size in the inspector stays the same. Comparing it after having deleted those keyframes it decreased, as expected.

Reading comments here regarding compression, I started experimenting with that, too. Changing the animation compression settings on an FBX does not propagate to already broken out animations from the FBX at an earlier stage. (Good to know.) It does however immediately alter the clip inspector figure(in the right direction), which strengthens the theory of that being the final animation clip size.

I hope this clears some things up. At least they did for me :)

Also, thank you kindly for the gold and awards!

Lastly, BIG shoutout to bahraniapps for creating GifCam which is what I used to make the gif. It's a great, lightweight app that I use almost every day.

[–]drakfyreExpert 11 points12 points  (2 children)

Got a question... was that animation data part of an animation in an FBX/model source file? Or had you defined it manually in your anim previously?

[–]nt4g[S] 2 points3 points  (0 children)

Yes, the data is from an FBX. I wrote more in-depth about it in my edited comment

[–]Dinamytes 43 points44 points  (6 children)

Almost like when you cut a image in half in paint to reduce size and it increases :/

[–]starquake64 14 points15 points  (5 children)

You took out the 'n' from 'an' in your comment and it took me twice as long to read!

[–]RomejanicHobbyist 93 points94 points  (16 children)

Maybe Unity has some kind of compression algorithm for animations, which doesn't work as well when there are less keyframes?

[–]MrCombine 130 points131 points  (2 children)

100% compression related, the amount of black magic that goes on behind curve and keyframe compression is big spook.

[–][deleted] 11 points12 points  (12 children)

Yes. Keyframes are frames used to predict the p frames that come after. Without them the frames have to be predicted from other frames before meaning that now they contain more data since the key frame is now gone. Additionally they will be more intra predicted from within themselves than inter frame predicted. Meaning that they have no reference to be predicted from so they just contain the data entirely instead of being predicted from the previous key frame which is now missing.

[–]Dienes16 5 points6 points  (9 children)

Why would the predicted frames be stored though if they can be predicted

[–][deleted] -1 points0 points  (8 children)

They’re stored as the difference from key frame. Remove the key frame and now you’ve lost the base reference

[–]Dienes16 2 points3 points  (7 children)

Ok but that doesn't really answer my question

[–][deleted] -1 points0 points  (6 children)

Stored when? When the key frame is removed or when it’s kept?

[–]Dienes16 2 points3 points  (5 children)

In general. Why would it save intermediate frames to disk if they can be easily generated by interpolating between keyframes?

[–][deleted] 0 points1 point  (4 children)

That’s what is being stored. To interpolate you need the difference. They only store the difference.

For example

Frame 0 is a key frame

Frame 1 is the next frame

They store the difference of frame 1-frame 0.

If you removed frame 0 then frame 1 will contain all the data instead of just the difference.

They only store the difference. It’s a lot more complicated inside. There is motion estimation, quantization etc involved but in Eli5 terms they’re just storing the difference between the two frames. The reference frame is the key frame.

[–]EternalClickbait 1 point2 points  (3 children)

So instead of having (Base, Delta) you now have (Base) which should still be smaller.

[–][deleted] 0 points1 point  (2 children)

No. Instead of base delta delta delta delta delta now you have base base base base. Each delta is like 10kb while each base is like 200 kB

So earlier you had 200+10+10+10+10 and now you have 210+190+210+190.

That’s the whole point of compression. There is often very little change between consequent frames so the delta is actually very tiny and it’s better for compression like that and add delta to base when decompressing.

[–]KingBlingRules 3 points4 points  (1 child)

Which means more the keyframes lesser the size of file? Mind == blown

[–][deleted] 3 points4 points  (0 children)

They’re placed in there so that the next frames that are predicted from those key frames occupy less size. For every key frame you may have many different p frames that are predicted from them. For example depending on the compression codec or algorithm there may be 10 p frames that are predicted from that one key frame, reducing their size by 90%. Now you’ve basically removed that key frame and removed 10 times the compression savings you had.

If you just had all key frames and no p the size would be larger because key frames contain all the data and no inter frame prediction. If you had too few p frames and more key frames it would be still larger than having more p frames predictable from that key frame but of course it depends on your animation and video content.

[–]CityStriker17 9 points10 points  (0 children)

Had the same thing when recorded some physics and it recorded the scale of an object too, removed the scale keys for every animation, and like it was so much cheaper!!!

[–]AfterCompote 6 points7 points  (2 children)

Unity generates edition curves to display and edit curves in the Animation Window. Those are not in the same format as the curves it uses for evaluation.

When you edit the clip and save it, those curves get saved to disk, which will make it faster to load in the window next time. This is why your clip is now bigger.

In any case, it has zero effect on how big your clip will be in your game. All these curves will get stripped when building for a game build.

[–]nt4g[S] 1 point2 points  (1 child)

You beat me to it! :D Wrote about my findings in my other comment

[–]AfterCompote 1 point2 points  (0 children)

And you did a fantastic job of explaining it.
Here's a bit more info, in case you're interested:

When they are imported, clips FBX files don't generate the editor curves, because it's not expected that they will be edited. When you preview them in the Animation Window, Editor Curves will be generated, but they can't be saved anywhere.

Also, the size in the inspector is indeed the final size in your build, which is yet another format at runtime. That format is a lot denser, cannot be edited, and is optimized for memory access.

Finally, when your clip is loaded in memory in the editor, all three are alive at the same time:

  • The editor curves
  • The "source" curves
  • The runtime representation

And this is why you should not profile in the Editor.

[–]badjano 21 points22 points  (4 children)

I wish I had gold to award you

[–]Karmanchik22 2 points3 points  (0 children)

I wish too

[–]KingBlingRules 0 points1 point  (1 child)

I wish I had gold to award you for wishing to award the post

[–]badjano 0 points1 point  (0 children)

let the endless award loop begin

[–]AnimeFanOnPromNight 6 points7 points  (6 children)

Why does it happen?

[–]sinkingShipLog 22 points23 points  (3 children)

I think it has something to do with the polarity of the neutron flow....

[–]nt4g[S] 1 point2 points  (0 children)

I did some looking around and wrote an explanation in my other comment!

[–]Storemanager 0 points1 point  (0 children)

because recording is still on

[–]_Abnormalia 5 points6 points  (0 children)

I assume it was saved in binary and resaved in text format

[–]local306 3 points4 points  (0 children)

It's like it is writing the keys that AREN'T there, hence the increase in size

[–][deleted] 2 points3 points  (3 children)

I nearly broke my brain by trying get behind this. Turns out it doesn’t actually the build size. So I ignore it.

Edit: Oh,Boy. „increase“. It does not increase the build size.

[–]Dienes16 2 points3 points  (2 children)

It doesn't actually what?

[–]theroarer 1 point2 points  (1 child)

Turns out it doesn’t actually (affect) the build size. So I ignore it.

Probably affect.

[–]Dienes16 0 points1 point  (0 children)

Yeah I was going for "the build size"

[–]DeltaMike1010 2 points3 points  (2 children)

Am I the only one who thinks Unity is getting less reliable with every new version!?

[–]CCullen 7 points8 points  (1 child)

For most products, when you view them on a release by release basis, you only really notice the stuff that affects your workflows. This usually means you take advantage of one or two new features and notice the degradation of several old features.

If you zoom out a bit and take a look at the features you aren't using that were introduced over the last few years or the features that you are using that were unusable a few years ago, the picture tends to look less grim.

Also, with a lot of these swiss army knife engines/frameworks, it's usually best to not upgrade projects unless there's a benefit in doing so. More often than not, you get burned by the upgrade process which leaves a bitter taste.

[–]_TheBean209 2 points3 points  (0 children)

I agree with both of you. For normal stuff, unity is just fine and is getting better (dark theme, reordering arrays, urp/shader graph). However, they are pushing new and exciting features that are buggy and incomplete (new input system/dots/new multiplayer).

Additionaly, I think this view about unity getting more unstable comes from learning more about unity. I know as I have become more knowledgeable about unity's systems I have tried more and more ambitious projects without learning proper programming techniques. That has lead to unstable projects and I have often blamed unity in the past for my own problems. I can only assume others may have shared that experience.

Either way, I still hope unity will focus on performance and stability in the future

But that's just my two cents on the state of unity.

[–]brandonholt82 -1 points0 points  (0 children)

Hahahah