New Perspective Tool for Krita

I have been meaning to right about this fabulous new tool that is the brain child of none other than David Revoy (the mockup of the same can be seen @ New Perspective Tool). Well, like many of you out there I am also mesmerized by this new tool, but, upon me is the task of making this tool and make it a part of the already amazing Krita.

This blog will just take you through what all I plan on doing and the hopeful timeline(although I haven’t been good at following them, I am already a year late at creating this tool!).

The Idea!

Well, I can go on about with the idea and the concept of this new tool, but then I am too lazy to go on about describing something that David has already done so beautifully in the blog described above. Although for those lazier than or equal to me here is the gist of the tool.

The tool:

http://www.davidrevoy.com/data/images/blog/2013/02/krita-perspective/2013-02-03_krita-perspective_design_02.jpg

The tool showing all the three vanishing points, the horizon(line joining the red and green points)

As it can be seen in the image above the tool looks very much like the Perspective Assistant with the difference that instead of the standard 2-D grid this tool will have a 3-D (although it would seem 2-D only because of the image) grid, which will be manipulated by the three vanishing points, Red, Blue and Green dots. And three different coloured grid lines converging to the corresponding vanishing point. The Green and Red vanishing points are connected by a line called the horizon line(Forgive me for my mistakes on these technicalities, I am not very sure of the terms myself).

The grid adapts with the change in the position of the vanishing points and also with the removal of the individual points. This is shown in the following images

http://www.davidrevoy.com/data/images/blog/2013/02/krita-perspective/2013-02-03_krita-perspective_design_03.jpg

The Grid Adapts to the removal of one of the Vanishing points(Blue) getting removed by making the grid behave as if the blue point is in infinity

http://www.davidrevoy.com/data/images/blog/2013/02/krita-perspective/2013-02-03_krita-perspective_design_08.jpg

Single Vanishing point(A special case)

Well I would like to explain the above image that is the special case. By design the Red vanishing point cannot be deleted and as soon as the Green point is deleted the Grey dot comes in place but such that it is stuck on the edge of the grid. This Grey point helps the user to just tilt the horizon line.

All in all this tool will be able to help the user to be able to get the perspective without the need to do it all manually. For more understanding and details visit David’s blog,

The Plan

Please wait a minute, let me go through my drafts to fetch the mail I had saved for reference! Oh, there it is. Well, without further ado here is the proposed plan that I have thought of.

  1. Basic setup(3 axes and their movement)
  2. removing of the points and their effects
  3. colour schemes of the points
  4. grid density + line width (if possible earlier too)
  5. single vanishing point
  6. grid able to guide the freehand tool
  7. 'Bake' button

Well, you can say that the timeline is just a modularisation of David’s blog, but, then as I said the blog is brilliantly written. So, that is what the plan is! Let’s hope it can be achieved in good time and there will be a new tool among many added to Krita. Although, as it can be seen there isn’t any specific timeline, but just steps to go through the whole process.

Current State:

Well, here is where I talk more on the technical side(but I’ll try to keep it as simple as possible, don’t want to bore you guys). David’s mock up shows that we can create more than one world limits, each of which is isolated from the other. Well, in Krita we have a similar tool called the Painting Assistant, which luckily has the Perspective assistant tool, which is a quadrilateral Painting Assistant.

This being my first time creating a new tool, my first step was to make a copy of the perspective tool, change the filenames as per need and modify it to first build without any glitches. Next, would be to modify the files to make it function enough to be able to create at least one Perspective Grid.

Although at the time of writing this blog, I have been able to accomplish only the first part, i.e. copying the files and modifying them such that they can be build. I am hoping to be able to complete the next step in the next few days, and the details of the hack will be put up in the next blog. Until then, keep Sketching!

PS:  Any comments on the idea/coding is appreciated. Also if anyone has a prior experience and would like to help, you are most welcome!


Grid + Assistant = Awesome Perspective Assistant

Been quiet some time since my last blog about Krita, well, I had been a bit busy with college work. Nonetheless, with whatever time I had, and all the help from Boud, I have been able to import a particular feature from the Perspective Grid to the Perspective Assistant.

A little background

Perspective Grid

The Perspective Grid(here on referred to as Grid, sounds very formal :-P) is a grid for which all “parallel” lines intersect on a vanishing point. This helps the artist to create 3D effect on a 2D canvas, for example buildings or roads going upto the horizon.

Images are taken from Cyrille Berger’s blog about Perspective Grid

Perspective Grid in Krita

The grid acts as a guide for the artist to draw parallel lines on the canvas, using line tool or similar straight line tool.

Demo of the Perspective Grid

Demo of the Perspective Grid

 

Perspective Assistant

The Perspective Assistant(here on referred to as Assistant, still feels the same :-) ) is similar in looks to the Grid but unlike the Grid, with Assistant an artist can draw straight lines using the freehand tool too. This is achieved by checking the assistant checkbox after selecting the freehand tool.

A structure made using the assistants

A structure made using the assistants

On checking the “assistant” checkbox, the user can just draw on the grid and the assistant will itself draw the straight line with respect to the grid created.

I understood the working of both the Grid and the Assistant, but, what is the feature that is being talked about?

Well, that is easy to describe, the second figure above shows the side handles, in the middle of each side of the grid, these side handles can be dragged in the same way as the side handles to create new grids which extend the existing grid.

Why add a feature that already exists on one tool to another?

That is something one might ask, when he/she sees the grid and the assistant for the first time. But, on using them, one comes to know few points of important differences.

