So, I actually was supossed to start blogging on the first day of gsoc, but I was in the middle of exams and when doing exams adding your blog to kde planet’s blogfeed seems a task akin to reinstalling your computer.
Anyway, I am here now, let’s talk my GSoC.
Basically, it’s a brush that allows you to draw so-called ‘normal maps’, which are colourful looking maps that are actually encoding 3d vectors in the r, g and b channels of an rgb image. These 3d vectors are then used by a 3d program to pretend there’s little variations in the surface.
Thing is, because it’s encoded into the rgb values we can edit it in a image editing program like Krita. And advanced tablets have tilt-sensors, which means you can make a stylus tilt resemble a normal vector, and thus output the right colours. Hence, the tangent normal brush engine.
So how far am I? Feature wise, almost done.
Above you can see the normal map that is drawn with the tangent normal brush. You can tell it to use your tilt, rotation, or even drawing angle to determine the direction the output vector is in. Then, you can choose the type of encoding that is used for the normal map. This means whether you put the Y value of the vector in the green channel or red channel, whether it’s positive or negative, etc, and you can modify the strength of the stylus elevation on the resulting values, so you can choose to more easily have the neutral vector value.
I made a tilt cursor which can give feedback on stylus tilt, because that’s rather hard to determine for the user when they use a tablet, and wanted to make a color cursor, but this latter was recommended by boud to be put on hold indefinitely, because the code involved is rather complex.
Finally, I made the phong bumpmap filter that already existed, accept normalmaps. This filter then can convert the normal map to lighting information the way a 3d program would. Such as the image on the lower-left. This can be done via a filter layer or mask in Krita, so that the user can paint the normal map and get real-time lighting feedback.
The image on the lower-right is said layer set to overlay over the original texture, allowing me to match the shading. Then, the final image on the upper-right is the two textures on a plane in blender, assigned as diffuse for the regular texture, and ‘tangent’ normal for the normal map.
There’s still plenty of niggles left to be done:
- Krita’s canvas navigation includes rotation and mirroring, which messes up my vectors. I have this half-solved, but I would like it to work with multibrush if possible.
- The tangent normal brush itself needs some cleanup.
- I need to add more features to the tangent normal brush engine, like flow, sharpness etc. This shouldn’t be complex.
- Tilt cursor could be more visible.
- I still need to look at the colour cursor.
- I wanted to have an encoding preview in the brush settings.
The reason I am this far already is due to me starting once I heard I was accepted, partially because this period is exam and resit week, and I wanted to have a buffer if this period turned out to be too time-consuming for me.
If I properly finish this project, I’ll be working on bugs, colour management and the painting assistants of Krita, which were subjects I did before GSoC as well.
Old Google Plus Comments
|Scott Petrovic||very nice progress so far Wolthera! You never cease to impress me.|
|Ryan Leach||I’d love to see this being edited live on a VR headset.|
|Wolthera||Normal maps aren’t really 3d themselves though, so it would be just as boring 🙂|
|Bartosz Styperek|| |
Could you add feature to convert normal map to cavity map? Here in example in PS http://www.bs3d.com/index.php?page=7 .
It is great in overlay mode on diffuse texture.
Also I supose people may want to overlay details on normal map. Here it is explained http://gamebanana.com/tuts/10595 how to do it in ok way. No perfect but ok. Maybe you could add something like overlayNormal blending mode?
And last thing – when people overlay normals (with overlay blending mode) on top of each other result is not normalized. So my final request would be addition on ‘normalize normals’ function.
|Wolthera||I have no clue how to do the first part at all, so it’s not going to happen and the second part is done in the master branch, it’s called tangent normal.|