NVidia announces Cg: "C" for Graphics
mr_sheel writes: "Thresh's FiringSquad has an article about Cg, a new language developed by NVidia in collaboration with Microsoft. 'Up until now,' Brandon Bell writes, 'game developers have had to use complex assembly language to create the lifelike graphics gamers experience in today's latest games.' Cg eases the process of bringing graphics to the screen and compiles for DirectX 8,9 and OpenGL 1.4. Many companies, including 3D Studio Max, Blizzard, and over 100 game developers, have already jumped onto the Cg bandwagon. Will this replace assembly graphics coding once and for all?"
Hmmm. Maybe he meant to post a story about QuakeCon. Registration started last night.
It was me, I did it, I moved your cheese
Why make a new language with it's own compiler for this? Wouldn't it make much more sense to make some libraries?
At flipcode.com
-m
Will this replace assembly graphics coding once and for all?
What on earth are you talking about? This will be a requirement... ALWAYS. You know why? Because nVidia is only one company. Not everyone conforms to their "standards". This is good especially because they are in bed with Microsoft. They are a conduit for MS to control the graphics market as nVidia are up for sale to the highest bidder.
So, what do you do when you want to strengthen control on a market? You introduce a new language that makes it easier for developers to take advantage of one piece of hardware on your platform!
No, this will NOT replace ASM for driver/graphics engine development. It should be disregarded because there's nothing standard about it. Hopefully, the leaders in the industry will always support chipsets other than nVidia's.
Why bother.
Whomever wrote that article may understand 3D, but doesn't understand where shaders fit in and the history and experience already here. Pixel and Vertex shaders have been around since the inception of commercial 3D in the form of Renderman surface and displacement shaders. They are small and very modular programs which don't need access to a large amount of information at one time. Thus because of the implied modularity, and the isolation of the calculations relative to the rest of the scene there is no need for OO (I know you didn't mention it, but someone in the FIRST story about this did, and its a good question), and no real need for pointers.
Furthermore because of the very analog nature of what is being descibed, control statements and desicion shortcuts aren't a very big deal. Of course there are if else statements, but they are not used as much as simple and very general algorithms. Hard desicions lead to aliasing, because they rule out a gradual change. Also because of the analog nature of what is being reproduced integers are used very rarely, almost exclusivly for loop counters.
Using float indices for arrays is a kick ass design descision. It allows for smooth and elegant interpolation between discreet values, and I can't stress what a cool idea that is.
In short, the register is wrong, and this IS a formula for a widespread language, because it is copying another very mature widespread language, the Renderman shading language. The only thing I am worried about is that it will be geared towards only Nvidia products, thus competing with OpenGL 2.0 (whenever the vapor settles).
Keep in mind that I am not trying to argue you, but I am trying to argue the register's stance. The designers of Nvidia are very aware of the vast history of Renderman I am sure, and this language looks just fine.
For anyone who wants to get into writing shaders, the book 'Advanced Renderman: Creating CGI for motion pictures' by Anthony Apodaca and Larry Gritz is your bible. it covers everything you need to know and more, and I highly recommend it.
This Wiki Feeds You TV and Anime - vidwiki.org
ENOUGH!
This has nothing to do with raw x86 assembly! This isn't doing graphics programming in raw assembly!
There is an assembly-like language for writing vertex and pixel shaders on nVidia and ATI GPUs. Your entire program could be nothing but high-level calls to DirectX 8 or OpenGL 1.4 in C++, but if you want to take advantage of the ability of the Geforce3, Geforce4 (but not Geforce4 MX), and recent ATI cards, to do custom pixel and vertex shaders, you have to write said pixel and vertex shaders in a small assembly-like language, and use DirextX or OpenGL calls to load them into the GPU. These shaders get used by the card's GPU, and has absolutely nothing to do with the CPU.
The idea here is that instead of writing your pixel or vertex shaders in something similar to assembly (again, it *ISN'T* assembly), you can write them in something similar to C, and the Cg compiler will compile your shaders into machine code for the GPU (Graphics Processing Unit; it's on the GeForce3, GeForce4 (but not GeForce4 MX), and recent ATI cards), not the CPU!
Writing shaders in this assembly-like language for the GPU is nothing like trying to do graphics in x86 assembly back in the day, ok?
No integers. This may be appropriate to NVIDIA, but is not a universal design decision.
Arrays use float indices. This is an odd design decision, relevant to DirectX 8 and Nvidia only.
Without ints what else would you use?
Trees can't go dancing
So do them a big favor
Pretend dancing stinks!