25 February 2013

Interesting links in February 2013

This time:
  • Two new trends in Realime Graphics
  • Are DirectX and XNA dead?
  • Programmer Interrupted
  • std::map vs std::unorder_map
  • How to efficiently render Lego bricks

Two new trends in Realime Graphics

Normal mapping without precomputed tangents
In the beginning of year 2000 it was quite impressive to have per pixel lighting in your game. After that we could add improved lighting models, normal mapping, then parallax mapping, etc, etc.. But normal mapping is fairly a huge step when adding to rendering pipeline: for each vertex there has to be new attribute - tangent (and optionally bitangent). It should be loaded (and sometimes corrected) from a file and moved to the GPU. 
Recently we can skip that 'tangent loading' process and calculate so called 'tangent frame' directly in the pixel shader! I need to admit that I do not fully understand maths behind this, but result are pretty amazing. Originally this technique was introduced in ShaderX 5 (in 2006), but recently and updated version of this article appeared. Hope to see more of this... or maybe I will even take a risk and implement it by myself.
Additional link to geeks3D with some test code
from geeks3D

Forward lighting plus
When we want to use several hundreds of lights in a scene then we would use deferred rendering for sure. But recent research shows that good old forward rendering can still be used and can have even better performance!
AMD in its new demo introduced interesting technique called Forward+ lighting. Below there is a list of basic steps:
  • Depth prepass (fill only z buffer)
  • Light culling (culls lights per tile basis, uses compute shaders, store list of lights that affects a tile)
  • Shading
    • render geometry
    • in pixel shader use normal forward rendering, but use light list computed in 2nd step.
    • materials can change as desired
That way we are able to get many lights + transparency + MSAA
link to presentation (PDF) from AMD about Forward+

Are DirectX and XNA dead?

@extremetech and @gamasutra
Quite amazing news that:
  • XNA will be no longer supported. So you will not be able to create indie games fore new Xbox with XNA any more. Need to find something else... Metro?
  • DirectX is no longer evolving? This does not mean that there will be DX12, and OpenGL is a true winner in Rendering Api wars. This news means that the development of Direct3D will be continued, but the rest (DirectX) will be merged into Win Api.
I need to think and read it through once again. I did not see any new DirectX SDK's for a long time (but most of demos are in Win SDK actually). As I am not using DX right now in my projects I can be not so on time and have some out dated information. Please correct me if I am wrong :)

Programmer Interrupted

Link to Chris Parnin's blog
Another blog post that gives me some relief regarding my work style! I (and you too of course) am not alone in being interrupted during the work at the office. Actually interruptions can happen all the time, but they can be especially problematic in the office - they simply reduce your performance.
Some things to remember from the text:
  • we need 10 to 15 minutes to get back to work after interruption.
  • we are likely to have only 2h of uninterrupted session per day
  • in particular it is hard to get back when you are interrupted during the 'high memory' task
tools that can help (beside pomodoro, gtd and other techniques...):
  • leave reminders to be able to return quickly in the the 'mood'. But remember about reviewing them!
  • would be nice to view what have changed recently in the code (like history of your changes during the day). Of course it would be to time consuming to check in/commit code every 30 minutes, just to be able to track changes. I like idea of 'enhanced scrollbars' (in Productivity Power Tools) where you can see at least where you are in the code, what layout it has and the most important what code was changed.
  • thumbnails of opened files could help in navigation among large amount of code (for instance when debugging)
  • and more: like narrative coding (story), differences between novices and experts
there is even a survey: link to google docs
This topic is very interesting and maybe in some near future we will have advanced tools implemented in our IDE to help us fighting the interruptions.

std::map vs std::unorder_map

Link to stackoverflow, link to blog post with some benchmarks, slow implementation in VC 2010
New C++ Standard adds long awaited hashed containers. Everyone knows that for some cases it is better to use hash map than a map - that is actually implemented as balanced ordered tree (AVL for instance). This is the theory, but real life examples can show some different results.
Above I put three links to blog posts and questions about this new containers. Results are quite interesting:
  • unordered_map seems to work horribly slow on MS implementation in VC2010, especially in the debug mode!
  • use boost::unordered_map instead :)
  • or maybe the good old std::map is not that bad? It is easier to use and if your container has a small number of elements (below let's say 1000) you will not see any meaningful performance difference
  • need to look at _ITERATOR_DEBUG_LEVEL because it has a huge impact on STL in MS implementation.

How to efficiently render Lego bricks

Link to hacks of life
Since I like Lego I could not skip this blog entry! Lego + OpenGL... sounds great!
How to draw such things?
  • colored polygons and lines. No textures, flat shading only. There is no need to use textures of course and simple lighting model is perfect for their plastic look.
  • Vertex bound. Cannot use indexes because of flat shading (almost every vertex has different normal)
  • one brick per static VBO
  • lots of draw calls - 10 000 bricks is only a decent model.
  • first trick: add individual matrix to vertex attribs, not to uniform buffer
  • second trick: use hardware instancing: find similar bricks and group them into one draw call
The blog entry describes some improvements in the renderer (trick one and two), and all in all they got 2x rendering speed.

BTW: new, great and awesome page logo comes from openclipart

Interested in new blog posts and occasional updates? Please sign up for my free newsletter.

Copyright Bartlomiej Filipek, 2016, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.