First of all, the Grids cannot be moved. Once created a Grid stays where it is till it is deleted. Secondly, new Grids cannot be created by themselves. A new grid can only be extended from an existing grid and stays that way till the end. Third and the last one that comes to my mind is that the handles in a Grid are fixed in reference, i.e. the handle which is on the top left corner can never be taken to a different location.

But in the Assistant all of this can be done, an Assistant can be moved, new assistants can be created out of the blue, the handles can change their locations, creating new shape of the grid with that change.

I am not saying that the Grid is a drawback. It was created with a different purpose and been here since a long time. But, the Assistant is just the upgrade on the base idea of the Grid.

What now?

What else? The Assistant now has these side handles and works really fine :D.

Perspective assistant showing the side handles at work

Perspective assistant showing the side handles at work

Although, now that I think of I should include technical details! I guess I will, but not now. Soon? definitely.

To all the artists, please use the new feature and give us your feedbacks wherever you want. My IRC nick is sraman on #krita, email id is sra392@gmail.com or even  here. Awaiting eagerly :-).


Saving and Loading of Assistants

My first work in Krita was to add the feature of saving and loading of the Assistant tools. Krita has four Assistant tools – Ellipse, Spline, Perspective and Ruler. As their name suggest each Assistant is used to make an Assistant having shape of an ellipse, curve, quadrilateral grid and a line respectively. The purpose of these Assistants is to make a complex 3D mesh which can be painted on. Now, suppose someone has created a very complex structure of these assistants, but, has to shutdown his/her computer, (s)he would loose all the created assistants as there was no implementation of saving the Assistants. Here, is where my work came in.

THE NEED

A structure made using the assistants

As it can be seen in the above image, the structure is a half completed scene illustrating the use of the assistants in showing of depth in a 2D canvas. And this structure is also very time consuming and also something that can be reused. Thus, the saving of one’s work at such a stage is very vital requiring for the need to implement the saving of the same.

THE WORK

Even if all the assistants have a very different structure compared to each other, they all have common attributes. All the assistants have handles(the circles on each assistant in the image above)which give the individual assistants their shape and have only x-coordinates and y-coordinates as their attributes and type, which tells the program which type of assistant is being created.

Saving

Saving of assistants their important attributes had to be saved. Each assistant has the Type and Handles as its attribute. So, in order to save the assistants these attributes had to be saved. “How to save the assistants so that it is easy to load them back?” One big question which made me change my implementation of saving around three times. Well, now the assistants are saved in the following manner:

File structure

Following are the modifications which are done in the end of file/folder structure for saving of the assistants.

  1.  There is a list of assistants in the maindoc.xml  file which tells the program the type of the assistants and the filenames  in which the assistants are saved. The list has a n xml style formatting.
  2. Whenever there is at least an assistant to be saved, the program creates a new folder called “assistants” inside the folder having the name same as the name of the created document. Inside this folder are the files with the filenames as given in the list in maindoc.xml. These files individually contain the information of an assistant of the type as described in the list. The name of these files are of the form ‘typecount.assistant’ where count is between 0 and n-1(n = total number of that type of assistant), for e.g. ellipse0.assistant, ellipse1.assistant, perspective0.assistant, etc.
  3. Now, these files store data of an assistant each. These files also have xml format. they store the type and handles, where each handle then stores attributes like handle id(for using in shared pointer), x-coordinate and y-coordinate.

Process

Now, the whole process of saving of the assistants is done in a systematic manner.

First, the list of assistants is stored in the maindoc.xml and then the assistants are saved in their respecitve files.

Loading

Because of the way assistants are saved, the loading part was rather simpler to implement.

First, the list of assistants is fetched from the maindoc.xml and stored in a QMap of filename -> type.

Second, The blank assistants are created on basis of the type using the Factory and once created the assistant is given its handles and inserted into a Qlist.

Finally, the Assistants are added to the Manager which is at last set to visible, making it possible to see the saved assistants.

Well, that is how the current implementation of the saving and loading of assistants is done and I have a request the wonderful artists who use Krita to use the assistants and help in making them better by the day.

CHEERS!


The start with Krita

Krita is a painting and sketching program by KDE. It is a part of the Calligra Suite, and offers an end–to–end solution for creating digital painting files from scratch by masters. 

Well my journey with Krita began when I first heard about it from my friends, who had done SoK last year. And, I was mesmerized by the sketches of david revoy. It was then that I wanted to contribute to Krita and help in its being a great digital painting tool, although it still is great!! :)

Google Summer of Code and Krita


This year for GSoC, I had selected a project in Krita from the KDE ideas pagePerspective Drawing.  Following are a few details of the same:

Brief description:

Krita is a 2D painting tool, but artists often need to give the illusion of depth. Krita has two tools to help the user draw perspective correctly: the perspective grid and the perspective assistant. The latter is more advanced, but needs improvements to become a real star feature. It needs to be expanded by allowing real 3D objects to be important and put into perspective. This means rotation, setting the vanishing point, scaling, and then integration with the paint tools. At the same time, to get into the codebase, the student should implement other missing features in the perspective assistant.[1]

Details of the work:

In this project the perspective assistant has to get all the functionality in the perspective grid. That is just a part of the project, the majority of the time is to be devoted to creating an import function, such that a blender mesh can be imported. Now, this mesh should also be modifiable, that is, it can be rotated, scaled etc and then the mesh can be used in a similar way as the perspective assistant. The proper details of the timeline of the work have been provided in my proposal.


Follow

Get every new post delivered to your Inbox.

Join 921 other followers

%d bloggers like this: