All Blog Entries

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

Warning! Some information on this page is older than 6 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

Pages: > 1 ... 28 29 30 31 32 ... 150 >

# Hack3city 2014 - Our Game

Sun
11
May 2014

I just came back from Hack3city - a programming competition. Participants had to develop their applications over this week - Monday to Friday working from home, while Saturday and Sunday working in Starter, Gdańsk. There were 4 tracks. We participated in track organized by Playsoft, where we had to create a game. The theme of this competition was "fear of the dark". We took 3rd place.

As I promised to some of you, I publish playable version of our game today. The game is created in Unity and can be run in web browser if you have Unity Player installed.

PLAY ONLINE

Controls:

Our game is called "Jason McBrady Dark Adventure". It's a 2D platform game. It's about an adventure seeker exploring ancient tombs full of dangers like zombies, who want to kill you, but run away from from the light. It's quite difficult :)

We called our team NOQA. Credits are:

In the next post, I will write more about Hack3city. See: Hack3city 2014 - Review

Comments | #competitions #hack3city #unity #productions Share

# Boost Geometry LOL

Tue
06
May 2014

Many programmers I follow on Twitter made fun recently of this page: Boost Geometry - Design Rationale. I agree with them - it's ridiculous how sophisticated a simple geometric distance function can become if you want to make it generic using C++ metaprogramming. There are many developers who like such tricks, but I'm not one of them.

Of course I know and appreciate that C++ is so powerful you can write such generic code and that all the complexity is solved in compile time so run-time performance is good and not affected by this. But on the other hand, generic programming in C++ has its flaws: it's hard to learn, the code is long and complex, hard to write, debug, read and understand. When you make a mistake, error messages are cryptic, which is inevitable with so many levels of indirection.

So here is what I thought about this: If all these traits and other helper, boilerplate code was not needed and if compile-time metaprogramming was imperative and iteration-based like the main language itself, not functional and recursion-based, then a dimension-agnostic distance function could look like as simple as this:

struct vec2 { float x, y; }
struct vec3 { float x, y, z };

declare components of vec2 as { x, y };
declare components of vec3 as { x, y, z };

float distance(a, b)
{
    float dist = 0;
    foreach(c in a.components)
        dist += (b.c - a.c) * (b.c - a.c);
    return sqrt(dist);
}

But because it doesn't, I will stick with 2D, 3D and 4D vectors of floats :)

Comments | #boost #c++ Share

# Fluorescence

Mon
05
May 2014

The main and general formula in computer graphics is Rendering Equation. It can be simplified to say that perceived color on an opaque surface is: LightColor * MaterialColor. The variables are are (R, G, B) vectors and (*) is per-component multiplication. According to this formula:

There are many phenomena that go beyond this model. One of them is subsurface scattering (SSS), where light penetrates object and goes out from different place on the surface. Another one is fluorescence - a property of a material which absorbs some light wavelength and emits different wavelength in return. One particularly interesting kind of it is UV-activity - when material absorbs UV light (also called blacklight, which is invisible to people) and emits some visible color. This way an object, when lit with UV light, looks like it's glowing in the dark, despite it has no LED-s or power source.

I've never seen a need to simulate fluorescence in computer graphics, but in real life it is used e.g. in decorations for psytrance parties, like this installation on main stage on Tree of Life 2012 festival in Turkey:

So what types of materials are fluorescent? It's not so simple that you can take any vividly colored object and it will glow in the  UV. Some of them do, some don't. You can take a very colourful T-shirt and it may be not visible under UV at all. On the other hand, some substances glow while they would better not (like dandruff :) But there are some materials that are specially designed and sold to be fluorescent, like the Fluor series of Montana MNT 94 paints I used to paint my origami decorations.

 

Comments | #art #psytrance #rendering Share

# Four primary colors

Sun
04
May 2014

I've already posted about my origami decoration. My choice of colors is not random. Of course I could make it more colorful, but evey paint costs some money, so I decided to buy just four: red, green, yellow and blue. Why?

That's because I still keep in my mind the great article Color Wheels are wrong? How color vision actually works. It tells that although our eyes can see three colors: red, green and blue (RGB), our perception is not that simple and direct. Our vision first does the difference between R and G, so each color is even more red or more green. Next and more importantly, it does the difference between RG and B, so each color is either more yellow (or red, or green) also known as warm colors, or more blue, aka cool colors.

That's also how photo manipulation software works (e.g. Adobe Lightroom). Instead of scrollbars for RGB, you can find there two scrollbars: to choose between more red and more green (called tint) and between more yellow and more blue (called temperature).

That's why it could be said that for our vision, there are four primary colors: red, green, yellow and blue.

Comments | #rendering Share

# Origami Psytrance Decoration

Sat
03
May 2014

I've posted before about modular origami. This time I made some bigger spike balls, painted them with fluorescent colors and used as decoration on yesterday's psychedelic trance party - Nirvana Open Air. It's 24-module Super Spike Ball (it's a link to Wayback Machine / Web Archive, because the great website spikeballheaven.net is no longer online), painted with Montana MNT 94 flourescent paints. Now I'm too tired after the party, but in the next two posts I will try to explain some theory behind it. And yes, it will be related to computer graphics :)

  1. Four primary colors
  2. Fluorescence

