Twitter

Pinboard Bookmarks

Blog Tags

Recommended Productions

Ball-B

Simple 3D game developed in Unity during Global Game Jam 2014.

Play Online

Date: 2014-01-26

Download:
Ball_B_Windows.zip (8.78 MB)
Ball_B_Source.zip (20.49 MB)

Octovirus

Simple 2D game developed during Global Game Jam 2013, for Windows.

Date: 2013-01-27

Download:
Octovirus.zip (6.1 MB)

FX Batch Compiler 1.1

This Windows application supports compilation of FX effect files and HLSL shader files using fxc command line compiler included in DirectX SDK. You can compile many files at time or one file with different settings.

Features:

  • Write compilation scripts in a simple language by specifying parameters for fxc.exe.
  • Compile multiple shaders at time.
  • Compile only shaders that need rebuild checked by file modification time.
  • Review success or failure, warning and error count and compiler output for every task.
  • Compile single HLSL source file with different parameters and preprocessor macros.

Date: 2011-02-09

Download:
FxBatchCompiler_1-1.exe
FxBatchCompiler-1.1-bin.zip
FxBatchCompiler-1.1-src.zip

Block Wizard

My first Flash game. Coded with FlashDevelop in ActionScript 3.

Date: 2010-04-06

CommonLib 9.0

Universal library for C++, created especially with game programmers in mind. Includes: math module (vectors, matrices, quaternions, planes, rich set of collision functions and more), string operations, conversions, smart pointers, configuration files handling, date and time module, exception class hierarchy for error handling, file system handling, stream class hierarchy, FreeList - free memory allocator, complex logger, profiler, library for threading and synchronization, tokenizer, wrappers for compression with zlib.

Language: C++. Platforms: Windows and Linux. License: GNU LGPL. Optional support for Unicode. Optional integration with D3DX. Documentation made with Doxygen.

Date: 2009-12-16

Download:
CommonLib_9_0.zip (4.92 MB)

Aqua Fish 2

Game for children - clone of PacMan. Player swims as a fish and collects points, as well as special items. Player also have to run away from enemies or destroy them. 60 maps in 6 different titlesets. Low hardware requirements. See also YouTube videos: [1], [2]. Game was published by Play Publishing company.

GameDev Calc

Calculator for game programmers. Basic data unit is a vector of 1-4 floating point numbers, which can be treated as (x,y,z,w) vector or (r,g,b,a) color. Next to basic calculations like addition, multiplication or sinus, vector operations are also available, e.g. vector normalization, conversion between degrees and radians, color conversion between RGB and HSB, finding linear an quadratic function coefficients and much more. Instead of entering single number, here you can see all the history of your calculations in form of stack and all operations are performed on that stack. Data can be entered and retrieved in different formats, like "D3DXVECTOR4(0.0f, 0.5f, 0.752f, 1.0f)" or "0xFF0080C0". Platform: Windows. Language: C#. License: GNU GPL.

Download:
GameDevCalc_1-0.zip (53.06 KB)
GameDevCalc_1-0_src.zip (50.73 KB)

Blog

20:15
Wed
01
Oct 2014

Writing OFX Video Processing Plugin

Computer graphics is a broad topic and GPU-accelerated real-time 3D rendering is just one of its parts. Another one is photo and video processing. Video editing is an art by itself, but from the technical point of view there are various interesting effects that can be applied. While not essentially real-time and often done on CPU, of course it could also be GPU-accelerated and also should be as efficient as possible. There are many video editing programs, from Windows Movie Maker to Adobe Premiere. The one of my choice is Sony Vegas Pro. Such programs come with a bundle of standard effects, but for a graphics programmer what can be more fun than writing own plugin?

Vegas Pro supports plugins in OpenFX (OFX) standard. They are written as native code compiled to DLL library with appropriate interface. I'm learning how to write such plugins. Below is a description of how you can start experimenting with this technology plus my "Hello World" example that performs simple color inversion. Maybe later I will write a tutorial with detailed description of this API. For now, here is C++ source code of my example with Visual Studio 2013 project and compiled binaries (Win32 and x64): OfxTest1.zip (21 KB). Inside Vegas Pro it looks like this:

