Jump to content
  • Advertisement
Sign in to follow this  
Kryzon

Shader Language and General Questions!

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

Hey there, I was wondering if you'd help with some questions: First of all, I know nothing about HLSL, not even the slightest bit. But I'm very aware of what you can do about with it, the post-screen effects, occlusion, normal mapping, motion blur, color-recognition, etc. One thing I did learn is that there is much more logic in shader programming than code itself. It's very funny to see such a nice effect and when you see the code, it's just some lines and that's it (lines which you can understand nothing about). So here on to a couple of questions: 1 >> Okay, this one is funny, but still: What is really a Pixel Shader, in relation to how it's applied to models? How do you apply it to some models? is it some kind of material? is it saved in a file? 2 >> Where can I find resources for learning HLSL or GLSL (whether they are online, free, comercial, in books, etc)? Thanks and bye.

Share this post


Link to post
Share on other sites
Advertisement
1: a pixel shader is a stage in the rendering pipeline that handles all "per-pixel" effects-from textures to motion blur, hdr, normal mapping,.. ;

since I'm using DirectX ill talk about HLSL:
directX stores shaders in files called "effect". an effect can contain more shaders (a pixel shader,vertex, geometry(dx10 only), there can also be more that on pixel, vertex,... shader in an effect). then when you are rendering you 3d model you must apply a "technique" that is stored in an effect (a technique is a collection of shaders (pixel,vertex,...) than produce some sort of an special effect (eg, motion blur))-there can be more than one technique. in an technique there are "passes" (these are the one that actually "use" specific shaders, the technique is actually a collection of passes (there can also be more than one pass)

that was a bit simplified explanation

a code example of applying an effect (if the effect contains a pixel shader or vertex or all them, this where they are applied to DX so it can render them)

// Applies a technique that is in the effect
m_pTechnique->GetPassByIndex(j)->Apply(0);
// Renders a couple of triangles
m_pDevice10->DrawIndexed(6,0,0);

if you want to use a different effect for another model you must apply a different technique

2: in the directX sdk. or try google with hlsl tutorials

[Edited by - n3Xus on August 2, 2008 4:29:55 PM]

Share this post


Link to post
Share on other sites
Thank you, n3Xus, for that insight.

Anybody else that wishes to increment further this topic, feel free to do so.

Share this post


Link to post
Share on other sites
no problem,

actually I did a slight mistake when I wrote: "a pixel shader is a stage in the rendering pipeline". it's not really a stage, its just a shader that handles per-pixel effects

Share this post


Link to post
Share on other sites
you can have a look at shader development tool: RenderMokey or FXComposer.
when you can use them to write shade code, the answer is in your head

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!