在HLSL着色器中从精灵批次中获取着色颜色 [英] obtaining the tint color from a sprite batch, within a HLSL shader

查看:233
本文介绍了在HLSL着色器中从精灵批次中获取着色颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从HLSL着色器中的精灵批中获取颜色?我正在使用xna.

How do I obtain the color tint from a sprite batch from within the HLSL shader? I'm working with xna.

此外,这背后的理论是什么?我认为色调颜色只会改变实际的纹理颜色,然后再传递给HLSL,但事实并非如此.

Also, what is the theory behind this? I would think that the tint color would just change the actual texture color before passing it to HLSL, but that does not seem to be the case.

推荐答案

您可以查看具体来说,色调颜色在COLOR0中传递到顶点着色器,然后直接传递到像素着色器.在像素着色器中,它乘以该像素的纹理样本.

Specifically the tint colour is passed in COLOR0 to the vertex shader, which is then passed directly to the pixel shader. In the pixel shader it gets multiplied by the texture sample for that pixel.

直接修改纹理数据会非常慢.

Modifying the texture data directly would be tremendously slow.

这篇关于在HLSL着色器中从精灵批次中获取着色颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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