My participation at Krita October Sprint


A few weeks ago I travelled to the Netherlands to be part of the Krita October Sprint. During this Sprint we decided to focus on bug fixing, my tasks included some simple bugs and a couple of more convoluted bugs. I started fixing the simple ones in order to gain speed: one about modifiers not working on OSX, the bug was simple enough but puzzling as the missing logic shouldn’t make the code work on Linux, but it did. The second bug was related to events logic in the preferences dialog command: My first approach was good but not simple, so talking with the team made me change the solution to something much more simple.

Hard working Krita Sprinters

The next days showed me how deep the rabbit hole goes in Krita’s code, my bug was in the invert color code, some color spaces didn’t show the correct/expected result. A quick dive showed that there was a different codebase for every colorspace invert operation, and the wrong results showed for the missing implementations. However this made the solution not very portable as the combination of colorspaces and color depths suggested I needed to implement 18 color inverters. A short consultation showed me that there was a space invert operation already implemented for the pixel depth, so refactoring to use this convertors in one class to invert the input colors made the invert filter work as expected, except for CMYK and Lab spaces in 16bit float spaces. After a couple of days of digging into the code and testing, we found that there is a a bug in the way CMYK and Lab is values are processed as normalized values are not returned in places they should be.

As my first Krita Sprint I was very nervous, however I was even more exited to meet the team. In a way it was also the first time to work in a code only environment which made it very fruitful as it showed me that code is not made by super coding super geniuses, but by a little changes made by a coordinated team of normal people.

Advertisements

Optimizing Circular Soft Mask, Krita:GSoC

A new vectorized code  implemented using Vc library to allow SIMD operations for the generation of the Circular Soft Mask. Implementation was straightforward using internal methods declared in Vc however the gains were not as dramatic as with Gaussian Masks because one of the biggest bottlenecks is fetching from memory the predefined values rendered from the curve set by the user.

Making a plan

Phabricator task: Implement Circular Soft Mask Optim AVX
The code templates work the same as the Circular Gaussian Mask generator implementation, which I explained in my [previous post](blog, URL). Taking that into account the plan consisted in three simple steps.

  1. Understand how the scalar vector is generating the values for the Mask
  2. Port all operations to the vectorized model
  3. Test and profile the implementation.
    Read More »
featured image for gauss optim

Optimizing Circular Gaussian Mask, Krita:GSoC


Previous implementation was based on a slow scalar model, calculating each mask value per coordinate. I implement a new vectorized code using Vc library to allow a robust SIMD usage, calculating the mask values in parallel. Not all operations are implemented on Vc data types, especially erf had to be implemented for Vc data types. The new implementation shows to be up to 10 times faster (on my system) on mask generation. Given that the mask generation requires the most computing on brush stroke generation, this speed improvement holds up even in the full brush stroke benchmarks. Given the way it is implemented the code can become faster as future SIMD registers grows on future CPUs.

Circular Gauss Optimization results.

Code study and implementation of Gauss Mask Mask generator.

Phabricator task: Implement Circular Gauss Mask Optim AVX
Vc creates code from templates tailored for each processor instruction set: AVX, AVX2, SSSE2, SSSE3, SSE2, and scalar. so first a template must be declared to manage the creation of each instructions set code. Using the vectorized Default Mask implementation as a guideline, studying how the code generates is constructed to provide the functionality allowed to extend it for the other MaskGenerators
Read More »

Painting with index colors filter

Krita

Working with index color filter, described here https://krita.org/item/236-last-week-in-krita-week-21, can be confusing. The filter works so slow (in my pc) that getting results just by moving sliders is a waste of time. Some things are good with the tool and some others are hideous. I wanted to work with index colors to get the messy pixely effect and also using live filters to edit anything later (if it’s needed). here are some notes on the tools to avoid future headaches.14_189fs_netAbove: my result. Used the same layer setup as in the video here https://www.youtube.com/watch?v=v1Z__mSfo8s (whoppix was very kind to share the file). To control a little better the output. I worked in gray scale all the way and used 4 main groups. Background, Clothes, Skin, Hair. The idea at first was to use a different colour on each section and a slightly different dithering effect on each.

Layer Stack description (As in source file)