Comments | #art #psytrance #origami Share

# What do we have from benchmarks?

Sun
27
Apr 2014

There was this case some time ago about some graphics vendors cheating in Futuremark benchmark (see this). They basically detected this particular application and raised frequency to increase performance and gain higher score. So some devices have been delisted from the Best Mobile Devices list for cheating and they published this document: Benchmark Rules and Guidelines.

My first thought was: Good, they just want everyone to play fair. But then I read the rules again, especially this one: "The platform may not replace or remove any portion of the requested work even if the change would result in the same output." and I said: Wait, what? Isn't it a generic definition of every optimization? If a developer writes 2+2 in GLSL and the platform just uses 4, is it cheating because it removed requested work (addition in this case) even if result is the same?

And then I started thinking: What do we have from benchmarks after all? Is their importance a good thing for gamers and other customers of graphics technology? In theory, benchmarks should mimick some aspect of real applications to measure and compare how different hardware performs in this type of applications (e.g. games). But it may be that decision makers want to just see good scores in benchmarks (bosses generally like numbers and bars and graphs :) so engineers implement optimizations or even some cheats just for these benchmarks. And then media notice that, devices get delisted, benchmark creators write such rules... and gamers just want to play games.

If performance was measured just in real games, and platform vendors optimized or even cheated for a particular title, then at least we would have a better performing game. Just my personal opinion :)

Comments | #hardware #gpu Share

# Using Google Test in Visual C++ 2012

Sun
02
Mar 2014

I was recently learning Google Test (Google C++ Testing Framework). It's a C++ library from Google (shared under new BSD license) to do unit testing, following xUnit convention.

As always with any library in C++, it's not that easy as just download the sources, compile and use it. Here are my experiences with making it work in Visual C++ 2012:

1. Visual Studio solution is already prepared in msvc/gtest.sln. You just need to confirm upgrading to new version and ignore report with warnings.

2. You only need "gtest" project. It compiles a static library. That's the way I decided to use it. Alternatively you could just include all library sources to your project.

3. The library uses tuple from new C++ that requires variadic templates. Visual C++ doesn't support this feature, so to make it compiling without errors, you need to globally define following macros (in project properties > C/C++ > Preprocessor > Preprocessor Definitions, in both Debug and Release configurations, in both library and your client project):

GTEST_USE_OWN_TR1_TUPLE=0
_VARIADIC_MAX=10

4. If your project uses different way of linking to the standard library than gtest, you will get linker errors like:

1>gtestd.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in MyTestApp.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in gtestd.lib(gtest-all.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in gtestd.lib(gtest-all.obj)
...

That's probable as default setting for new project is to link it dynamically, while gtest project links it statically. It should be same in both gtest and your project. To change it to linking dynamically, enter project properties > C/C++ > Code Generation > Runtime Library and choose Multi-threaded Debug DLL (for Debug) and Multi-threaded DLL (for Release).

After setting it up, usage of the library is very easy. You just need in your project:

1. Add "include" subdirectory to include directories.
2. #include <gtest/gtest.h>
3. Link with "msvc/gtest/Debug/gtestd.lib" (in Debug) and "msvc/gtest/Release/gtest.lib" (in Release).
4. Write your tests, like:

TEST(IntegerTest, Addition)
{
    EXPECT_EQ(4, 2 + 2);
    EXPECT_EQ(10, 3 + 7);
}

5. Write main function:

int main(int argc, char** argv)
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

I like this library - it's easy to learn and use while quite powerful. It's also well documented - the main documentation is: Primer, Advanced Guide, FAQ.

There is also a GUI application available, called Guitar (Google Unit Test Application Runner) or gtest-gbar, which allows running your testing application and browsing results in a window instead of console.

Comments | #testing #libraries #c++ Share

# Game Programming Blogs

Mon
24
Feb 2014

I use RSS/Atom to read news. It's a great technology because I can have news from many different websites displayed in a single browser and formatted in one style. I used desktop reader applications, then moved to Google Reader and after it has been closed, moved to The Old Reader. Now The Old Reader changes rules so that free account can have maximum 100 feeds. I had more than that because I used to add feeds from all the interesting blogs I came across over the years. I don't have enough time to read everything what's new in all of them, so today I've just exported the list of these blogs and I'd like to share it with you here. These are mostly developer blogs about game development, graphics programming (rendering) or just C++/native programming, geometry/math etc. Some of them are updated frequently and some left inactive for a long time. Some are written by professionals and some by amateurs. You can also find more such blogs and other websites under rendering tag in my Pinboard bookmarks. Here are my exported feeds:

Comments | Share

Pages: > 1 ... 28 29 30 31 32 ... 150 >

[Download] [Dropbox] [pub] [Mirror] [Privacy policy]
Copyright © 2004-2026