We have created a website where you can download code samples that show many different rendering techniques and effects!

90d082e4bfb89600589e6d0f26bcbc96
0
BiteTheBytes 101 Aug 02, 2013 at 13:37

Hello! We are a small team of programmers from germany, and today we would like to show you what we have been working on recently.
As fellow game developers, we noticed that its often quite hard to find out how certain effects are being done. Basic lighting and texturing effects are easy to find, but it gets hard when you want to know how to do things like parallax occlusion mapping, deferred shading, SSAO and similar things. The issue is mostly that no ready-to-go code is available, and many people can’t turn a theoretical paper or dummy code into a correctly working shader file, or simply just don’t want to spend the time doing that.
On our new website, www.codebatch.com, we have an expanding collection of code samples that take care of exactly that. The source code is fully accessible and you can even use it for your projects under the given licence. All samples are Visual Studio 2012 solutions (additionally 2010 for C++) and are available for:

  • C++ DirectX 10 / 11
  • C++ OpenGL 4
  • C# SlimDX 9 / 10 / 11
  • C# SharpDX 10 / 11
  • C# XNA

with a few exceptions where samples don’t run on a lower DirectX version or aren’t supported by the API. C# OpenTK will be added soon too.
So please check it out, download some of the free samples and let us know what you think! We hope it will be helpful to many of you, both experienced and new developers.

6 Replies

Please log in or register to post a reply.

Ceee4d1295c32a0c1c08a9eae8c9459d
0
v71 105 Aug 02, 2013 at 15:06

Great site, guys, you should put an english version too for non german speakers , i am going to be one of your customers soon.

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Aug 02, 2013 at 23:59

Nice site, it’s shame that when I was learning graphics there weren’t as awesome sources as this (especially when you are good in german). So few notes from me…

1.) I’m a linux “zealot” so I’m really missing C++ version for Linux platforms (respectively Mono (C#) version for (not just) Linux platforms, as Linux is quite popular among developers (and students), at least in Central Europe (and a lot of people, developers and students, use Linux here - I’d say at least like 30 - 40% of people interested in programming).
2.) There is one thing, that you might consider to add - live demo. Showing live demo on the website, F.e. through WebGL.
3.) For some products, you don’t have available all platforms - like compute shader for OpenGL, etc. - you might consider adding work-arounds for older platforms and/or other possibilities (like OpenCL - which is basically also the only way to do compute shaders in OpenGL as for now, because OpenGL Compute Shader is still quite messy on AMD drivers).

If you’d like some help with any these, shoot me a PM.

EDIT: Are you planning to add some harder-to-implement papers like imperfect shadow maps, voxel cone tracing, sparse virtual textures, etc.?

Ceee4d1295c32a0c1c08a9eae8c9459d
0
v71 105 Aug 03, 2013 at 19:28

Guys, i have sent you a message where i say that all of your demos crash on my ati, have you received my email ?
probably its the opengl 4.0 rendering path not working

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Aug 04, 2013 at 02:41

I just downloaded sample (Alpha blending one) and tried to run it - I had problems with shaders on AMD. But with few modifications I’ve managed to run it:

In Material class constructor:

Material::Material(Shader* const* shaders, int shaderCount, string* inputElements, int inputElementCount)

This block of code:

    // Get the amount of uniform variables in the shader.
    glGetProgramInterfaceiv(this->programId, GL_UNIFORM, GL_ACTIVE_RESOURCES, &count);

    char nameBuffer[256];
    int uniformSize;
    int uniformLength;
    unsigned int uniformType;
    for(int i = 0 ; i < count ; i++)
    {
      // Write the uniform name into a char buffer
      glGetActiveUniform (this->programId, i, sizeof(nameBuffer),
        &uniformLength, &uniformSize, &uniformType, (char*)&nameBuffer);
      // Create a string from the char buffer.
      string name(nameBuffer);
      // Get the location handle of the uniform variable.
      unsigned int location = glGetUniformLocation(this->programId, name);
      // Insert the uniform location into the map.
      this->parameterMap[name] = location;
    }

Crashes on AMD gpus on glGetProgramInterfaceiv procedure. The address of glGetProgramInterfaceiv is apparently NULL, so the extension GL_ARB_program_interface_query apparently is unsupported and causes crashes on (recent) AMD drivers, officialy supporting OpenGL 4.2 … can’t tell about OpenGL 4.3 drivers yet (I haven’t updated the new “24th Jul” drivers yet), even though extensions list says it is supported (driver bug?!).

I removed this code and re written function for getting uniform location, as (dumb but simple, I could’ve cast that string though in a more better way, haven’t look at your class yet though):

  unsigned int Material::GetUniformLocation(string paramName)
  {
    /*std::map<string, unsigned int>::iterator iter = this->parameterMap.find(paramName);
    if(iter == this->parameterMap.end())
      throw Exception("Set value error.", "Material parameter <" + paramName + "> was not found.");
    return iter->second;*/
    return glGetUniformLocation(this->programId, paramName.ToChar());
  }

Which apparently works on AMD! Voila!

Here is my proof: :ph34r:

2zrg7kj.jpg

Ninja’d with help of my desktop kitten!

EDIT: + as you use OpenGL with SFML your code should actually already run on Linux, but I haven’t tried it yet (and I even didn’t realize in the first moment, as I’m not using SFML or any other library, but interacting directly with X11 :D … “Zealots, zealots everywhere”). Maybe you should add it (note that it also works on XP (OpenGL versions), not ust Vista/7/8 -> proof above :) ).

EDIT2: After further investigation in really seems that AMD version of GL_ARB_program_interface_query is bugged as I’ve tried adding it into my own game engine and upon starting it crashed. Let me try with new AMD drivers today, we’ll see whether they got any better.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Aug 04, 2013 at 10:34

That’s a useful note for me. thank Vilem.

I’m always coming across code that “should” work, but crashes.

Tracking down what it is can be a pain, the number of people that just assume a feature is always available even when it is actually in an extension amazes me.

90d082e4bfb89600589e6d0f26bcbc96
0
BiteTheBytes 101 Aug 06, 2013 at 09:54

@v71

Great site, guys, you should put an english version too for non german speakers , i am going to be one of your customers soon.

You can switch the site to english at the top, and the source code of the samples is also written/commented in english.
@v71

Guys, i have sent you a message where i say that all of your demos crash on my ati, have you received my email ? probably its the opengl 4.0 rendering path not working

As you probably already noticed we have received and replied to your email. Thanks again for reporting the issue! We are working on a fix for the AMD cards at the moment.

@ Vilem Otte
Thanks for your ideas, we will certainly look into other platforms in the future and adding the demo’s via WebGL we also had in mind. Your third point is a good idea, we will look into it. More complex samples will follow once we have covered all the basic/common stuff.

The AMD fix you proposed was actually our initial approach but turned out to slow down some samples where it was used often, and we weren’t aware of the driver issues with the current way of doing it. We are working on a new approach now. But huge thanks for your efforts!