Jump to content
  • Advertisement
Sign in to follow this  
discman1028

Pixel Shader vs Fragment Shader

This topic is 4383 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

Are they just synonyms? A friend of mine uses Cg (I use HLSL) and he says the term pixel shader "doesn't exist". This (old) article says "fragment vertex processing" is used to do constrained vertex processing (reduce the # of possible shader combinations needed). Is that a different idea?

Share this post


Link to post
Share on other sites
Advertisement
The "pixel" in "pixel shader" is a misnomer because the pixel shader doesn't operate on pixels directly. The pixel shader operates on "fragments" which may or may not end up as actual pixels, depending on several factors outside of the pixel shader.

Unfortunately, the terms "pixel shader" and "binormal" (also a misnomer -- it should be "bitangent") are here to stay.

Share this post


Link to post
Share on other sites
I think everyone pretty much refers to vertex shader or vertex program. "Fragment vertex processing" doesn't make much sense, because it's not like vertices have seperate fragments or something, like pixels can. Although, I guess a person could make an argument about a vertex program only modifying certain parts of a set of vertex streams or something, but that would just be arguing for the sake of arguing, I think.

Share this post


Link to post
Share on other sites
Quote:
I think everyone pretty much refers to vertex shader or vertex program. "Fragment vertex processing" doesn't make much sense


From my brief scan of the article linked it appears 'fragment vertex processing' refers to writing several bits of vertex programs (i.e. fragments of programs) that each do a different thing, so you'd have some to do transforms (this may change if you're using skinning for animation in one model, and then just rendering a static model with no animation), some to do lighting etc. You then construct a vertex program from several of these program fragments, this gives you a nice flexible materials system as you don't have to manually write a shader for every possible material, instead you write bits of a shader for each different type of lighting and shading a material could have and then just say use these bits for this material.

As for how this is handled now I believe UE3 has a similar approach of building up vertex and fragment programs from little bits. I saw a video where they showed a UI where an artist could build a shader and it was basically a flow chart, with each block representing some kind of operation in the shader (it may be a simple modulation of two colour components or a lighting technique or something like that). Half Life 2 has a system whereby they write one big shader with everything in and then use conditional compilation to only compile certain bits, they then create every possible combination of bits (the main shaders in HL2 end up producing ~5000 actual shaders). If you have dynamic branching available you can take the same approach as HL2 but instead of having to compile every possible combination you just have if(feature){} blocks in your shader. The reason you may not want to do this is dynamic branching may not be supported on your target hardware, or if it is supported it my be slower than using say the HL2 technique.

Share this post


Link to post
Share on other sites
Yeah I think it's just a crossing of terminology, fragment shaders and shader fragments are two different things. ;) Fragment shaders being another term for pixel shader, and shader fragments being pieces of shader code that can be linked/combined to form a complete shader program.
Monder - if( feature ){} is actually static branching, which is more efficient than dynamic branching since the same side of the branch is taken over the course of the DrawPrimitive call.

Share this post


Link to post
Share on other sites
Typically most people use PS for DirectX (HLSL) based shaders, and FS for Cg and GLSL. So thats the way I use them to minimize any confusion. Although as JohnBolton says the correct term is Fragment Shader.

Share this post


Link to post
Share on other sites
Even "shader" is a misnomer. Shaders don't "shade". I think that "vertex program" and "fragment program" are the best terms.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!