Problem I've had with Pencil2D internal player

When using Pencil2D and building an animation the animator is directly working with the Editor. But when you need to look at the animation, we play the animation. The diagram below shows the data flows within and the input from external files and output to external files.

The existence of the external files is obvious, but the existence of the of the Player File is not. Users imagine that when the press the play button above the Timeline that the player simply displays the .pclx file on screen.

But using the .pclx file would be too complex and Pencil2D would struggle to display it fast enough. The Player File is the layers with the .pclx file compressed onto a single bitmapped layer. If there are Vector layers then these are converted to bitmapped format before being included.

Furthermore Pencil2D does not provide the user with any indication that the process of producing an internal version of the animation exists or when it is happening. The result can be confusion, because the user doesnā€™t see what they expect, when the play button is pressed.

If the animator makes a change, which may move an element in the animation a significant distance in a number of frames. They then press the Play button. The initial frames may reflect the change and the later ones may not. An experienced animator will probably realise that theyā€™ve prematurely press the Play button and will then wait a suitable time and then press Play again. The less experience animator, may at this point panic. I my opinion it would be better to use an external player. There are many advantages to this, these include the playing of sound, which is properly synchronised with the drawings. The built in player, there is a delay between triggering the sound being played and when the sound is heard.

Some animators reduce this latency, by splitting the sound files into a larger number of much smaller one. But some then tell us that the limit of 64 sound files within a project needs to be increased.

If the user has a powerful computer, then the sound latency and problems specified below will not be a serious problem, but for users of less powerful systems, the problems will be more severe.

Selection_Pencil2D

These problems include frames where editing is being done, the select lines will appear when the animation is played using the internal Pencil2D player. Further more if the animation is exported as a .Mp4 or Animated GIF file these lines will also be there. But if a second copy of Pencil2D is loaded, memory allowing and the .pclx or .pcl files from the animation are imported into the second copy of Pencil2D these glitches will not occur. This to me indicates the information which causes these problems are encoded in the temporary files.

Pencil2D_Timeline-2

Pencil2D_Timeline-1

The third problem area is that Pencil2D allows animators to edit frames within a layer which are not define. In the top images all the frames are define on the Bitmap layer and in the lower, we are working in twoā€™s i.e. only every other frame is defined. The defined frames is marked on the timeline with a rectangle.

There is some confusion amongst Pencil2D animators, in that they refer to the defined frames as Keyframes. Keyframes are sometimes called Extremes. These are frames where the motion reaches and extreme of motion and then reverses, say a bouncing ball reaches the top of itā€™s bounce. All of the frames between this top of bounce and the point where the ball hits a hard surface are called Inbetweens, sometimes shortened to Tweens.

  1. If you edit these undefined frames, then Pencil2D wonā€™t give you an error message, and when played using the internal player they play as if valid, or if you Scrub the Timeline with your pointer youā€™ll get what you expect to see.

  2. However if you save the projects as either a .plc or .pclx file and then leave Pencil2D, when you reload Pencil2D and then reload your saved file, the resulting animation will not be as seen before saving and exiting Pencil2D.

This is because in case 1 what you see is controlled by the internal files and in case 2 by what is saved in the .pcl or .pclx files.

A similar problem also occurs when the animator is using the Camera move to move a drawn image across the screen, if you want to adjust an intermediate frame, then you need to define an intermediate frame in a reliable manor. Then add an extra frame on the Camera layer and adjust the position on this.

If you want to see this motion using the internal player, my advice is add an additional layer, say called Dummy and add a frame in every position of the move. Without this hack, youā€™ll sometime play a sequence where you expect a smooth motion and instead get a jump from start to finish. If you export the animation as an Animated .GIF or .Mp4 the motion will be smooth. As an animator with plenty of experience of using Pencil2D, the above problems donā€™t cause me problems. This is because Iā€™m aware of them and know how to overcome the problems they might cause a less experienced animator.

To me it is obvious that the problems exist in the information stored in the temporary files with Pencil2D. The images shown using the internal player appear to be screen grabs, as to the images incorporated into the .Mp4 files.

Just a thought, many early animation packages which ran on PC computers produced the video files using the control file and the other stored files. In the case of Pencil2D these would be Main.XML and the frame files in .Png or .Vec files. This would probably take a little longer, but the resulting animation would produce better results.

These are my thoughts and I realise that they are not a quick fix. I am in no way making a criticism of the Pencil2D group. The work around is to save the work as a .plc or .pclx file and then reload and then output as a final animation as a .Mp4 file.

Hi. I see youā€™ve taken plenty of time to write a very interesting commentary on these issues and how Pencil2D could be better. Thank you for that.

