Game Development Community

Hlsl and cg??

by Daniel Brown · in Technical Issues · 06/05/2004 (3:20 am) · 6 replies

Well with the coming of TSE, I thought I might start delving into some shader programming, not just for TSE but just so I can say I can :)

Firstly, I what is the difference between cg and hlsl? Which one is supposedly better? Also Im playing around with composerFX at the moment, but it only seems to save the shader material out as .FX? is there a way to get it to hlsl to use in Torque?

#1
06/05/2004 (7:52 am)
Cg and hlsl are basically the same language, they just have a different coordinate system. I really like cg because it works in opengl and directx with nvidia and ati cards while hlsl only works in directx with nvidia and ati cards.

You might want to look into a program that lets you design your shaders in hlsl or cg. I think there are a few out there but I have never used them.
#2
06/05/2004 (8:13 am)
If you open up those .fx files as text files, you should find the HLSL programs inside. A .fx file is usually a shader plus some texture stage setup parameters.
#3
06/05/2004 (8:45 am)
I like the sound of Cg actually, is there any chance of TSE supporting it? or just hlsl?
#4
06/05/2004 (9:18 am)
Same, i'd perfer CG because it supports opengl, thus making it IMO more stable and cross-platform, as directx is not because its developed by satan himself!
#5
06/05/2004 (9:44 am)
We currently support HLSL because (a) it's integrated with DirectX 9, which is the only renderer we support at the moment, and (b) because it seems to have the most development effort behind it. Cg, being nVidia's baby, tends not to get tested as reliably on ATI parts. GLSL might be more interesting, since in theory it should be supported by all GL drivers...

But of course, both of those are moot until we have OpenGL support - one reason we're waiting on that is we want it to mature a bit more.
#6
06/05/2004 (12:55 pm)
Ben's response does a good job summing up TSE's approach to the high-level shading languages. For more information on the high-level sl's in general (but having nothing to do with TSE atm) check this old post. Some of the info there on GLSlang is actually a little bit out of date now, but nothing too horrible.