如何创建简单的 HLSL Silverlight 滤镜来混合/播放/混合 2 个图像?

发布于 2024-08-11 01:25:58 字数 138 浏览 6 评论 0原文

如何创建简单的 HLSL Silverlight 滤镜来混合/播放/混合 2 个图像?

我需要一些过滤器的工作示例,它将输入 2 个图像\对象并返回 1 个图像 - 一些计算的结果。

我想引入 Silverlight 混合模式!)

How to create Simple HLSL Silverlight filter for blending/playing with/mixing 2 images?

I need some working example of a filter which would take as an input 2 images\objects and return 1 image - result of some calculations.

I want to bring to Silverlight blend modes!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2024-08-18 01:25:58

那么您要做的第一件事就是定义一个 .FX 文件。因为您需要如下代码:

uniform extern texture Image1;
uniform extern texture Image2;
sampler2D BG_Image1_Sampler = sampler_state
{
    Texture = (Image1);
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = LINEAR;
};
sampler2D BG_Image2_Sampler = sampler_state
{
    Texture = (Image2);
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = LINEAR;
};

float4 MyCalcFunction(float2 TexCoords : TEXCOORD0) : COLOR0
{
    float4 outColor;
    //calculations here

    return outColor;
}

technique BlurGlow
{
    pass P0
    {
        PixelShader = compile ps_2_0 MyCalcFunction();
    }
}

我不确定如何将 FX 文件与 silverlight 一起使用,但这应该可以帮助您入门!

Well the first thing you would do is define a .FX file. In that you need code like the following:

uniform extern texture Image1;
uniform extern texture Image2;
sampler2D BG_Image1_Sampler = sampler_state
{
    Texture = (Image1);
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = LINEAR;
};
sampler2D BG_Image2_Sampler = sampler_state
{
    Texture = (Image2);
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = LINEAR;
};

float4 MyCalcFunction(float2 TexCoords : TEXCOORD0) : COLOR0
{
    float4 outColor;
    //calculations here

    return outColor;
}

technique BlurGlow
{
    pass P0
    {
        PixelShader = compile ps_2_0 MyCalcFunction();
    }
}

I'm unsure of how to use the FX file with silverlight but that should get you started!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文