AMD APU13: AMD Talks DirectCompute in Gaming

Why do programmers need Microsoft's DirectCompute in gaming? This was one of many topics covered during AMD's developer summit last week, explaining the need for this API, which supports general-purpose computing on GPUs in Windows Vista, Windows 7 and Windows 8. This API was released as part of DirectX 11, but it also works on GPUs that use DirectX 10 as well.

"If you have things that can run on a GPU – you have a really powerful GPU that's massively parallel, and you're bottlenecked on the CPU, a lot of times you want to move things over to the GPU from the CPU for better performance," explained AMD's Bill Bilodeau. "And there are some algorithms that are just made more for a GPU: they're data parallel, they can take advantage of all the parallelism on the GPU. Things like post-processing techniques, in particular, where you can do the same thing for every pixel. Also things like physics are really well adapted to compute."

One example is AMD's TressFX, which uses the DirectCompute programming language to unlock "the massively-parallel processing capabilities of the Graphics Core Next architecture." Building on Order Independent Transparency (OIT), TressFX "makes use of Per-Pixel Linked-List (PPLL) data structures to manage rendering complexity and memory usage." The end result is in-game hair that was previously only available in pre-rendered images.

"Besides looking good in terms of the rendering, it also reacts really well too," Bilodeau said during his presentation, "because with every individual hair strand, the physics is simulated and that's what really gives it its natural look when it's moving. It also supports things like wind and other forces, collision with the body, and it is artist friendly. There's a lot of little tweaks you can do to it, modern constraints to allow for different effects like water, being wet. A great part of the entire simulation is done on a GPU with compute shaders so there's no going back and forth between the CPU and GPU."

Back in February, AMD updated its blog with news that TressFX treats each strand of hair as a chain with dozens of links, permitting for forces like gravity, wind and movement of the head to move and curl Lara's hair in a realistic fashion in Tomb Raider, which was released earlier this year. The blog also said that collision detection is performed to ensure that strands do not pass through one another, or other solid surfaces such as Lara's head, clothing and body. Hair styles, according to the blog, are simulated by gradually pulling the strands back towards their original shape after they have moved in response to an external force.

Bilodeau explained that raw vertex data starts on the CPU memory, is copied over to the GPU and then stored into the UAV, thus when doing the physics simulation, all that data on the GPU is available to use. The first step is to do integration (calculating movement and reaction to gravity) and global shape constraints (maintaining hairstyle), then local shape constraints, which calculates the finer aspects like curliness or straightness of the hair, then length constraints, meaning calculations that keep the hair vertices and overall strands from lengthening or shortening improperly; the force of wind is also calculated in this step. Finally, there's collision, the final step.

"All this stuff gets calculated and put back into the UAV," he said. "And then the next stage is rendering, so for our hair rendering, we just get it from that same place. So the great thing is this vertex data only needs to be copied over once the entire life of the program. So that slow connection between the CPU and GPU going over the PCI bus that you usually associate with physics is not a problem anymore because all of this is moved over to the GPU. And then we can use that data later for rendering so it stays on the GPU. This isn't done once per frame so it's really one of the good ways of doing physics.”

In a nutshell, DirectCompute gives developers access to tons of parallelism with the high-performance GPUs. The results that devs have computed with DirectCompute can later be used in the graphics pipeline. DirectCompute also has good interoperability, he said. There are existing algorithms that can be used in games such as air physics, which can be accessed from AMD directly here.

  • mrmike_49
    a waste of compute power to model hair - games don't really need this
    Reply
  • clonazepam
    "collision detection is performed to ensure that strands do not pass through one another, or other solid surfaces such as Lara's head, clothing and body"

    Sure, but it will go straight through the seams, so Lara's TressFX hair is constantly decapitating her, going right through the seam where the head connects to the body. I turned it off.
    Reply
  • doron
    11965585 said:
    a waste of compute power to model hair - games don't really need this

    The same can be said about any other eye candy.

    Also, considering the fact that human characters are probably the most unrealistic thing in a game currently, this is a good step forward visually-wise.
    Reply
  • bharatwd
    i agree with mike.........all im seeing is stupid hair......and AA etc.......we dont need all this.....when im gaming honestly.....i dont even remember if her ponytail is tied or flying all over my monitor......they add stupid extras just so u buy new cards...im still very happy with my 4870......it plays everything on medium except crysis......bioshock on 4870 looked amazing................and they have made ppl believe u need 100fps....and everything must be played on ultra to get maximum pleasure.......ull enjoy the game as much as on medium.......and a little over 30fps is more than adequate......even if u have extra money to throw.......i dont see the point when ppl buy 780ti n game on a 1280 monitor........go 2560........that would be a better investment.
    Reply
  • bharatwd
    Next time give me a Bald Lara Croft...will you!!!
    Reply
  • Hashwagon
    "We don't need ragdoll physics in games" You guys that say we don't need this are afraid to be happy. Why not innovate games? Some of us like to be as immersed as possible and I guess you others can stick with black and white monitors with 2D games.
    Reply
  • itheral
    I'm honestly surprised the reaction to this stuff isn't better. In the last 5 years or so graphics have improved a huge amount, but we've been stuck with hair that's barely changed in the last 15 years. Even if it seems like a minor thing, this is a big step, and could be applied to other things as well
    Reply
  • ohim
    @bharatwd like it or not everything evolves, hair might be a small thing, but add it to realistic shadows, specular light etc etc that evolved with every iteration of DirectX or graphics cards and we will eventually enjoy great visuals and maybe great content... otherwise why the hell did you got a 4870 when VGA graphics was enough for decent visuals and game content. Don`t be a hypocrite about it.
    Reply
  • derekullo
    Even with a bald Lara Croft, Dave Croft, they are still going to have to ray trace the ideal shine his or her head would reflect.
    Reply
  • Kewlx25
    Tech moves forward small steps at a time, until there is some critical mass for bunch of related features.

    You don't go from the Earth to the Moon in a single jump, you get there a little bit at a time, but you don't realize how far you have come until you look back and see the small orb you call Earth.
    Reply