A brief description of how to start coding such plugins:

  • Documentation is on openeffects.org website.
  • You need to include header files that can be downloaded from Sourceforge > Open Plug-ins For Visual Effects > openfx / openfx-1.3.
  • After compilation, you have to rename your DLL to OFX extension and copy it to appropriate location, like: c:\Program Files\Common Files\OFX\Plugins\Basic.ofx.bundle\Contents\Win64\Test1.ofx.
  • It must be either 32-bit or 64-bit binary (and appropriate target directory) depending on version of your Vegas Pro.
  • I configured copying of this file in VS Project Options as Post-Build Event.
  • You have to exit Vegas Pro before overriding this file and then run it again to load and test new version.
  • You can debug execution of your code by configuring VS project to run Vegas Pro. All this is set in my example project.
  • You can use binary in either Debug or Release configuration. Of course Debug will be slower.

Note that examples provided on SourceForge next to includes package are broken. When compiled in Visual Studio, they assert in Debug configuration due to usage of uninitialized variables and stack corruption! Patch for these bugs is submitted for over 2 years (#1 Basic in Examples - uninitialised variables) and the author is not fixing it. My example has all of this fixed.

Comments (0) | Tags: video openfx | Author: Adam Sawicki | Share

14:49
Sun
28
Sep 2014

Building 64-bit Executables in Visual Studio Express

I admit that for years I was convinced only the paid version of Visual Studio can compile 64-bit EXE files. It's just because I never really needed to create one in my personal projects. Now I have to do it (what for? - I will show in one of my next posts) and as it turns out, it's perfectly possible and easy to do also in Visual Studio Express. You just have to make some configuration because the "x64" platform is not shown by default. So to compile 64-bit executable in your Visual Studio 2013 Express:

  • From main menu, select: Build > Configuration Manager...
  • Click on: Active solution platform > <New...>
  • Select: Type or select the new platform = x64
  • Check: Create new project platforms
  • Confirm: OK
  • When "Active solution platform" is "x64", ensure that all projects in your solution on "Project contexts" list have "Platform" = "x64".

You can now choose and build any configuration (Debug or Release) for any platform (Win32 or x64). For x64 platform, intermediate and output files will be written to subdirectories: x64\Debug\ and x64\Release\. Notice that for Win32, it's just Debug\ and Release\.

Comments (2) | Tags: c++ visual studio | Author: Adam Sawicki | Share

21:02
Fri
29
Aug 2014

DirectX 11 CheatSheet

I've created several cheatsheets: about DXGI Formats, XNA Math, floats, color names in .NET and Direct3D 9. You can see it in Download/Misc. Today I discovered that I didn't publish my DirectX 11 CheatSheet that I've prepared 3 years ago! So here it is:

DirectX_11_CheatSheet.docx
DirectX_11_CheatSheet.pdf

On 15 pages, you will find:

  • Direct3D 11 enums
  • Direct3D 11 structures
  • HLSL input and output semantics
  • Parameters of fxc.exe - console shader compiler

Comments (2) | Tags: directx | Author: Adam Sawicki | Share

20:14
Tue
19
Aug 2014

The End of Lag Magazine

In November 2012 a new paper magazine appeared in Poland called Lag (FB page). I didn't post about it here because I didn't want my little corner of the Internet to carry a negative opinion about this innovative project. But now, after two issues, they announced the end of the project. The editor-in-chief says that it's accounting, packaging, shipping and stuff like that what made it too difficult, so I don't know whether it was a success commercially or many people would share my opinion, but anyway... I think such magazine doesn't make much sense. Here is why:

Lag was an unusual magazine. It was about games, but without any news, game reviews or screenshots. It contained only journalism (plus some illustrations) - essays not even about a particular game, but about games in general and their place in our culture. It felt like being targeted at older, mature readers. Meanwhile, popular stereotype says that games are just for children and teenagers. Some people (and statistics) show something opposite - that they are for everyone. Where is the truth?

I still like games despite being 30, but I like them because I still feel young. I like chasing news, watching trailers and screenshots, sometimes being enthusiastic or even fanatic about some IP and buying a game in the day they release it to the shops. For me it's all part of gaming. All in all, games are entertainment, so it's about emotions and being amused. If I had only such intelectual and analytical approach as the magazine presented, I would rather abandon my interest in games completely.

Comments (2) | Tags: games | Author: Adam Sawicki | Share

14:55
Sat
02
Aug 2014

CPrintStream 1.1

2.5 years ago I wrote a piece of C++ code called CPrintStream - see CPrintStream - Polymorphic Printf for description. Now I updated it to version 1.1. Files to download:

PrintStream.hpp
PrintStream.cpp

What's new:

  • Now the code is self-contained - it depends only on standard C and C++ library + WinAPI for one function.
  • Added additional abstract class CBufferingPrintStream which formats message into a single string and passes it to another virtual function for clients that need this form.
  • Added class CDebugPrintStream derived from CBufferingPrintStream that prints message to OutputDebugString.

OutputDebugString is a WinAPI function for passing debug messages. If debugging in Visual Studio, these messages can be viewed in Output panel. If not, they can be captured using separate, simple and free program - DebugView.

Comments (5) | Tags: c++ | Author: Adam Sawicki | Share

21:39
Mon
28
Jul 2014

Making Tilt-Shift Photo in GIMP

There is an interesting photographic effect called Tilt-Shift. It makes a photo of city panorama looking like a miniature due to small depth of field. Wikipedia says it can be obtained optically with some advanced techniques, but it can also be approximated with postprocessing.

Yesterday I visited St. Dominic's Fair in Gdańsk, where I had an opportunity to enter a Ferris wheel and take a photo of my city from some height. Here is my experiment with tilt-shift. I've made it GIMP.

Gdańsk Tilt-Shift

To do it, top and bottom of the photo needs to be blurred. But an out of focus photo is not the same thing as standard Gaussian blur. That's why a special kind of blur is needed. There is a GIMP plugin for it: Focus Blur (Windows binary can be found HERE). In Photoshop, the effect is available as Lens Blur.

Image needs to be blurred more the closer a pixel is to the top or bottom edge of the image. But I have no idea how to do blur (or any other effect) with intensity varying over image location, so here is the trick: We can use only two layers - normal and heavily blurred - and blend between them using layer mask.

So to add tilt-shift effect to your photo using GIMP:

  1. Choose a photo of a city panorama. Open it in GIMP.
  2. Use Crop Tool to crop it so no horizon line or sky is visible, only ground.
  3. In Layers panel, click appropriate button to duplicate layer.
  4. Make sure the top layer ("copy") is selected. Select Filters > Blur > Focus Blur. Change radius to some higher value (I used something around 10-16 for image in Full HD resolution). Confirm with OK.
  5. Now right-click on the top layer and select Add Layer Mask. Mask is created for this layer and selected so now drawing will change layer transparency instead of color.
  6. Select Blend Tool (the one for drawing gradients).
  7. In Tool Options panel, select gradient "FG to BG (RGB)" and change Shape to Bi-linear. Make sure current colors are: foreground = black, background = white.
  8. Draw the gradient by pressing left mouse button in the center of the image, dragging cursor to the top or bottom (hold Ctrl to draw perfect vertical line) and releasing it there.

If you've done everything right, you should now already have blending between layers applied so that top and bottom of the image looks like out of focus. Now you can:

  1. Flatten image by right-clicking on top layer and selecting Merge Down.
  2. Enhance colors. You can, for example, increase saturation and contrast.
  3. Export image with File > Export As.

Comments (1) | Tags: photography | Author: Adam Sawicki | Share

22:33
Mon
16
Jun 2014

Rendering Video Special Effects in GLSL

Rendering real-time, hardware accelerated 3D graphics is one aspect of computer graphics, but there are others too. Recently I became interested in video editing. I wanted to add some special effects to a video and was looking for a technology to do that. Of course video editing software usually has some effects built-in, like different filters or transition effects, some borders or gradients. But I wanted something different. If I had and I knew how to use software like Adobe After Effects, I'm sure that would be the best and easiest way to make any effect imaginable. But as I don't, I decided to use what I already know - to write a shader :)

