Beginner’s WPF Pixel Shaders.pptVIP

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  5. 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  6. 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  7. 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  8. 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Beginner’s WPF Pixel Shaders

WPF Pixel Shaders Introduction to Nikola Mihaylov, Sep 1, 2008. /nikola What is Pixel Shader? A fantasy creature: male pixie that likes shades Person who likes to cast shadow on computer screens Any of the above All of the above except this answer Not this answer  Pixel Shader Is: A set of software instructions Used to calculate colors of individual pixels on screen Typically executing on the graphics card (Graphics Processing Unit or GPU) Executed very fast on the GPU Primarily used to compute rendering effects Written in shader language, e.g. HLSL – similar to C Can be used for any computation Demo: Grayscale Effect Shader Inputs: Bitmap to be processed (u,v) location of pixel to be processed (u,v) is used instead of (x,y) to mean that the range of values is from 0 to 1 (u,v) is called “texture coordinates” float DesaturationFactor: specifies how much the bitmap is to be saturated Shader Output: pixel color at specified location Grayscale Effect Pixel Shader: grayscale.fx sampler2D implicitInput : register(s0); float factor : register(c0); float4 main(float2 uv : TEXCOORD) : COLOR { float4 color = tex2D(implicitInput, uv); float gray = color.r * 0.3 + color.g * 0.59 + color.b *0.11; float4 result; result.r = (color.r - gray) * factor + gray; result.g = (color.g - gray) * factor + gray; result.b = (color.b - gray) * factor + gray; result.a = color.a; return result; } Input bitmap – sampler register s0 Code-behind: ShaderEffect.RegisterPixelShaderSamplerProperty() Input float in c0 register. Code-behind: PixelShaderConstantCallback(0) Output: R, G, B, A: float4 Color of the pixel at (u,v) Input: (u,v) coordinates of pixel in the bitmap Retrieve pixel color at location (u,v) from bitmap Grayscale code Shader code from /2008/06/grayscale-effect-pixel-shader-effect-in.html Using Shaders in WPF: Overview Install DirectX SDK Create new WPF app and add .fx file containing the shader code Compile .fx file to .ps file. Se

文档评论(0)

xcs88858 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档