I have not been able to read entirely (I will later tomorrow hopefully), so for now Iā€™ve only helped by removing the automatic timer to avoid this thread being locked by the system.

Personally, I think this is a discussion that needs to be had, since I myself have asked for a player-like feature for years to finally get rid of the plethora of user experience issues when delivering playback to a user.

That said while Iā€™m understanding of technical terms, Iā€™m not a programmer so I canā€™t answer you specifics, however I do think the PCL file and itā€™s layout of data resources is key regardless of whether raster or vector images are used as input for a potential player feature.

Most commercial software Iā€™ve used have had a similar document structure to Pencil2D (XML Document + custom vector / raster image files). Iā€™m specifically talking about apps like Adobe Animate, Toonboom Harmony, LostMarbleā€™s Moho or even the freely distirbuted OpenToonz (Toonz being the commercial product from Italy)

Those apps also leverage vectors more efficiently to minimize the shortcomings of their architecture so they arenā€™t as apparent to users, but they always preload / prerender / cache, low res ā€œscreengrabsā€ (screen buffer dumps) or optimized data into a video format (swf for Animate) to create the animation preview in a dedicated internal player or window.

In the case of Pencil2D I would hope we could use, as you hinted, the actual raw files from the file as input for that as long as we transcode them to a compressed or smaller proxy version of themselves.

Letā€™s hope the devs can find some time to review this and reply in due time since, even though theyā€™ve kept improving a few things over the past months, I know they have very little time to work on the project as they would like, myself included.

1 Like

Further Exploration of the Inside of Pencil2D

My experience using Pencil2D consist of using it on a powerful desktop PC and a small micro laptop measuring 280 mm x 190 mm x 17 mm. This laptop uses a low power processor and an internal SSD drive to obtain a usable battery life.

For ease of editing the pictures and the sounds we locate them on separate layers. In order to output them we need to combine the images onto a single layer. This process is traditionally called Rendering. At present this process is carried out in the background during the editing process.

In my opinion this would best be separated out into a process on itā€™s own. The code for this exists and is used when a .plc or pclx file is loaded into Pencil2D at the start the editing process when working on an existing Pencil2D file.

If the Rendering process was started by the user, say pressing R or clicking on a menu item, the rendering would be separated from the editing process. This would have the effect of making the commands to the editor much more responsive.

In an earlier communication, I discussed the problem of inconsistencies between, what is recorded in main.xml and the defined frames files in the data directory and what appears on screen and also in animated .GIF files .Mp4 files. In these instances I wasnā€™t sure if Iā€™d checked and removed any selection actions before exporting the animation to .GIF or .Mp4 files.

Problems with Filenames and Directories

Iā€™ve now discover that even if Iā€™m careful and I deselect the selection action, then the same problems do exist. Iā€™ve now noticed another problem, that if Iā€™ve been working on a project called ā€˜Sample.pclxā€™ or ā€˜Sample.plcā€™ and I then start a new project, then I need when saving the new project for the first time, I need to use the save as option, then I need to change the filename that appears in the filename box and check the directory name and change if I require to save it in a different directory. This can catch out new users, whereby they overwrite the previous project and may struggle to locate the new one.

Ive now discovered that the above problems are not caused by Pencil2D, but are caused by the underlying operating system in my case Windows 11.

A possible work around, when starting a new project, using Pencil2D, is to used the New option in the File menu, initially this will save a blank project. Then carefully choose a location for the project, I would suggest that you setup a dedicated directory.

Background of animation Terminology

We are going to examine a project, the timeline below shows a project, where every frame is not defined. The frames indicated are drawn frames, where a frame is not defined the picture is the same as the defined that is the defined frame before it. Therefore Frame 2 is the same as frame 1 and frame 15 and the frames 7 to 15.

image

During the rendering process a copy of the previous defined frame is rendered in the previous undefined frames. The start of this sequence, the animation is being animated on 2ā€™s. There is then a still of 8 frames duration. Then 3 frames , where every frame is a defined frame followed by 3 frames without change and then a pair of the same image held in subsequent frames. This process follows animation conventions going back to the start of animated films.

When say the image stored in frame 1 is edited, then frame 2 requires to be updated. Currently as I understand after every change is made, the other frame in this case is updated. This process takes a very significant amount of processing capacity. If the updating of the undefined frames is only carried out when required the processing load will be greatly reduced.

The Problem Areas

