Slashdot Mirror


NVIDIA's Pixel & Vertex Shading Language

Barkhausen Criterion writes "NVIDIA have announced a high-level Pixel and Vertex Shading language developed in conjunction with Microsoft. According to this initial look, the "Cg Compiler" compiles high level Pixel and Vertex Shader language into low-level DirectX and OpenGL code. While the press releases are going amok, CG Channel (Computer Graphics Channel) has the most comprehensive look at the technology. The article writes, "Putting on my speculative hat, the motivation is to drive hardware sales by increasing the prevalence of Pixel and Vertex Shader-enabled applications and gaming titles. This would be accomplished by creating a forward-compatible tool for developers to fully utilize the advanced features of current GPUs, and future GPUs/VPUs." "

20 of 263 comments (clear)

  1. Hype or innovation? by moonbender · · Score: 3, Insightful

    You've got to wonder, is this yet another load of Nvidia corporate hype (a la "HW TnL will revolutionise gaming"), or is this useful technology? I wouldn't trust any of the current articles on answering that, judging by the previous Nvidia hypes, it takes a few months till anyone really knows if this is good or bad.

    --
    Switch back to Slashdot's D1 system.
    1. Re:Hype or innovation? by UnknownSoldier · · Score: 3, Interesting

      > You've got to wonder, is this yet another load of Nvidia corporate hype (a la "HW TnL will revolutionise gaming")

      Have you *even* done *any* 3d graphics programming?? HW TnL *offloads* work from the CPU to the GPU. The CPU is then free to spend on other things, such as AI. Work smarter, not harder.

      I'm not sure what type of revolution you were expecting. Maybe you were expecting a much higher poly count with HW TnL, like 10x. The point is, we did get faster processing. Software TnL just isn't going to get the same high poly count that we're starting to see in today's games with HW TnL.

      > it takes a few months till anyone really knows if this is good or bad.

      If it means you don't have to waste your time writing *two* shaders (one for DX, and other for OpenGL) then that is a GOOD THING.

    2. Re:Hype or innovation? by Pulzar · · Score: 3, Insightful

      Have you seen what ID has been up to lately?

      Have you read about how much effort JC has put into pushing polygons in Doom 3? We're hardly at a point where companies don't have to worry about speed issues..

      If anything, companies have to put in even more effort into producing some stunning results, because everybody has been spoiled by recent titles.

      --
      Never underestimate the bandwidth of a 747 filled with CD-ROMs.
    3. Re:Hype or innovation? by friedmud · · Score: 4, Insightful

      "If it means you don't have to waste your time writing *two* shaders (one for DX, and other for OpenGL) then that is a GOOD THING."

      Even better then that! It means you don't have to waste your time writing *4* shaders:

      Nvidia/DirectX
      Nvidia/OpenGL
      ATI/DirectX
      ATI/ OpenGL

      That is of course, pending a compiler for ATI cards - but I don't think it will be long... Unless ATI holds out for OpenGL2 - but in between now and when OGL2 comes out there is a lot of time to lose maket share to Nvidia because people are writing all of their shaders in Cg - and ATI is getting left out in the rain....

      So I would expect ATI to jump on this bandwagon - and quick!

      Derek

  2. Re:Linux Support by friedmud · · Score: 3, Informative

    What are you talking about?? Nvidia makes great linux drivers - and from looking through the pages it looks to me like Cg just outputs regular OpenGL (Well - Nvidia-OpenGL anyway) so I would venture a guess that any of these will run just fine on the nvidia linux drivers.

    My only problem is that the toolkit itself is only for windows :-(

    Anyone try it with Wine/Winex yet?? I might when I get home.

    Derek

  3. This could be really good. by Steveftoth · · Score: 3, Informative

    According to the web site, they are working to implement this on top of both OpenGL and DirectX. On linux and Mac as well.
    Basically this is a wrapper for the assembly that you would have to write if you were going to write a shader program. It compiles a C-like (as in look a like ) language into either the DirectX shader program or the OpenGL shader program. So you'll need a compiler for each and every API that you want to support. Which means that you'll need a different compiler for OpenGL/Nvidia and OpenGL/ATI until they standardize it.

    On a more technical note, the lack of branching in vertex/pixel shaders really needs to be fixed, it's really the only feature that they need to add to them. Which is why the Cg code looks so strange, it's C, but there's no loops.

  4. Assembly vs. High-level? hmmm.... by rob-fu · · Score: 3, Funny

    That's like asking which of the following would I rather do...

    a) have a 3-way with two hot chicks
    b) clean the floor behind my refrigerator

    I wonder.

  5. Re:Pixel and Vertex Shading and OpenGL2.0? by alriddoch · · Score: 3, Informative

    It seems to me that this is probably an attempt to kill OpenGL 2.0, and secure Direct X as the dominant 3D API. OpenGL 2.0 has as far as I can tell been well thought out, and most of the feedback to it has been very positive. The frontend to its shader language is Free Software, and the work done seems to have been done with the best of intentions. I am very cynical about an offering from NVIDIA, especially when you consider their behavoir towards the rest of the 3D card market, and the fact that Microsoft are involved.

  6. In Fact...... by friedmud · · Score: 3, Informative

    From Nvidia's Homepage you can check out the press releases and find this:

    "NVIDIA's Cg Compiler is also cross platform, supporting programs written for Windows®, OS X, Linux, Mac and Xbox®."

    So maybe even though the tools aren't cross platform - the compiler is. I think this is a Great step forward towards OpenGL 2.0 - this is showing that Windows doesn't have to be the only platform to write graphically intensive applications for.

    Derek

  7. Re:3dfx/Glide part 2? by Dark+Nexus · · Score: 4, Informative

    Well, they're quoted in this article on ZDNet (the quote is near the bottom) as saying that they're going to release the language base so other chip makers can write their own compilers for their products.

    That was the first thing that popped into my head when I read this article, but it sounds like they're going to give open access to the standards, just not to the interface with their chips.

    --
    Dark Nexus
    "Sanity is calming, but madness is more interesting."
  8. Inefficiencies by Have+Blue · · Score: 5, Interesting

    One of these days, nVidia will ship a GPU whose functionality is a proper superset of that of a traditional CPU and then we can ditch the CPU entirely. Just like MMX, but backwards. This is a a recognized law of engineering. At that point, Cg will have to become a "real" compiler. Let's hope nVidia is up to the task...

    1. Re:Inefficiencies by Have+Blue · · Score: 3, Insightful

      I am being completely serious. A modern computer is an asymmetric dual-processor system. GPUs are already at least as complex as CPUs, and when the shader language becomes Turing-complete (when jumps, conditionals, and some other things are added) the GPU will be a CPU and it will be pointless to ship a computer with 2 unequal general-purpose CPUs.

    2. Re:Inefficiencies by doop · · Score: 3, Interesting

      They're already heading that way; the Register had an article describing some work being done to do general raycasting in hardware. I guess it's heading towards turning graphics cards into boards full of many highly parallel mini-CPUs, since vertex and/or pixel shading are rather parallelizable in comparison to other things the main CPU might be doing. Of course, OpenGL is already a sufficiently versatile system that one can implement Conway's Life using the stencil buffer, so for a sufficiently large buffer, you could implement a Turing machine; I don't know how much (if any) acceleration you'd get out of the hardware, though.

  9. other hardware shading languages by mysticbob · · Score: 4, Interesting
    there's already lots of other shading stuff out there, nvidia's hardly first. at least two other hardware shading languages exist. these languages allow c-like coding, and convert that into platform-specific stuffs. unfortunately, none of the things being marketed here, or now by nvidia, are really cross-platform. references: of course, the progenitor of all these, conceptually, is renderman's shading language.

    hopefully, opengl2's shading will become standard, and mitigate the cross-platform differences. it's seemingly a much better option than this new thing by nvidia, but we'll have to wait and see what does well in the marketplace, and with developers.

  10. What Cg means by Effugas · · Score: 5, Informative

    Seems like a decent number of people have absolutely no clue what Cg is all about, so I'll see if I can clear up some of the confusion:

    Modern NVidia(and ATI) GPU's can execute decently complex instruction sets on the polygons they're set to render, as well as the actual pixels rendered either direct to screen or on the texture placed on a particular poly. The idea is to run your code as close to the actual rendering as possible -- you've got massive logic being deployed to quickly convert your datasets into some lit scene from a given perspective; might as well run a few custom instructions while we're in there.

    There's a shit-ton of flexibility lost -- you can't throw a P4 into the middle of a rendering pipeline -- but in return, you get to stream the massive amounts of data that the GPU has computed in hardware through your own custom-designed "software" filter, all within the video card.

    For practical applications, some of the best work I've seen with realtime hair uses vertex shaders to smoothly deform straight lines into flowing, flexible segments. From pixel shaders, we're starting to see volume rendering of actual MRI data that used to take quite some time to calculate instead happening *in realtime*.

    It's a bit creepy to see a person's head, hit C, and immediately a clip plane slices the top of guy's scalp off and you're lookin' at a brain.

    Now, these shaders are powerful, but by nature of where they're deployed, they're quite limited. You've got maybe a couple dozen assembly instructions that implement "useful" features -- dot products, reciprocal square roots, adds, multiplies, all in the register domain. It's not a general purpose instruction set, and you can't use it all you like: There's a fixed limit as to how many instructions you may use within a given shader, and though it varies between the two types, you've only got space for a couple dozen.

    If you know anything about compilers, you know that they're not particularly well known for packing the most power per instruction. Though there's been some support for a while for dynamically adjusting shaders according to required features, they've been more assembly-packing toolkits than true compilers.

    Cg appears different. If you didn't notice, Cg bears more than a passing resemblance to Renderman, the industry standard language for expressing how a material should react to being hit with a light source. (I'm oversimplifying horrifically, but heh.) Renderman surfaces are historically done in software *very, very* slowly -- this is a language optimized for the transformation of useful mathematical algorithms into something you can texture your polys with...speed isn't the concern, quality above all else is.

    Last year, NVidia demonstrated rendering the Final Fantasy movie, in realtime, on their highest end card at the time. They hadn't just taken the scene data, reduced the density by an order of magnitude, and spit the polys on screen. They actually managed to compile a number of the Renderman shaders into the assembly language their cards could understand, and ran them for the realtime render.

    To be honest, it was a bit underwhelming -- they really overhyped it; it did not look like the movie by any stretch of the imagination. But clearly they learned alot, and Cg is the fruits of that project. Whereas a hell of alot more has been written in Renderman than in strange shader assembly languages (yes, I've been trying to learn these lately, for *really* strange reasons), Cg could have a pretty interesting impact in what we see out of games.

    A couple people have talked about Cg on non-nVidia cards. Don't worry. DirectX shaders are a standard; game authors don't need to worry about what card they're using, they simply declare the shader version they're operating against and the card can implement the rest using the open spec. So something compiled to shader language from Cg will work on all compliant cards.

    Hopefully this helps?

    Yours Truly,

    Dan Kaminsky
    DoxPara Research
    http://www.doxpara.com

    1. Re:What Cg means by SanLouBlues · · Score: 4, Informative

      All one needs for volumetric rendering ("voxels") is 3d texturing capability.

    2. Re:What Cg means by Effugas · · Score: 4, Informative

      Depends on your approach. Klaus Engel and company are all sorts of interesting isosurface and direct volume rendering in realtime of really high detail models -- check out:

      http://wwwvis.informatik.uni-stuttgart.de/~engel /p re-integrated/

      That's being done in realtime. They're doing more than just slapping slices on top of eachother and letting 'em alpha blend. :-)

      --Dan

  11. Re:Analogy by ThrasherTT · · Score: 3, Interesting

    You missed the main point of Cg:

    Vertex Shader ASM is hard(er than Cg)
    Pixel Shader ASM is hard(er than Cg)

    My understanding of Cg is that it'll be used as a shader replacement, NOT an OpenGL replacement. You'll still have to write tons and tons of OGL. Now you can just simplify the SHADER part.

    --

    All Your Memory Are Belong To Java
  12. OpenGL 2.0 by XenonOfArcticus · · Score: 3, Insightful

    IMHO, OpenGL 2.0 is more portable, less NVidia-specific and backed by more manufacturers. Cg is a ripoff of OpenGL 2.0's design, in a cheap attempt to turn it into a NVidia/Microsoft controlled standard.

    Remember, NVidia may be good now, but they got where they were by being competitive and overturning old-guard 3D guys (like 3DFX who were themselves trying to lock the industry in to APIs they controlled).

    Competition=good.
    Single-vendor-controlled APIs=bad.
    OpenGL2.0=good.

    Now, Ilike my NVidia hardware as much as the next guy, but I fear lock-in. Seems like most of us have already experienced the downsides of lock-in.

    Yes, NVidia is talking up the buzzwords "portable" and "vendor-neutral" but if that's what they were after, the wouldn't have created Cg at all, they would have gone with the already-available open standard, OpenGL2.0. This is embrace, extend and extinguish.

    --
    -- There is no truth. There is only Perception. To Percieve is to Exist.
  13. If a dual CPU system had the kind by Steveftoth · · Score: 3, Interesting

    of bandwidth that the average graphics card has then it would.
    Also don't forget that a GPU has more transistors then the average cpu these days.
    The VGA -> CPU interface was SLOWWWWW. In fact it's still slow, that's why AGP (X8) was invented and that's even slow. The graphics cards have larger buses, and are designed to push data to the DAC.
    All you need is more bandwith for the CPU and you're set.