Using effects question

Started by
1 comment, last by iedoc 12 years, 2 months ago
Could anyone give a brief description of How i should view what an effect file as....like what is the idea behind it? i know its more then just a place to HOUSE your shader code. Also what is the idea behind a technique as well? thanks
Advertisement
It's a place to house your shader code for most, but it has some added facilities which compile the shaders for you and allow you to setup renderstates. The techniques allow you to implement several versions of you shader for different configurations.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

an effect file stores the shader language code that your geometry and everything you display on your screen is run through. You could look at it like a tunnel (pipeline), where all the stuff you want to display goes through it. The simplest shader will basically just pass your stuff on without doing anything to it (some things will still be done in the non programmable parts, like the rasterizer which does interpolation, so that the values of each vertex is "interpolated" or spread across the triangle). A more advanced shader will do different effects to the geometry you pass through, like lighting for a simple example, but of course there are many different effects you could do to your geometry, such as even changing your geometry which the geometry shader does, or adding new geometry which is what the tesselator does.

A technique is a specific effect that you can use on your geometry. A simple effect file might just have a single technique, which might pass on your geometry and colors. You could add another technique for objects that want lighting, so you first run the geometry through the first technique, then run it through the second technique to add lighting to the objects that need it. You might have an extra technique that makes an object look "wavy", for when your looking at the object through a fire or something. The tecninque is basically just different combinations of shaders you have. for example, the first technique just passes through your geometry and colors with the the regular vertex shader, then goes to the pixel shader. the second technique implements lighting, so it uses the same vertex shader, but a different pixel shader. (you wouldn't usually need to send the geometry through a simple technique, then through a second technique just to do lighting, because you could just send it through the lighting technique to get the same effect, it was only an example)

maybe a simple visual

Regular_VertShader{}

Regular_PixelShader{}

Special_PixelShader{}

Techinique1{
Regular_VertShader{}
Regular_PixelShader{}
}

Technique2{
Regular_VertShader{}
Special_PixelShader{}
}

This topic is closed to new replies.

Advertisement