All Blog Entries

All blog entries, ordered from most recent. Entry count: 978.

Pages: 1 2 3 ... 123 >

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:

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:

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 (1) | 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:

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:

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:

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

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

Pages: 1 2 3 ... 123 >

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