• Advertisement

Archived

This topic is now archived and is closed to further replies.

Vertex programs

This topic is 5525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I went through nVidia''s code on refraction and I came across something like this, so I figured - nVidia, that figures - and took up the next neat demo on vertex programs that I seem to''ve downloaded, and again:
  
const unsigned char SubCausticProgram[]=
{
"!!VP1.0"

//Convert Vertex position into clip space, using combined matrix. (modelview and projection)

"DP4 o[HPOS].x,v[0],c[4];\
 DP4 o[HPOS].y,v[0],c[5];\
 DP4 o[HPOS].z,v[0],c[6];\
 DP4 o[HPOS].w,v[0],c[7];"

//Transform the normals from local to world! Using inverse transpose of the modelview matrix.


//"DP3 R0.x,v[NRML],c[12];"		//Commented out, cos we dont need it!


"DP3 o[COL1].xyz,v[NRML],c[13];"	//Store Y component on transformed normal into secondary color.


//"DP3 R0.z,v[NRML],c[14];"		//Commented out, cos we dont need it!



//Write the color straight out.

"MOV o[COL0],v[COL0];"

//Move the X and Z components into the S and T components of the base texture.

"MUL o[TEX1].x,v[0].x,c[19].y;\
 MUL o[TEX1].y,v[0].z,c[19].y;"

"END"
};
  
This is taken from a caustics underwater demo I''ve no idea where I''ve downloaded from. The above excerpt looks slighly like Assembly at the first glance, but no - it''s a bunch of strings. Then again... What is it? Crispy

Share this post


Link to post
Share on other sites
Advertisement
Looks like a vertex shader.
EDIT: Realized you already knew that

[edited by - Tron3k on December 7, 2002 8:24:33 PM]

Share this post


Link to post
Share on other sites
It''s a vertex program for use with the NV_vertex_program extension.

Share this post


Link to post
Share on other sites
Hey Crispy, I was kidding when I told you to implement refractions

yup it is a vertex program. Because it''s for the NV_vertex_program extension, I bet that it will work only on NVIDIA cards. And it will be hardware-accelerated on GeForce3 or greater.

If you want to deal with them, you have to know that there exists ARB_vertex_program too that is implemented on all cards (not only NVIDIA), at least in theory. As you may guess by yourself, ARB_vertex_program and NV_vertex_program are very similar.

Share this post


Link to post
Share on other sites
quote:
Original post by vincoof
Hey Crispy, I was kidding when I told you to implement refractions



I wasn''t thinking big, really - just that it would be double nice if the water (surface) also refracted light - didn''t seem at all that difficult after I''d stared at the code for a little while. Basically, the vertex program itself was the only thing I didn''t quite understand - the rest didn''t seem at all that difficult...

quote:

And it will be hardware-accelerated on GeForce3 or greater.



Are you sure about that? Just ran a refractions demo that uses vertex programs, register compiners and cube mapping on a gf2...

quote:

If you want to deal with them, you have to know that there exists ARB_vertex_program too that is implemented on all cards (not only NVIDIA), at least in theory. As you may guess by yourself, ARB_vertex_program and NV_vertex_program are very similar.


Yeah I noticed that. Why do they (nVidia) have to have their own implementation of everything when there''s a crossvendor standard present? They''re virually the same, aren''t they?

Crispy

Share this post


Link to post
Share on other sites
quote:
Just ran a refractions demo that uses vertex programs, register compiners and cube mapping on a gf2...

Yes you can, but the vertex program is processed in software. Hopefully the drivers are very well optimized, but every NV1x chipset (GeForce2 for instance) do it in software.

quote:
Why do they (nVidia) have to have their own implementation of everything when there's a crossvendor standard present?

Simply because NVIDIA wrote this extension 3 years ago and didn't want to wait for the ARB extension written in 2002.

quote:
They're virually the same, aren't they?