Set a group for each dithered object you need. each group act as an isolation environment so its possible to get different colors and dithering patterns on different elements in canvas.

  • Top layer: Dithered filter
    – Ramps: Brigth 3 colors, Light, base and Dark 1 color each
    – Diagonal Grafients ON
    – Gradient steps: 3 / L 4 / B 5 / Shadow 5
    – Limit to:  Indexing factors ( move at will)
    -Alpha steps 1
  • Group Layer: Dither layers (Op: 16%)
    Grayscale texture dither patterns
  • Paint layer. This is the where the object is made.

On Dither patterns and textures

Layer must have opacity lower than 20 to add the effect without interfering with the painting itself. If it is too high the pattern will become the painting instead of just dithering the gradients. You can use any data as dithering patterns. I only tested grayscale layers and different types of layer content. From what I can observe:

  •  Sharp pixel shape patterns with different gray values work best
  • Its possible to use krita painting brush patterns to add dither, results are more or less nice. (Used on the background)
  • Add any image texture and tweak values to make nice dither. This came come from a photo or a painting. Krita grayscale patterns enter this category
  • Use a brush engine to generate Texture. this is trickier since you need to generate an organic pattern for it to look good. (Ramon miranda’s hairy brush set works extremely well for this.)

Brush engines tested and settings

Painting with Brush patterns Grayscale textures: Set Cut Off Policy to “Brush” and set arrows. black on middle, white closer to edge.
Painting with spray to generate dither:
Spray brush:
Size off
Shape dynamics, Random size?
Paint mode BuildUp, (Wash with Random Opacity in “Color options” doesn’t seem to work)
Spray area: Diameter, Scale, Particle count alter the way the dither is “rendered”
I ended up using Turning off: Spray Shape and setting the brush set tip to 1px, more or less.
Hatching brush: Ok This one works very well for creating gradient dithering. however the results are hard to control
Hair brush: Very Good, just lower opacity to control texture amount
I have: Opacity 94%, Ink depletion: ON (1024, opacity)
Sketch brush: Could work
Brush size: Offset scale above 80%, density low, Ucheck “use distance density”, Uncheck “Magnetify”

Speed problems?

Live filtering is very slow at the moment, to avoid the trouble of working at snail speeds get used to work in Grayscale (values only) and turn on index colors filtering for fine adjustments.

Controlling color output

14_190_net

This is a tricky business. I tried many different variations and I could obtain the same color combinations from different color mixtures in the dark, base, light, bright color swatches.
The colors provided by default work well as long as you don’t alter the value. In other words they will affect the gradient at the same bright tones as long as you don’t alter the value setting.
In the end I made the following process
  • Removing all swatches and leaving base will create a cut out shape with the color selected.
  • Add then a light tone for getting gradient variations. The colors are not exactly the ones you picked, but very close
  • You can use second and third rows, jumping wrows will make a strong gradient effect. however use with care as activating them might cause unwanted color shifting.
  • Color value is everything. Add a Bright tone with very dark value and you will affect the dark tones. Add light value to Dark column and highlight will get colored, despite being in the dark column. Not sure if this is a bug but, use this to your advantage to fine tune dark tones a little bit in the end.
  • Because of the former point, have some order, using values from light to dark, top to bottom.
  • Activate diagonal gradients to use any column and get mostly the same effect as if you were using only one column. I have to investigate this further as the option might imply some other things.

Adding screenshots showing color mixing variations.

 

Conclusions

The results from this technique are strongly dependant on your value mastering and for more aesthetically appealing picture you have to prepare a nice set of patters and use them with care. Failing to do so will result in a muddy picture with no volume and zero flow on forms. Very difficult indeed to get. My pictures ire nowhere near that level. Finally, while the results are satisfactory I still need to master the coloring mistery for selecting the exact colors I want. I could help to set a gradient inside the affected area to help selecting the color ramps. In the end I had to use level and color balance to get a brighter look on the first image.

Second image was better controlled in respect to color setting in the filter. I started working on it with the experimental brush to focus only on hard shapes. Abusing Krita layers ystem I worked as with the red marker and light yellow for the background, cloned the resulting group layers. Added those clones to the indexed layer and toyed with the index filtering colors.

Get the Source files

[es] Esta semana en krita — semanas 25 y 26

