PDA

View Full Version : Cg == vertex programs



A027298
08-05-2002, 05:53 AM
Does the Cg-Compiler just create a vp?

Thanks!

AdrianD
08-05-2002, 06:54 AM
in case of openGL yes. for dx3d it also creates pixelshaders.

A027298
08-05-2002, 07:06 AM
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?

cass
08-05-2002, 10:40 AM
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

AdrianD
08-05-2002, 10:54 AM
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...)

A027298
08-05-2002, 11:26 AM
@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?

AdrianD
08-05-2002, 12:54 PM
OpenGL(RC + FS) == DirectX(PixelShader)

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

tweakoz
08-05-2002, 03:55 PM
Originally posted by AdrianD:
OpenGL(RC + FS) == DirectX(PixelShader)

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

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

BadMmonkey
08-05-2002, 04:32 PM
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).]

Korval
08-05-2002, 04:37 PM
I'm pretty sure that he really meant "texture shader", not "fragment shader". The ATI_fragment_shader extension is, obviously, an ATI-specific extension.

knackered
08-05-2002, 11:56 PM
RegCombiners and TexShaders are NVidia specific extensions, y'know?
There's not vendor independent pixel shader interface in opengl yet.

AdrianD
08-06-2002, 04:28 AM
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.

A027298
08-06-2002, 04:51 AM
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?

AdrianD
08-06-2002, 05:01 AM
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)

A027298
08-06-2002, 05:51 AM
Thanks, AdrianD.

Licu
08-07-2002, 01:17 AM
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

A027298
08-07-2002, 04:32 AM
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)

Robbo
08-08-2002, 01:27 AM
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.