你如何画蜡笔画? [英] How do you draw like a Crayon?

查看:107
本文介绍了你如何画蜡笔画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

蜡笔物理学豪华版是最近推出的一款商业游戏。观看主链接上的视频,了解我在说什么。



它可以让你绘制形状并让它们与适当的物理反应。目标是使用你制作的装置和形状将球移动到屏幕上。

http://www.box2d.org/rel =noreferrer> Box2D物理引擎,它确实有一个功能,我很好奇它是如何实现的。



它的绘画看起来很像,就像蜡笔一样。你可以看到蜡笔的纹理,当它画出来时,就像实际的蜡笔画看起来一样,它的厚度和黑度都有所不同。

alt text http://www.kloonigames.com/crayon/screenshots/crayon_small_01.jpg alt text http://www.konglish.com/crayon/screenshots/crayon_small_02.jpg



背景纹理免费提供此处

alt text http:// img267.imageshack.us/img267/1488/crayonmh7.png

关闭蜡笔画 - 注意变化的黑暗



用什么样的算法来渲染这些线条,看起来像一个Crayo N +这是一个简单的纹理应用与随机厚度和黑暗或有什么更多的事情吗?

我记得阅读很久以前)一个算法的简短描述如下:


  • 对于一般形式的行,在随机点分成两部分,并将该点从其位置略微移开(该变化取决于该点到四肢的距离)。重复递归/随机重复。 通过这种方式,您的线条不是完美的(直线) 对于给定的线段,您可以超出一点点,通过延伸一个肢体或其他(或两者)。 这样,您没有完美的关节。如果我记得不错,最好的办法是延长原来的肢体,但是如果你想明显地将它们分开,你可以为子细分做到这一点。

  • 绘制带有图案/图章的线条
  • 还有(已经提到的)以不同的开始和结束不透明度绘制的可能性(以模拟释放在绘图结束时)


  • 您可以在行首和行末使用不同大小的邮票(也可以模仿在绘图结束时释放笔)。为了达到同样的效果,你也可以画两条线,对于其中一个肢体的变化很小(在这种情况下请注意alpha,因为这条线会被绘制两次)


  • 最后,对于给定的行,您可以多次执行以前的修改(即,绘制两行不同的变化形式):如果人们犯了一些错误,他们倾向于重复行。




问候


Crayon Physics Deluxe is a commercial game that came out recently. Watch the video on the main link to get an idea of what I'm talking about.

It allows you to draw shapes and have them react with proper physics. The goal is to move a ball to a star across the screen using contraptions and shapes you build.

While the game is basically a wrapper for the popular Box2D Physics Engine, it does have one feature that I'm curious about how it is implemented.

Its drawing looks very much like a Crayon. You can see the texture of the crayon and as it draws it varies in thickness and darkness just like an actual crayon drawing would look like.

alt text http://www.kloonigames.com/crayon/screenshots/crayon_small_01.jpg alt text http://www.kloonigames.com/crayon/screenshots/crayon_small_02.jpg

The background texture is freely available here.

alt text http://img267.imageshack.us/img267/1488/crayonmh7.png
Close up of crayon drawing - Note the varying darkness

What kind of algorithm would be used to render those lines in a way that looks like a Crayon? Is it a simple texture applied with a random thickness and darkness or is there something more going on?

解决方案

I remember reading (a long time ago) a short description of an algorithm to do so:

  • for the general form of the line, you split the segment in two at a random point, and move this point slightly away from it's position (the variation depending on the distance of the point to the extremity). Repeat recursively/randomly. In this way, you lines are not "perfect" (straight line)

  • for a given segment you can "overshoot" a little bit, by extending one extremity or the other (or both). In this way, you don't have perfect joints. If i remember well, the best was to extends the original extremities, but you can do this for the sub-segment if you want to visibly split them.

  • draw the lines with pattern/stamp

  • there was also the (already mentioned) possibility to drawn with different starting and ending opacity (to mimic the tendency to release the pen at the end of drawing)

  • You can use a different size for the stamp on the beginning and the end of the line (also to mimic the tendency to release the pen at the end of drawing). For the same effect, you can also draw the line twice, with a small variation for one of the extremity (be careful with the alpha in this case, as the line will be drawn twice)

  • Last, for a given line, you can do the previous modifications several times (ie draw the line twice, with different variations) : human tend to repeat a line if they make some mistakes.

Regards

这篇关于你如何画蜡笔画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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