Skip to Main Content
XNA 3.0 Game Programming Recipes: A Problem-Solution Approach
book

XNA 3.0 Game Programming Recipes: A Problem-Solution Approach

by Riemer Grootjans
May 2009
Intermediate to advanced content levelIntermediate to advanced
671 pages
18h 34m
English
Apress
Content preview from XNA 3.0 Game Programming Recipes: A Problem-Solution Approach
CHAPTER 5 ■ GETTING THE MOST OUT OF VERTICES
503
Pixel Shader: Putting It All Together
Finally, you have all the ingredients available to determine the final color. This code puts them
all together:
float4 waterColor = float4(0,0.2,0.4,1);
Output.Color = waterColor*fresnelTerm + reflectiveColor*(1-fresnelTerm) + specular;
The relation between the deep blue ocean color and the reflective color is given by the
Fresnel term. For almost all the pixels, the combination between these two colors makes up
the final color of the pixel. For a pixel with an extremely bright reflective color, the specular
value will be significantly larger than 0. This will make the final color a lot brighter, giving
very bright specular highlights on the spots of the water ...
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

XNA 4.0 Game Development by Example: Beginner's Guide

XNA 4.0 Game Development by Example: Beginner's Guide

Kurt Jaegers
Learning LibGDX Game Development - Second Edition

Learning LibGDX Game Development - Second Edition

Suryakumar Balakrishnan Nair, Andreas Oehlke

Publisher Resources

ISBN: 9781430218555Purchase Link