是否可以在Direct2D顶点着色器中对输入纹理进行采样? [英] Is it possible to sample an input texture in a Direct2D vertex shader?

查看:116
本文介绍了是否可以在Direct2D顶点着色器中对输入纹理进行采样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图从Direct2D效果中的顶点着色器中的输入纹理进行采样,通过基于存储在输入纹理中的向量移动顶点来扭曲图像。但是,每当我尝试从顶点着色器中的输入纹理进行采样时,采样
函数返回0。



我无法找到任何暗示这是明确可能或不可能的事情,这是我的主要问题。



有几个例子在Direct3D中这样做,但我宁愿单独使用Direct2D如果可能的话。示例代码显然会受到赞赏。如果事实证明这是可能的并且我做错了我会发布我的代码。

解决方案

嗨RevDrSquash,


感谢您在此发帖。


>>"每当我尝试从顶点着色器中的输入纹理中采样时,采样函数返回0."


基于我的搜索,因为Texel空间输入是输入纹理,着色器不应对该值的计算方式采取任何


依赖关系。   它应该只用它来对像素着色器的输入进行采样。


我认为像素着色器可以解决这个问题。


最好的问候,


Hart




I am trying to sample from an input texture in a vertex shader in a Direct2D effect that distorts the image by shifting vertices based on vectors stored in the input texture. However, whenever I try to sample from an input texture in my vertex shader the sampling function returns 0.

I haven't been able to find anything suggesting that this is definitively possible or impossible so that's my main question.

There are several examples of doing this in Direct3D but I would rather use Direct2D exclusively if possible. Sample code would obviously be appreciated. If this turns out to be possible and I'm doing something wrong I'll post my code.

解决方案

Hi RevDrSquash,

Thank you for posting here.

>>" whenever I try to sample from an input texture in my vertex shader the sampling function returns 0. "

Based on my search, Since the Texel-space input is input texture, A shader should not take any

dependencies on how this value is calculated.   It should only use it to sample the pixel shader's input.

I think that the pixel shader could solve the issue.

Best Regards,

Hart


这篇关于是否可以在Direct2D顶点着色器中对输入纹理进行采样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