Estas semanas han sido emocionantes con la campaña de kickstarter acercándose más y más al objetivo. Al momento de escribir este artículo estamos pasando 13k. Y con la nueva oleada de usuarios, atraídos por la gran labor de colaboradores y entusiastas en la difusión de la misma, hemos estado muy ocupados trayendo nuevas versiones de prueba y desarrollando nuevas funcionalidades.

Antes de entrar de lleno a lo nuevo, no puedo dejar de mencionar a Ramón Miranda que, con el objetivo de difundir mejor las capacidades de Krita para aquellos que escuchan del software por primera vez, ha creado una serie de video tips: Introducciones cortas a diversas funciones avanzadas y fundamentales dentro del software. Aún para los iniciados es un buen recurso, al menos yo aprendí un par de cosas que no conocía. Todos los tips en el post de kickstarter Ramon youtube channel

Progreso semanas 25 y 26

Entre las cosas más destacarles podemos citar los importantes esfuerzos de Boud por crear un entorno de construcción que permita crear eventualmente una versión de prueba para los usuarios en OSX. Aún en fase experimental, el avance es bueno logrando compilar el programa, y hacer que funcione. Por supuesto esto está lejos de ser una versión para distribuir, pero si recordamos como empezó la versión de Windows, es una gran señal.

Somsubhra, desarrollador de la versión Krita Animation, ha añadido, entre muchos arreglos de fallos, un primer esbozo de un reproductor para las animaciones hechas. Se puede ver más en el video adjunto.

Read More »

Krita Fundraiser campaign!

Krita Fundraiser campaign! Hola. Fue en 2012 que comencé a usar Krita para pintar. En ese entonces usaba la versión 2.5 en Windows, aunque por momentos se cerraba, era la primera aplicación de pintura digital donde realmente me sentí cómodo. Tanto me gustó que hoy día es casi la única aplicación de pintura que uso. […]

Krita tip: Ease setup 1 point perspective assistant

Going trough a perspective course at Crimsom Daggers I decided not only to make the exercises but to get them to a certain level of presentation. (I keep the sepia like scheme as I find out I can work for larger periods of time with it).

Using Krita assistants tools not only allows for faster work but also cleaner and more organized look. For diagonals outside the grid I switched to the line tool.  I used a few layers to organize shapes and soften most construct lines and some masks to keep lines from overlapping.

net_1point2nd_blog

Setting up a grid

Setting a one point perspective grid is super easy with some planning. The following short video will show you the steps to achieve it.

The most important thing to remember:

  • Set an outer square area to align the cage outer sides
  • Draw an inner area to to align the inner cage points, this is important as it’s impossible for the perspective assistant corners to snap at a single point (The perspective assistant breaks).

The file

The zip file contains the KRA original file and a .krassistant file to load with the assistants docker. You can reuse the krassistants grid adjusting the corners to the size you need. Get the file!

Seeya!

Wish list: Krita assistants

Krita assistans tool is quite powerful for helping you in making technical drawings, they look so simple and yet with a bit of planning you can setup almost all of your perspective needs. Here below a video of me doing some work. Its in real time so you can see how and when I used the assistants.

Finished sketch
Finished sketch

I’m still not a power user of this tool, however after using it so much lately I have found a few annoyances and wishes for some features.

There are, at the time of this writing, four types of assistants which are.

  • Ellipse: Helps you create circles and ellipses
  • Spline: Allows to create a controlled curve
  • Perspective: Allows to create a perspective grid (This on is special since brushes can react to this perspective grid)
  • Ruler: Just like the Line tool, but here you can fine tune the line as you draw over it.

This short list allows to make complex setups, and while it takes a bit of time to make them just right, it allows for finer control over the lines you are going to get. I believe this approach is very powerful once a few shortcomings are resolved. Below I list the bugs I’m getting as well as a few wishes for making assistants a bit more complete.

Read More »

Sketch dump February 2014

Most of the february sketches are here. In march I need to do more:

  • “We need more men”
  • More stock variety
  • Composition++
  • Coloring practice
  • And a lot more Finished pieces.

Some of the below sketches are referenced and some others are not. It’s quite easy to spot them as most of the characters from stock used on the reference drawings are very repetitive.

The sketches:

Special thanks to all deviantart stock used which mostly are: tasastock, imperialstarletstock, ravenofthenight, 13-melissa-salvatore, mostlyguystock and skydancer-stock