1. To run a shader, some hosting app is needed. Of course I could write one in C++, but for the purpose of this work it was enough to use Live Coding Compo Framework (a demoscene tool created by bonzaj, which was used during last year's WeCan demoparty). This simple and free package contains rendering application and preconfigured Visual Studio solution. Having VS installed (it works with Express version as well), all I needed to do was to edit "Run.bat" file to point to directory with VS installation in my system. Next, I just executed "Run.bat", and two programs were launched. On the left monitor I had fullscreen "Live Coding Preview", on the right: Visual Studio with special solution opened. I could then edit any of the GLSL fragment shaders contained in the solution. Every time I hit Compile (Ctrl+F7), the shader was compiled and displayed in the preview.

2. Being able to render my effect in real-time, next I needed to capture it to a video. Probably the most popular app for this is FRAPS. I ran it, set Video Capture Settings to frame rate that I was going to use in my final video (which was 29.97 fps) and then captured appropriate period of time of rendering my effect, starting and stopping recording with F9 hotkey.

3. Video captured by FRAPS is in full, original resolution and encoded with some strange codec, so next I needed to convert it to desired format. To do this, I used VLC media player. Some may think that it's just a video player, but in fact it's incredibly powerful and flexible video transmitting and processing software. (I once had an opportunity to work with libVLC - its features exposed as C library.) Its greatest advantage is that it has its own collection of codecs, so it doesn't care whether you have appropriate codecs installed in your system. To convert a video file, I selected: Media > Convert / Save..., selected my AVI file captured by FRAPS, pressed "Convert / Save" button, selected Profile: "Video - H.264 + MP3 (MP4)", customized it using "Edit selected profile" image button, selecting: Encapsulation = MP4/MOV, Video codec = MPEG-4 (on Resolution tab, I could also set new resolution to scale the content, my choice was 1280px x 720px), Audio disabled, Subtitles disabled. Then after pressing "Save", selecting path to destination file, pressing "Start" and waiting some time, I had my video converted to more standard MPEG-4 format (and more than 5 times smaller than the original one recorded by FRAPS).

4. Finally I could insert this video onto a new track in my video editing software and enable blending with underlying layer to achieve desired effect (I used "Overlay" blending mode and 50% opacity).

There are some details that I intentionally skipped here (like video bitrate) not to make this post even longer, but I hope you learned something new from it. My effect looked like this, and here is the source code: Low freq fx.glsl

By the way, here is another tutorial about how to make GIF like this from a video (using only free tools this time):

1. To capture video frames as images, use VLC media player:

  • Go to: Tools > Preferences > Video > Video snapshots > Directory and select destination directory for snapshot images.
  • Open your video.
  • While playing, press and hold Shift+s (default hotkey for "Take video snapshot", can also be configured in Preferences).
  • A numbered sequence of images is created in selected directory.

 2. To merge images into animated GIF, use GIMP:

  • Create new, empty image.
  • To import all captured images as layers, drop these files onto the image.
  • Delete background layer.
  • To switch to indexed colors and apply dithering, select: Image > Mode > Indexed..., select Generate optimum palette, Maximum number of colors = 255 and Color dithering = Floyd-Steinberg (normal)
  • Select File > Export. Enter some file name with ".gif" extension. Press "Export". In next window, check "As animation", enter delay between frames, check "Use delay entered above for all frames" and press "Export".

Comments (3) | Tags: rendering video tools | Author: Adam Sawicki | Share

00:51
Thu
05
Jun 2014

Pixel Heaven 2014 - My Photos

Here is the gallery of my photos from Pixel Heaven 2014:


Pixel Heaven 2014

Comments (3) | Tags: gallery events demoscene atari | Author: Adam Sawicki | Share

Older entries >

STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2014 Adam Sawicki
Copyright © 2004-2014 Adam Sawicki