PDA

View Full Version : question about vertex shader



virtual
27-02-2010, 10:15 PM
hi

i am new in DX vertex shader , from my reading i understand that Vertex Shader control the rendering pipline ( transformation , lighting )

whats the major deference between a program work with VS and other with fixed function pipline ?

dose VS capable for things that FFP could not ?

chronozphere
28-02-2010, 03:05 AM
A vertex shader allows you to "program" the vertex behaviour of your graphics. You could apply some formula's to achieve specific effects (like a waving surface, your own vertex lighting etc).. FFP doesn't provide this kind of flexibility.

virtual
28-02-2010, 09:55 AM
thats true

but waving surface without VS is possible too !

NecroDOME
28-02-2010, 12:13 PM
The big difference is that you can for example add extra texture coordinates, calculate normals etc in the vertex shader so you don't have to calculate them in your program, saving bandwidth so your vertex structure can be smaller.
But mostly you will end up using a vertex shader that also can be done in the FFPL.
But it simply gives you more flexibility.

User137
28-02-2010, 03:19 PM
Doesn't the big difference come to using pixel-shader?

NecroDOME
28-02-2010, 03:19 PM
Mostly yes.

virtual
28-02-2010, 05:28 PM
thnx

i've seen alot of great demo scene using vertex shader and the effects were amazing ,

do you think is it possible to produce a high quality effect without VS ?

NecroDOME
28-02-2010, 05:30 PM
Yes, but I think it would be slower.

tpascal
01-03-2010, 04:58 PM
There is only one thing i dislike About vertex shaders (well, when you are going to use one for first time)...you dont have one working by default; >:( i mean, with the fixed pipeline you already have working functions to apply multiple textures with several blend options, vertex world/view transformations, per vertex lighting with matyerials settings, etc...the basic stuff you need to render thousand triangles textured and lightened; but if you say "humm, i would like to add a wave effect...i am going to write a shader for that..." forget it, beside the wave effect you also have to code your self in the shader any function you was using from the fixed pipeline, you cant combine boths, when you switch to shaders, you have to code everithing needed for render a vertex: transformations, textures, blending effects, colors, lighting maths, etc. :'(

Beside that, once you have one basic vertex shader coded and working for doing basic stuff, then you will want to do everithing in shaders, :yes: and none in cpu, ::)

Brainer
01-03-2010, 09:07 PM
Don't forget about CUDA. ;)

NecroDOME
02-03-2010, 08:43 AM
@tpascal: if you try XNA you have a vertex and pixel shader that work at start :), just tried it a few days ago.

This is what XNA gives you as vertex shader:


VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;

float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);

// TODO: add your vertex shader code here.

return output;
}

JSoftware
02-03-2010, 09:08 AM
There is only one thing i dislike About vertex shaders (well, when you are going to use one for first time)...you dont have one working by default; >:( i mean, with the fixed pipeline you already have working functions to apply multiple textures with several blend options, vertex world/view transformations, per vertex lighting with matyerials settings, etc...the basic stuff you need to render thousand triangles textured and lightened; but if you say "humm, i would like to add a wave effect...i am going to write a shader for that..." forget it, beside the wave effect you also have to code your self in the shader any function you was using from the fixed pipeline, you cant combine boths, when you switch to shaders, you have to code everithing needed for render a vertex: transformations, textures, blending effects, colors, lighting maths, etc. :'(

Beside that, once you have one basic vertex shader coded and working for doing basic stuff, then you will want to do everithing in shaders, :yes: and none in cpu, ::)




I'm actually pretty sure there's an instruction which can make it do that(in GLSL)

NecroDOME
02-03-2010, 09:13 AM
Not sure, but I recall reading something about it... at microsoft site... (in HLSL)