Category Archives: Work in progress

The project of this web-site that are currently work in process, including also abandoned projects that were never completed.

TextureMind Framework – Progress #3 – Graphics context and external libraries

One of the most important component in a framework is a cross-platform loader of dynamic libraries. Without it, you cannot access to the functionality of external dynamic libraries like OpenGL, DirectX or Vulkan, or at least you may have to add extra code for every library on every platform you have to support. In some cases it's better to not statically link a dynamic library and use LoadLibrary() or dlopen() instead. With this component, I don't have to worry how the library is linked and what platform or operating system I'm about to support, the effort of loading and linking an external library is very little. After that, I decided to use this component to dynamically link DevIL and implement a full support of image conversions with this library. I implemented also a full set of classes to handle 2D shapes and 3D objects.

Immagine correlata

Another fundamental component for every 2D or 3D engine is the graphics context. In my framework, a graphics context is an abstraction layer of functionality exposed by the rendering context of a graphics library, like OpenGL or Direct3D. Once I defined a full set of draw commands for drawing 2D shapes and 3D objects, I made a first specialization of this interface using the Cairo library with path rendering for drawing 2D graphics only.

TextureMind Framework – Progress #2 – Improve serialization and math classes

Even this framework has been designed for generic purposes, it will be used to program basically graphics applications. In this perspective, I implemented a full set of serializable classes to handle complex numbers, vectors and matrices and all the geometric operations that will be used to realize a 3D engine.

To serialize some enum variables that want constants instead of numbers, I introduced "constant strings" (i.e. LEFT, GREATER, NULL) in human readable formats like xml or json. In this case, when the variable is deserialized by the framework, a constant string will be translated into his respective numberic value, on the contrary the numberic value will be translated into his constant string during the serialization process.

For instance, an extended vector 2D with anchor variables:

enum PositionAnchorEnum {
    TMD_POSITION_ANCHOR_LEFT = 0,
    TMD_POSITION_ANCHOR_RIGHT = 1,
    TMD_POSITION_ANCHOR_TOP = 2,
    TMD_POSITION_ANCHOR_BOTTOM = 3,
    TMD_POSITION_ANCHOR_NEAR = 4,
    TMD_POSITION_ANCHOR_FAR = 5
};

template <class T>
class ExtVector2 : public Vector2<T>
{
public:
[...]
    T m_x:
    T m_y;
    PositionAnchorEnum m_xAnchor;
    PositionAnchorEnum m_yAnchor;
};

[...]

ExtVector origin;
origin.m_x = 0;
origin.m_y = 0;
origin.m_xAnchor = TMD_POSITION_ANCHOR_LEFT;
origin.m_yAnchor = TMD_POSITION_ANCHOR_TOP;

is saved to:

<origin x="0" y="0" xAnchor="LEFT" yAnchor="TOP" />

 

One year without posts but still alive. Update and news

I just realized that I didn't post anything in this website for more than one year. Anyway, this is not actually the mirror of my activity so far. As always, I was very busy with my actual job but I found anyway some time to continue my private projects, in particular the TextureMind Framework. I really need to write some post here in the future for updating the situation. I perfected the serialization and the graphics context, making an implementation with the cairo library and the first example test.
Now the context is able to draw complex structure of primitive 2D shapes along materials and textures. I'm writing also an Engine that will be part of the framework and it will have great features. I implemented most of the architecture for 2D and 3D scenes, like textures, materials, shaders, assets, scripts, animations. I refactored my old material format for covering modern features, I got inspired by Unreal Engine 4, with some improvements.

Textures can be created starting from images, but also with fixed shaders and program shaders. A fixed shader texture depends on the context implementation and it's not programmable, but it should produce consistently the same output between different implementations, while a program shader texture can be programmed in GLSL or HLSL languages.

As you can see in the picture, the rounded box with holes is drawn with cairo libraries using a linear pattern, that in my framework is considered a 2D texture with a fixed shader. The same texture can be drawn also with OpenGL, DirectX or Vulkan implementation of the context. In this case, the fixed shader is translated into GLSL or HLSL code and executed by the graphics library.

This abstraction has been introduced to support basic functionality when advanced graphics libraries are not available. With Cairo we don't have program shaders and linear or radial shader textures can be translated into linear and radial patterns to make the rendering possible. On the contrary, program shader textures cannot be rendered because Cairo don't have program shader functionality at all. This abstraction is useful if you want to reuse the same context API for basic functionality, like software rendering of the GUI for the application.

Materials are more complex but they use similar concepts for being extremely scalable. First of all, I decided to abandon the old format similar to 3D Studio Max or Maxon Cinema 4D to adopt another format more similar to UE4 that is based on Visual Expression Nodes, where one node in this case is called "material component". A material is composed by different stages: displacement, fragment, blend and radiance. Every stage has parameters and a single component in input, that can be a texture with texture coords, diffusion with lights and normals or the combination of more components with "add" or "multiply" nodes.

