OpenGL 中的 Photoshop 风格画笔
我正在尝试实现徒手绘制草图(它应该看起来像一支铅笔)。我做了一些研究,令我惊讶的是互联网上关于此的信息如此之少。我获得的最好信息是通过在 Photoshop 中绘图并观察结果。我认为 Photoshop 的工作原理与此类似:
1)每个画笔都有自己的像素图,告诉每个像素的不透明度 2) 在绘制之前将设置(如重量、颜色等)应用于此像素图 3) 当按下鼠标时,Photoshop开始根据给定不透明度的像素图慢慢填充指针下方的像素 4)当快速绘制时(使两个鼠标框之间的距离大于填充比率),Photoshop会以某种方式对画笔进行插值,使其看起来均匀。我不确定,但我认为它也对模式应用了某种转换,因为这条线看起来不规则。
我想要实现的另一个效果是在铅笔抬起之前线条变细(基于铅笔的速度) - 就像现实生活中一样。
我将不胜感激任何有关以下方面的提示: 1) Photoshop 画笔(或类似工具)的工作精度如何 2)任何具有类似功能的开源工具 3)要寻找的关键字(显然我在谷歌上搜索了错误的单词)
这是我在研究过程中找到的链接(不幸的是闭源): http://www.youtube.com/watch?v=3RPphJxxscY
I am trying to implement free-hand sketching (it should look like a pencil). I did some research and I'm surprised there is so little info about this on the internet. The best information I got was by drawing in Photoshop and observing the result. I think Photoshop works something similar like this:
1) Each brush has its own pixel map, telling what opacity has each pixel
2) Settings (like weight, color etc.) apply to this pixel map before drawing
3) When pressing the mouse, Photoshop starts slowly filling the pixels under the pointer according to the pixel map given opacities
4) When drawing fast (so that the distance between two mouse frames is bigger than the fill ratio), Photoshop somehow interpolates the brush so that it looks homogeneous. I am not sure, but I think it also applies some kind of transformations to the pattern, because the line does not look regular.
Another effect I would like to implement is the line getting thinner before the pencil lifts (based on the speed of the pencil) - just as in real life.
I will appreciate any hints about:
1) How precisely Photoshop brushes (or a similar tool) work
2) Any open-source tools which do something similar
3) Keywords to look for (apparently I am googling with the wrong words)
Here a link I found in the research process (unfortunately closed source):
http://www.youtube.com/watch?v=3RPphJxxscY
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的猜测非常准确
GIMP http://www.gimp.org
自然绘图工具模拟
Your guesses were quite accurate
The GIMP http://www.gimp.org
natural drawing tool simulation