着色器技术概述/展示/游戏用途
我正在寻找可以让我更好地了解着色器在游戏中的用途、它们可以做什么,甚至更重要的是它们不能做什么的资源。我了解图形管道的工作原理以及所有这些,并且我在 GLSL 中制作了一些非常基本的着色器(主要只是为了替换固定功能管道功能),但我还没有完全理解哪些事情只能使用自定义着色器,哪些事情可以更有效地完成,等等。我已经能够找到某些技术的一些示例,尤其是照明,但我正在寻找对其用法的更高级的概述。
与概述相反,某些有趣技术的链接和解释也值得赞赏(但少于概述;)),最好是 GLSL 或伪代码。
I am looking for resources that can provide me with a better understanding of what kind of things shaders are used for in games, what they can do, and maybe even more importantly, what they cannot. I understand how the graphics pipeline works and all that, and I have made some very basic shaders in GLSL (mostly just to replace the fixed-function pipeline functionality), but I don't yet fully understand which things are only possible with custom shaders, which things can be done more efficiently, etc. I have been able to find some examples of certain techniques, most notably lighting, but I am looking for a more higher-level overview of their usage.
Links to and explanations of certain interesting techniques, as opposed to an overview, are also appreciated (but less than an overview ;) ), preferrably in GLSL or pseudocode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑到 DirectX 和 OpenGL 都已转向仅着色器(即无固定功能)系统,“哪些效果只能通过着色器实现”问题的答案可能是“一切”。
我认为如果没有可编程着色器(或通过使用非常具体的黑盒 API),一些技术是不可能/不可行的,它们是:
这样的例子还可以继续,我确信有些人会不同意我的评估,即这些模型无法实现固定功能(通过 hack 或各种固定功能扩展)。
归根结底,在可编程着色器之前,供应商必须在硬件/驱动程序中实现给定的效果,并且它必须是可以通过 API 合理表达的东西。现在,您可以有效地执行您想要的任何用户定义的代码(在不同着色器阶段的约束和硬件的其他限制内),因此您可以灵活地极大地自定义渲染管道并发明您认为合适的新技术。
查看前几本 GPU Gems 书籍(可以在 Nvidia 网站上免费阅读),了解可编程硬件可用后出现的技术类型。
Well considering that DirectX and OpenGL have both moved towards a shader-only (i.e. no fixed-function) system, the answer to your "which effects are only possible with shaders" question could be "everything".
Some techniques that I believe were not possible/feasible without programmable shaders (or by using very specific black-box APIs) though, are:
and the list can go on, and I'm sure some people will disagree with my assessment that these couldn't be achieved with fixed-function functionality (through hacks or various fixed-functions extensions).
What it boils down to is, before programmable shaders, a given effect had to be implemented in the hardware/driver by the vendor and it and it had to be something that could be reasonably expressed through the API. Now you can execute effectively any user-defined code you want (within the constraints of the different shader stages and other limitations of the hardware) so you have the flexibility to greatly customize your rendering pipeline and invent new techniques as you see fit.
Take a look at the first couple GPU Gems books (which can be read for free on Nvidia's website) to get a feel for the types of techniques that were showing up once programmable hardware was available.