Not exactly, though there's alot of similar points. In fact, ARB_vertex_program is a mix between NV_vertex_program and ATI_vertex_shader, and ARB_vertex_program is roughly built ~80% from NV_vertex_program and ~20% from ATI_vertex_shader (évidemment ce ne sont pas des chiffres officiels!).

[edited by - vincoof on December 9, 2002 1:49:07 PM]

Share this post


Link to post
Share on other sites
Just a thought- would you mind an ARB_vertex_program example that would speed up one of existing NeHe tutorials ?

Share this post


Link to post
Share on other sites
quote:
Original post by vincoof
Just a thought- would you mind an ARB_vertex_program example that would speed up one of existing NeHe tutorials ?


I''m not completely sure what you''re saying. Are you saying you''d like to "enhance" one of NeHe''s tutorials with vertex programs? If so, that would be just plain awesome - may I suggest writing a refractions demo j/k - I''d like to crack this one myself (from a purely personal pov) - besides it also involves cubemaps and register combiners if you want to add fresnel and other neat effects to the simpler single-pass solution.

I''ve been wondering for a little while now why people that have 1) a decent gpu, 2) the time, haven''t written extension-specific tutorials for sites such as this... Then again, people who have more knowledge are most likely also more busy. Comes with the turf, I suppose...

Crispy

Share this post


Link to post
Share on other sites
quote:
Are you saying you''d like to "enhance" one of NeHe''s tutorials with vertex programs?

yup. currently I''m thinking of the cel-shading tutorial which is a very good example of where vertex programs really help. I think I''ll submit to NeHe if I find some webspace to store the zip file.

quote:
I''ve been wondering for a little while now why people that have 1) a decent gpu, 2) the time, haven''t written extension-specific tutorials for sites such as this...

If you mean tutorials that go further than the OpenGL core, there are a few reasons, the most important being IMHO :
- you don''t need to get involved into OpenGL advanced features if you still lack some basis,
- people that don''t have a recent/decent graphics card will not be able to run the demo/tutorial,
- it''s pretty rare to find someone willing to explain a complex feature (lack of time, lack of knowledge...),
- some vendor-specific extension should not be detailed for the sake of fairness.
Anyway if you want a short insight of OpenGL extensions mechanism, NeHe still hosts a bumpmapping tutorial (yes it looks crap today but back in the earlier days of 3D it was not bad at all) that uses few basic extensions such as ARB_multitexture.

quote:
Then again, people who have more knowledge are most likely also more busy.

Even though this site is full of newbies, be sure that there is alot of experienced ppl lurking around the forums, and some of those very talented guys don''t even work for professional 3D programs ! I really wonder how they do

Share this post


Link to post
Share on other sites
ok I''ve sent the file to NeHe. If everything''s alright, you''ll be able to download it in a few days at http://nehe.gamedev.net along with some documentation that explains the vertex program I''ve used.
I''ve tried to be as clear as possible ; you don''t need any particular knowledge to understand it (except a bit of OpenGL of course ) !
Let''s hope you''ll find it useful.

Share this post


Link to post
Share on other sites
Just an addendum for Linux coders : a Linux version of ARB vertex programs is now available at NeHe Productions in the News section, source code included of course.

Share this post


Link to post
Share on other sites
i look like some kind of assembaly language.
the "!!VP1.0" would indicate a Virtual Prosessor of some kind. maby its a Java assembaly or something???


- Jono AH

Share this post


Link to post
Share on other sites
''VP'' stands for ''Vertex Program''. It looks like assembly because it''s a very low-level language which is meant to be fast and simple, and nothing''s better than assembly for that purpose.

There are *only* twenty-seven (27) instructions designed for graphics processing, so it''s really a simple language.

Share this post


Link to post
Share on other sites
Something completely off-topic - if I remember correctly they only eight symbols in the native Hawaiian language (Hawaiian?) - now there''s a simple language.

Crispy

Share this post


Link to post
Share on other sites

  • Advertisement