keskiviikko 6. huhtikuuta 2011

PUBLISHED: Howto utilize OpenGL ES 2.0 on Symbian^3 and Maemo

A link to the document just published. I hope you find it helpful:
http://wiki.forum.nokia.com/index.php/How_to_utilise_OpenGL_ES_2.0_on_Symbian%5E3_and_Maemo

A good starting point for developers who wan't to write for example games for Nokia's devices.

tiistai 1. maaliskuuta 2011

Qoat of the Hill


For some time now i've been working with mobile devices and Qt. Qt is a great library, but as a game developer I've found it difficult that it lacks a "true" OpenGL ES 2.0 support: Current versions offer only an encapsulated version "QtOpenGL" of it. QtOpenGL is used via "QGLWidget" which is a Qt's UI-component enabling OpenGL graphics inside it.
The encapsulation and modified syntax wouldn't be a problem if you could be sure you are always working only with Qt, but nowadays it's important to maintain as much portability as possible. Also, when software needs to be ported from other platforms to Symbian^3 (or other systems supported by Qt), this can be a very difficult issue.
We've been developing a "replacement" version of QGLWidget which would work as much like real QWidget as  pobssible, but directly with underlying native GLES2. This way the developer could use native GLES2 just like in most other platforms and still take advantage of Qt's great functionality.
We hope our work would help the developers exactly with the issues above and make devices supported by Qt more attractive especially to game developers.
In this shot you can see a game I've been developing within our replacement widget (GE::GameWindow). I've tried to keep it as simple as possible and still use lots different techniques.
Some details:
- Heavily simplified "Scorched earth"/Worms clone where you try to push your opponent down from randomly generated hill by shooting him.
- Everything is rendered with OpenGL ES 2.0
- Windows support (for easy debugging and fast development) is available with PowerVR's GLES2 emulation libraries.
- Landscape texture is generated from a set of base textures with shaders at run-time. (you can see it modifying when ammunitions "burn" it enough).
- Multilayer sky/ground system.
- Several background layers for creating more complex feeling for the scene.
- Particlesystem with fixed-points and nicely customizable type system. Each type can have its own program for rendering.
 You can check our project (including sources) at:
http://projects.forum.nokia.com/qoatofthehill

Some screenshots:





tiistai 18. tammikuuta 2011

Older stuff: Img2Img hider


I guess i should store some of my older stuff as well. Here is the "img2img" hider. The purpose of this software is to "hide" a smaller image into another. It takes two images as input, the "background" and a image to be blitted (Let's just call it "blit"-image). It tests the blit with all of the possible positions and angles through the background image and keeps record of the attributes with minimum error. These attributes will be outputted to the blitting phase. 

The blitting considers a large variety of attributes from the error-detector, source and target images. it tries to blend these two image (areas) morphing the background as much towards the blit-image as possible within the error-limits specified for it.

Easier to explain with a video, the "img2img"-hider in action:


Since i wrote a completely automated version which tries all of the possible combinations of several hundreds of different images there are LOTS of screenshots available. You can check tens of pictures in my Flickr account (http://www.flickr.com/photos/tuomoti/). 

Couple of examples. These are cropped from huge originals. NO other "by hand"-manipulation has been made:









sunnuntai 16. tammikuuta 2011

Custom CMYK-halftone printing

For a long time I've watched the images/prints in newspapers and commercials thinking how it is actually printed, with just a four colors overlapping. Forming beautiful little patterns. Some time ago I started to read about the techniques used and got more and more interested about it. There are "newsprint"-filters in almost every image-manipulation software (including GIMP), but they are not very good; I guess they are aimed for people who actually design data for real CMYK-printing, not for people who just want to create nice looking effects still using the full color space (and -scale) like me.

I decided to implement the effect with different design-considerations, aiming it to be able to look smooth without VERY high resolutions.  The program to be created should be able to "print" any image with as "real" halftone CMYK as possible, including "pressure", "ink-bleeding" and other physical elements affecting when the image is done the actual (physical) printing. 

Software is made with Qt and tested on Windows 7 and Linux. The graphics processing is completely custom and does not deploy Qt on any other part than providing loaders/savers for the images.






Couple of test videos:


(Edit: Another video with newer version uploaded):


A closer shot displaying the result software creates:




Processing of an image goes like this:
  • Calculate a gray scale mask with selected type (dot, lines with different powers, square).
  • Calculate the orientation matrices for each color-component with selected angels and size.
  • Use attribute “sizediv” to downscale the image with as high quality as possible
  • If enabled, convert the downscaled image into CMYK-color space. 
  • Create a target image with same dimensions with the source image
  • Loop though each pixel of the target image
  • Resample a color from downscaled CMYK(or RGBA) image.
  • Apply contrast (“overcut”)
  • Transform the  current coordinate with pre-calculated matrices for each color component and get mask values from these positions.
  • Apply noise to the mask values with selected noise-power and size.
  • Calculate a delta vector from (sampled_color_from_downscaled_source – mask_values_for_each_component)
  • Use attribute “pressure” as contrast for the deltavector.
  • Targetcolor = 128 + final deltavector.


Here it can be seen how the image changes when parameters are adjusted. rastersize, downscale, noise's different attributes, overcut (kind of a contrast) etc.

'







Of cource it can use different masks than "Dot" as well. The results will look quite different:



Lets see how it can be improved. Interesting times.