Shader Language and General Questions!
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.
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]
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]
Thank you, n3Xus, for that insight.
Anybody else that wishes to increment further this topic, feel free to do so.
Anybody else that wishes to increment further this topic, feel free to do so.
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
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
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
when you can use them to write shade code, the answer is in your head
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement