这个网站不错

http://aras-p.info/blog/2009/05/05/shaders-must-die/

It came in as a simple thought, and now I can’t shake it off. So I say:

Ok, now that the controversial bits are done, let’s continue.

Most of this can be (and probably is) wrong, and I haven’t given it enough thought yet. But here’s my thinking about shaders of “regular scene objects”. All of below is about things that need to interact with lighting; I’m not talking about shaders for postprocessing, one-off uses, special effects, GPGPU or kitchen sinks.

Operating on vertex/pixel shader level is a wrong abstraction level

Instead, it should be separated out into “surface shader” (albedo, normal, specularity, …), “lighting model” (Lambertian, Blinn Phong, …) and “light shader” (attenuation, cookies, shadows).

  • Probably 90% of the cases would only touch the surface shader (mostly mix textures/colors in various ways), and choose from some precooked lighting models.
  • 9% of the cases would tweak the lighting model. Most of the things would settle for “standard” (Blinn-Phong or similar), with some stuff using skin or anisotropic or …
  • The “light shader” only needs to be touched once in a blue moon by ninjas. Once the shadowing and attenuation systems are implemented, there’s almost no reason for shader authors to see all the dirty bits.

Yes, current hardware operates on vertex/geometry/pixel shaders, which is a logical thing to do for hardware. After all, these are the primitives it works on when rendering. But those primitives are not the things you work on when authoring how a surface should look or how it should react to a light.

Simple code; no redundant info; sensible defaults

In the ideal world, here’s a simple surface shader (the syntax is deliberately stupid):

Haz Texture;
Albedo = sample Texture;

Or with bump mapping added:

Haz Texture;
Haz NormalMap;
Albedo = sample Texture;
Normal = sample_normal NormalMap;

And this should be all the info you have to provide. This would choose the lighting model based on used things (in this case, Lambertian). It would somehow just work with all kinds of lights, shadows, ambient occlusion and whatnot.

Compare to how much has to be written to implement a simple surface in your current shader technology, so that it would work “with everything”.

From the above shader, proper hardware shaders can be generated for DX9, DX11, DX1337, OpenGL, next-gen and next-next-gen consoles, mobile platforms with capable hardware, etc.

It can be used in accumulative forward rendering, forward rendering with multiple lights per pass, hybrid (light pre-pass / prelight) rendering, deferred rendering etc. Heck, even for a raytracer if you have one at hand.

I want!

Now of course, it won’t be as nice as more complex materials have to be expressed. Some might not even be possible. But shader text complexity should grow with material complexity; and all information that is redundant, implied, inferred or useless should be eliminated. There’s no good reason to stick to conventions and limits of current hardware just because it operates like that.

Shaders must die!

时间: 2024-10-10 02:47:48

这个网站不错的相关文章

Challenge Checkio(python)—初尝python练习网站

最近在找点python语言练习的网站,发现这个网站不错 http://www.checkio.org/ 页面设计的也比较漂亮,比较适合学习python的语法知识.不过注册这个网站 开始就得解决一个python问题,不过很简单. 1 #python3.3 is inside 2 def checkio(els): 3 return els 4 5 if checkio([1, 2, 3, 4, 5, 6]) == 6: 6 print('Done!') 对上面的代码 修改checkio中的函数 函

JSON----推荐个实用网站,格式化JSON数据

这个网站不错,能节省很多时间,更能帮助我理解JSON数据 http://www.jsoneditoronline.org/  

我的浏览器收藏夹清单,经常访问的网站(200多个)

昨天写了"知识管理,浏览器收藏夹,经常访问的网站",没有详细列举很多具体的网站.  有朋友对这个比较感兴趣,正好,我也想把资讯类等经常访问的网站,好好地整理下. 资讯类,是一个人"知识"的"源头活水".不断接触新的,才能使得大脑一直活跃,越来越灵活. 资讯类:互联网.技术.产品.创业.投资.  创投类:股权众筹.股权投资.风险投资(VC天使).P2P网贷理财.(我个人特别关注,创业.投资和理财) 其它:大多都是细节,一些技术和创投相关的具体文章,

倾情推荐:十大Photoshop自学教程网或免费PS素材网站

Photoshop从业者每天抑或想到的是如何在设计的时候想到最好的设计素材.当然好的素材不是凭空而来的,是平时学习或交流的积累,设计素材积累多了,在设计的时候就会有很好的灵感.下面小编为你推荐国内十个最好的Photoshop自学教程网站或PS免费素材网站.希望这些教程与素材对你有用. NO.1 昵图网  推荐指数五星级 推荐理由:全国最早也是知名度最高好的素材网站,优势明显,素材数量雄厚.不足之处就是质量不高的素材也不少,鱼目混杂,想要高质量的素材也掏钱. NO.2 思维网  推荐指数五星级 推

雅虎35条性能优化建议

雅虎35条性能优化建议分7类,共35条: [内容]尽量减少HTTP请求数 [服务器]使用CDN(Content Delivery Network) [服务器]添上Expires或者Cache-Control HTTP头 [服务器]Gzip组件 [css]把样式表放在顶部 [js]把脚本放在底部 [css]避免使用CSS表达式 [js, css]把JavaScript和CSS放到外面 [内容]减少DNS查找 [js, css]压缩JavaScript和CSS [内容]避免重定向 [js]去除重复脚

基于源码学习-fighting

今天逛着逛着,看到个培训网站,点进去和客服人员聊了一下.接着,看了看他们的培训课程,想了解一下 嵌入式开发的. (人就是要放空自己,把自己当做什么都不会,当着个婴儿[小学生]一般认真,要学什么知识就是真正的要学什么知识,要不然就哭闹,要的就是这股认真的劲, 人有时候就是需要这种认真的精神,不要以为自己阅历.资历多么的牛逼,放下,放空,才能装进新的事物,这样的人生不才是真正快乐的吗) 扯远了,下面的这几个源代码下载网站不错,可以借鉴源码学习提高! -------------------------

IOS要用到的东西

code4app.com 这网站不错,收集各种 iOS App 开发可以用到的代码示例 cocoacontrols.com/ 英文版本的lib收集 objclibs.com/ 精品lib的收集网站 http://www.ityran.com/forum-61-1.html 泰然代码仓库 ---------------------- emoji ---------------------- http://www.easyapns.com/category/just-for-fun http://w

维基百科上的算法和数据结构链接很强大

其实这个网站不错:http://www.sorting-algorithms.com 冒泡排序: bubble冒泡的意思 http://zh.wikipedia.org/wiki/%E5%86%92%E6%B3%A1%E6%8E%92%E5%BA%8F ----------------------------------------------------------------------------- 选择排序: http://zh.wikipedia.org/wiki/%E9%80%89%

iOS(iPhone,iPad))开发(Objective-C)开发库常用库索引

http://www.code4app.com 这网站不错,收集各种 iOS App 开发可以用到的代码示例 http://www.cocoacontrols.com/ 英文版本的lib收集 http://www.objclibs.com/ 精品lib的收集网站 http://www.ityran.com/forum-61-1.html 泰然代码仓库 ---------------------- emoji ---------------------- http://www.easyapns.c