My suggestions is that the code which carries out the rendering following the loading of the .plc or .pclx should be triggered by the animator, by say issuing a R command or a suitable menu option the render process will be carried out once only. This will have the effect of making the editing command much more responsive, Also Iā€™ve had experience of these situations, where the Rendering is carried out as a background process, leading to causing Pencil2D to crash.

This is particularly a problem where multiple moves, rescaling or rotations are being carried out to get the desired smooth transitions from 1 drawn frame to the next.

The diagram below assumes that rendering is an external process and is not part of the editing process, and is triggered using a command and does not happen in the background when editing.

There is a proven render process, which is used when aā€¦ .pclx or .plc is loaded into Pencil2d. This generates the images for each frame, by loading the defined frames into their correct positions using the instructions from the ā€˜main.xmlā€™ file. All the other setup conditions are defined by this file to.

When the internal player is started, Iā€™ve assumed that the .Mp4 file generated by the render process is loaded. Thus any sounds will be properly synchronised with the drawings. Thereā€™s no problem with holding a second copy of this file to facilitate near instant playback.

Lets now examine a project

During this process of examining the practical operation of Pencil2D, I am using my micro laptop computer, because this is a low power computer. Many people donā€™t have powerful computers and this mimics their experience. The lags in the rendering process are not experienced when using a more powerful computer.

This project is called Walker-1 and consists of 3 layers, these are, from the bottom up are Camera, Background and Pepper. The

drawings were drawn on 1ā€™s and Pepper is walking on the spot for ease of checking the drawings flow.

Walker

This format minimizes the amount of work being done by the background render process. But I did notice a significant hitch, when I made an adjustment to the background. At this point Pencil2D had to reconstruct the internal player file. I moved the selection to frame 5, there was a delay, the time it took to render the 4 previous frames and frame 5.

This project is Walker-2 and I have taken the GIF file from the previous project and made her walk across the screen right to left. At the end of the animation sequence Pepper stands staring into the distance for a while. The walk sequence is animated on 3ā€™s, to prevent her sliding forward when her front foot lands on the ground.

Walker-2

This means that the amount of work being done by the background rendering process is much larger than in the previous example. This is especially evident when the animator is examining the final frame in the sequence.

I then moved the background image and examined the final frame, the delay in displaying it correctly was more significant than in the first example.

Walker-5

This last animation Walker-3 is significantly more complex and thus the delays when I modified the background was significantly longer. This animation has 6 layers, the front arm and leg and the back arm and leg are on separate layers. You could on this example visibly see the background changes rippling through the frames in Editor mode.

Loading an Animated GIF or many PNG files into a layer

The same sort of effect can be seen when loading frames from an Animated GIF file into a layer or a large number of PNG files, the same type of lags occur. In this situation it is more obvious what is happening because the animator is in control of the timing and there is on screen prompts.

Loading a Layer or Layers into a project

This also causes a significant render burden. On at least 1 occasion, me not allowing enough time for the rendering, caused my computer to crash.

My thoughts on the way forward for Pencil2D

The basic problem with the way that the Render process is currently done within Pencil2D is that it is currently a hidden process which runs in the background whilst the animator is editing their animation projects.

This can under certain circumstances, when the Render is not under the control of the animator, it can catch them on the unawares. For an animator like myself, where I am aware of these processes are happening, when the editor ā€˜Freezesā€™ I know the computer is Rendering. But a less experienced animator, might panic!

But if the Render is done when the animator starts it, they know it is going to happen. If it is done using the routines which are used when the animator loads a new project and then the play file is generated by using the Export to GIF or Export to Mp4 file. Then these display on screen messages informing the user of the progress. This approach would also solve the problem of sound synchronisation.

Animations would no longer have unwanted artefacts, which are currently left over from the edit process.

I personally do not use the automatic save facility, because I want to control when saves occur. I also change the filename when I have made significant changes. I do this by adding a ā€“ and a number. This means that if the worse happens, I have not lost everything.

image

One of the ways in which this could be integrated into Pencil2D is this process could be triggered when the animator presses the on screen play button.

When I load in a layer or Layers I always answer the question load in at address 0,0, then I change to the camera layer.

I then save the the file as a .pclx file. If the previous file was pepper-4.pclx I save the new file as pepper-5.pclx.

The render problem has caused me problems if Iā€™ve attempted to edit the file, which I have just loaded the layer or Layers into.

This usually results in a crash!

Pencil2D does not provide any indication of if it is currently rendering.

I then open another Pencil2D window to load the new file into and check itā€™s integrity.

I then close the old file, in thus case pepper-4.pclx and continue my editing on the new file pepper-5.pxlx.

Is there a way that automatic rendering can be disabled?

Perhaps there could be an option in the setup page to disable automatic rendering.