If program shaders are supported by the context implementation, the material is translated into a program shader, otherwise it will be rendered as best as possible, with the component types supported by the graphics library. In the case of cairo, program shaders are not available and only texture components are supported. In this case, a single texture component is passed to fragment stage as input, like in the following diagram:

To draw a simple image with Cairo like the background in the example test, a material can be created with just a texture image attached to the fragment stage. If a feature is not available in the context implementation, the rendering won't be produced but no error will be generated. You can try to render a 3D scene with Cairo (and not OpenGL): in this case only 2D shapes will be rendered and not meshes with polygons,  complex materials and program shaders, that are not supported. On the contrary, advanced graphics libraries like OpenGL are always able to render scenes with lower features. An OpenGL context should be always able to render a simple 2D scene, like the one showed in the example. In the same way, the GUI can be rendered via software with Cairo libraries or via GPU with OpenGL libraries. However, advanced functionality are not mandatory for the graphics engine to work. In this way, the engine can be scaled from the pac-man clone to the latest 3D games with ray tracing functionality.

Now I'm proceeding with the implementation of the graphics engine and I'm pretty excited. The next step is to write an implementation of the graphics context with OpenGL, Direct3D and Vulkan, improving the 3D engine. Most of the 2D engine will be used to implement the GUI. I will implement a converter for importing assets with assimp library. I want to write also a series of posts about the missing progresses that I made during development of the framework in the last year.

TextureMind Framework – Progress #1 – Serialization and log

I continued to program the TextureMind Framework and I'm pretty happy with the result. I wish that this framework will give me the chance to increment the production of my software and to save most of the time (because I don't have it). People told me many times to use already existing frameworks to produce my works, and I tried. Most of them are not suitable for what I want to do, or maybe they have issues with the licenses or simply I don't like them. I want to make something new and innovative, and I feel like I'm about to do it.

- Serialization

Let me say that the serialization is a master piece. You can program directly in C++ new classes with a very easy pattern, save and load all the data into four formats: raw (*.raw), interchangable binary (*.tmd), human readable xml (*.xml) and json (*.json).

Continue reading

TextureMind Framework – Work in progress

What is it?

TextureMind framework is a SDK to develop software with different programming languages on different platforms. The framework is composed by a set of classes to facilitate tasks that require the use of multithreading, vectors, lists, maps, multimaps, parsing, serialization, ipc, networking, graphics, computer vision. The framework will be also composed by a complete set of applications to create images, animations, GUIs and videogames. I'm creating this framework to facilitate the production of software in general. It has been coded by me from scratch and it can be seen as a collection of all the knowledge that I have in the field of computer programming. The framework is currently closed source and it will be used just for my personal creations.

Continue reading

Version 5 of GemFinder is work in progress

After thinking for a long time, I decided to produce the 5th edition of GemFinder using the brand new CJS framework. It's still a project in its infacy but I'm pretty sure about the new features that this program will have (if you like the genre, this is going to be amazing). The huge news is that the software will be crossplatform and totally programmable in it's main components: screen capture -> image analysis -> decision maker -> input repeater.

It works exactly in this way:

- Each component implements a default algorithm to make the program work. If you use the default component, you have to do nothing at all.

- If you are a software developer, you can change the internal code with a JIT language and save the source code in the configuration file. Like a shader, you don't need to build the source code.

- The JIT language is basically C and allow you to dynamically link an external library, so you can implement your own algoritm in another existing language (using directx, opengl, opencl...).

- You are not forced to reprogram all the components by scratch, so you can change only the components you want to.

Continue reading

Super Mario Bros for Amstrad CPC 464

When i was a little kid I remember that i really wanted to create a Super Mario Bros game for the amstrad cpc 464. Now that I am 33 and I work as a software engineer I asked myself: why don't you make your old dream come true? :) Finally I found the time to create a demo with the famous first Level 1-1 of Super Mario Bro:

The horizontal hardware scrolling needs a double buffer in order to get an accuracy of 4 pixels. The demo runs on original Amstrad CPC 464 speed emulated by Caprice. It is pretty fast and can loop horizontally with a limit of 512 tiles meanwhile the level 1-1 takes only 212 tiles. I readjusted the original smb graphics to fit a 256x192 Mode 1 with 4 colors. I really like the effect of the gray scale map mixed with the blue sky, like in the original NES game. This demo has been programmed with SDCC in C and Z80 assembly.

Continue reading

An old Mario64 clone – Demo version

Years ago I coded a 3d engine to create my own clone of super mario 64. The name of the project was Chronicle Time Quest and it never reached its final release or a version that was remotely playable. Unfortunately it was abandoned years ago for lack of time, resources and interests. However, it was  usefull as coding experience and the result wasn't so bad at all, so I have decided to publish this video to show something about it.

Probably this project will be restored as soon as possible, with a new concept (probably similar to the mario galaxy one) and a totally new 3d engine. If you like this idea or the video or the concept or whatever you want, please, write a comment to let me know what you think about it. Thanks.

Gianpaolo Ingegneri
Copyright @ 2010 – All right reserved