I hope shaders is the right word, but I'm referring to the programmable GPU.
What can you actually program with it? Can you write software for it that then runs on the vidcard instead of the CPU?
What kind of commands can you give with it? draw pixel? mathematical functions? Actually that's all I need. draw pixel and mathematical functions is all you need to do anything
[edited by - Lode on August 31, 2002 8:03:16 PM]
you can replace parts of the rastericer-pipeline with own code, written in some fancy assembler (or a highlevel language compiling down to this..)
essencially you can replace the standart t&l unit, as well as the texturing perpixel, so you can expose own perpixel functions there in..
you find much info about this on the web..
"take a look around" - limp bizkit
www.google.com
essencially you can replace the standart t&l unit, as well as the texturing perpixel, so you can expose own perpixel functions there in..
you find much info about this on the web..
"take a look around" - limp bizkit
www.google.com
quote:Original post by Lode
I hope shaders is the right word, but I''m referring to the programmable GPU.
What can you actually program with it? Can you write software for it that then runs on the vidcard instead of the CPU?
What kind of commands can you give with it? draw pixel? mathematical functions? Actually that''s all I need. draw pixel and mathematical functions is all you need to do anything
The Vertex Shader replaces the first stage of the rendering pipeline. You use Draw(Indexed)Primitive to render a list of eg. 1000 triangles. Then the vertex shader gets called for each vertex (point). It basically transforms each point from world space to 2D viewspace. Every point gets lighting values and texture coordinates.
If you use a custom shader, you can adjust the values that are otherwise passed on from the definition of the vertices. Which means that you don''t have to calculate them themselves !
The limitations are that every point is transformed in one call to the shader. This means that it cannot create or delete points, and it cannot access other vertices.
For example, you have a 50x50 mesh of a flat square, the x and y vary between 0 and 5. The z value is always 0. Now your vertex shader takes as input the current time between 0 and 1. This goes from 0 to 1 every second. It can then adjust every z value to sin(x+2*y+t). This will create a rippling surface like water with waves. Add a few values with are combined with different waves, and the water is very natural.
You can also calculate the texture u an v, or the light values dynamically for every point, this saves you from doing it yourself. eg. the light source is passed in a constant, and every point''s light value becomes the dot product of the light vector and the point''s normal vector.
Rock on! Thanks for the interesting replies, so that's how they create these rippling surfaces (like in 3DMark 2002) with vertex shaders.
Another question (with an eye on future cards - I'm wondering if I could ever write a raytracer using pixel shaders): how to get your assembly code loaded on that card? Do you have to use OpenGL or Direct3D for that, or will it work without these?
[edited by - Lode on September 7, 2002 1:13:52 PM]
Another question (with an eye on future cards - I'm wondering if I could ever write a raytracer using pixel shaders): how to get your assembly code loaded on that card? Do you have to use OpenGL or Direct3D for that, or will it work without these?
[edited by - Lode on September 7, 2002 1:13:52 PM]
About the raytracer idea:
I don''t think it''d be possible with the current shaders. In a raytracer, you might need knowledge of the whole scenery for each point and in some cases you need knowledge of past and future frames for doing things like proper movement blur. Perhaps if ATi and nVidia had some more cold war, but not at the moment.
Hey, if you could implement a raytracer on shaders that''d run something only close to some movement for moderately comnplex scenes (implementing funky stuff like caustics, real mirror finish, algorithmic volumetric fog, volumetric lightsources, ...) without requiring a separate room and one or two generators for the card, you''d be something close to a god. Perhaps not "the" god, but some minor diety
I don''t think it''d be possible with the current shaders. In a raytracer, you might need knowledge of the whole scenery for each point and in some cases you need knowledge of past and future frames for doing things like proper movement blur. Perhaps if ATi and nVidia had some more cold war, but not at the moment.
Hey, if you could implement a raytracer on shaders that''d run something only close to some movement for moderately comnplex scenes (implementing funky stuff like caustics, real mirror finish, algorithmic volumetric fog, volumetric lightsources, ...) without requiring a separate room and one or two generators for the card, you''d be something close to a god. Perhaps not "the" god, but some minor diety
Well I still don't know much about shaders, but if you have access to video memory and can make some sort of variables that way - floating point ones by preference, and for the rest do basic math, and you can draw pixels... and have gotos so you can make functions, loops, if's, ..., you could basicly make a sort of raytracer I think. I may be wrong too.
Besides, NVidia's next card should be FULLY programmable :D
[edited by - Lode on September 7, 2002 1:57:39 PM]
Besides, NVidia's next card should be FULLY programmable :D
[edited by - Lode on September 7, 2002 1:57:39 PM]
As far as i know about shaders:
You''ve only got a limited number of variables (16 i think)
''if'' statements are only supported in the latest 1.4 spec (only the high end ATI card at the moment)
Shaders are limited to 127 instructions
Instructions are almost all focused around matrix math.
You want a fully programmable hardware that can do what you want? Its called a CPU GPU''s are fast because they are hevily optimised and orientated on poly rendering, not for other rendering like voxels or raytracing.
_@/
You''ve only got a limited number of variables (16 i think)
''if'' statements are only supported in the latest 1.4 spec (only the high end ATI card at the moment)
Shaders are limited to 127 instructions
Instructions are almost all focused around matrix math.
You want a fully programmable hardware that can do what you want? Its called a CPU GPU''s are fast because they are hevily optimised and orientated on poly rendering, not for other rendering like voxels or raytracing.
_@/
What is it actually that is patented by Microsoft (you know, that thing that will not be in opengl2 anymore)? The whole shader idea? or what? And does nvidia need to pay microsoft for that too?
You don't have gotos, you only have a max of 8 arithmetic instructions (16, with limitations, in version 1.4, which is supported by Radeon 8*** and 9***) and have only two temporary registers (although you can abuse texture registers to get an additional 4) in pixel shaders.
The amount of math you can do is also pretty restrictive, you have to do most functions using texture lookup (i.e. the input parameters for your function are texture coordinates)
That doesn't mean you can't do cool stuff though, I'm currently working on an accurately per-pixel lit scene in realtime using vertex & pixel shaders, but it'll be a few weeks until I have it done. Ray tracers are still a bit too much though I'd say.
- JQ
Full Speed Games. Coming soon.
[edited by - JonnyQuest on September 9, 2002 4:57:47 AM]
The amount of math you can do is also pretty restrictive, you have to do most functions using texture lookup (i.e. the input parameters for your function are texture coordinates)
That doesn't mean you can't do cool stuff though, I'm currently working on an accurately per-pixel lit scene in realtime using vertex & pixel shaders, but it'll be a few weeks until I have it done. Ray tracers are still a bit too much though I'd say.
- JQ
Full Speed Games. Coming soon.
[edited by - JonnyQuest on September 9, 2002 4:57:47 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement