Skip to Main Content
Learning XNA 3.0
book

Learning XNA 3.0

by Aaron Reed
November 2008
Beginner content levelBeginner
510 pages
16h 24m
English
O'Reilly Media, Inc.
Content preview from Learning XNA 3.0

HLSL Effects: Creating a Negative

Now that you have an effect file using a texture, there are any number of things you can do to your HLSL file to get some really interesting and cool effects. For instance, changing the code in the pixel shader to the following will result in a negative image being drawn:

float4 PixelShader(VertexOut input) : COLOR0
{
    float4 output = 1−tex2D(ColoredTextureSampler, input.textureCoordinates);
    return output;
}

The effect is shown in Figure 13-7.

Negative image drawn using HLSL

Figure 13-7. Negative image drawn using HLSL

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning XNA 4.0

Learning XNA 4.0

Aaron Reed
Beginning C# 7 Programming with Visual Studio 2017

Beginning C# 7 Programming with Visual Studio 2017

Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid

Publisher Resources

ISBN: 9780596154905Supplemental ContentErrata Page