Cg == vertex programs

Does the Cg-Compiler just create a vp?

Thanks!

in case of openGL yes. for dx3d it also creates pixelshaders.

Does it make sense to begin on how to write vertex programs with this asm language or should I better start learning Cg, because it is more advanced? But what I heard: David Kirk said, that Cg is just a beginning.

So, what is the deal? Cg or vp?

I would use Cg because it’s easier. When you start seeing the OpenGL extensions that support the CineFX shading architecture, you’ll really see the need for the higher-level shading language.

Thanks -
Cass

you could also try OpenGL 2.0 HLSL.

there are couple of discussions about this topic on this forum… just search for “CG” or “OpenGL 2.0” and you’ll see how controversal this quesion is…

my own opinion: cg isn’t complete yet (with opengl you are also forced to use nvparse).
that’s not a good solution for me. i still end up with different apis, different syntax to get my programms running. so i am still using VP(vertex programms) + RC(register compiners) + FS(fragment shaders) because there are more flexible for me (and because i am very familiar with assembler-languages and direct hw-programming…)

@AdrianD:
For what do you use RC? Like for perpixel-lighting or BumpMapping? Is there also a way to do e.g. bumpmapping then with vp?

OpenGL(RC + FS) == DirectX(PixelShader)

take a look at the nvidia presentations about this topic. (or search this forum for “Register Combiners”)

Originally posted by AdrianD:
[b]OpenGL(RC + FS) == DirectX(PixelShader)

take a look at the nvidia presentations about this topic. (or search this forum for “Register Combiners”)[/b]

maybe this is a dumb question,
but what are fragment shaders in OpenGL,
i mean what does the “FS” part do that
register combiners “RC” do not do?
i always thought OpenGL(RC) = DX(PS)
instead of OpenGL(RC+FS) = DX(PS)

??

thanks,
mtm

I think he means that you would use Reg Combiners on nVidia hardware, and Frag Shaders on ATI… these together equal the cross-hardware ability of pixelshaders in D3D

As far as doing bumpmapping with vp’s… you would use a vp to set up for bumpmapping, but you still need per-pixel/fragment control to do it (and therefore RCs or FS)

[This message has been edited by BadMmonkey (edited 08-05-2002).]

I’m pretty sure that he really meant “texture shader”, not “fragment shader”. The ATI_fragment_shader extension is, obviously, an ATI-specific extension.

RegCombiners and TexShaders are NVidia specific extensions, y’know?
There’s not vendor independent pixel shader interface in opengl yet.

no, i called “Fragment shaders” what is provided with NV_texture_shader extensions.
i checked the naming conventions in the extension specs…
i should call it “texture shader”.
sorry for this confusion.

Originally posted by BadMmonkey:
As far as doing bumpmapping with vp’s… you would use a vp to set up for bumpmapping, but you still need per-pixel/fragment control to do it (and therefore RCs or FS)
[This message has been edited by BadMmonkey (edited 08-05-2002).]

Hmmm…, do you or anybody else know a neat pointer for more information about this?

Take a look at the NVIDIA OpenGL SDK. Look especially in the folder:
doc\presentations\

there are plenty presentations about VP’s RC’s and per-pixel lighting (incl. bump & reflection stuff)

Thanks, AdrianD.

A027298,
you should start with Cg since is simpler and easier code to read, and after that you can use Cg compiler to produce the VP assembler code behind the Cg source for nv_vertex_program study

Thanks, but to come back to my question. Cg creates vp code. And so Cg is a language on a higher level. But there are also a whole bunch on other shading languages, like Renderman, or like the Stanford Real-Time Procedural Shading System, or ISL for instance. Can you also say, that those languages are (existing) software applied to vertex/pixel shaders? (I hope not everybody is confused now)

I’ve recently been wrestling with these problems. I’ve written a new engine that is capable of using DirectX OR OpenGL. I’ve decided to go with Cg as a fundamental in the shader classes because I can use the same shading code (more or less - for vertex shaders anyway) in GL and DX.