水泥的影响 - 艺术效果 [英] Cement Effect - Artistic Effect

查看:107
本文介绍了水泥的影响 - 艺术效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望得到的效果的图像,其中,所得到的图像将显示为如果它被涂在粗糙的烧结背景,以及胶结背景定制本身在边缘附近,以突出显示它们...请帮帮我在写一个算法来产生这样的效果。 第一图像是原始图像

I wish to give an effect to images, where the resultant image would appear as if it is painted on a rough cemented background, and the cemented background customizes itself near the edges to highlight them... Please help me in writing an algorithm to generate such an effect. The first image is the original image

和第二图像的输出即时寻找。

and the second image is the output im looking for.

请注意边缘被检测出,并在边缘附近的掩模变为指示的边缘清晰

please note the edges are detected and the mask changes near the edges to indicate the edges clearly

推荐答案

您需要阅读上凹凸贴图。有许多凹凸贴图算法

You need to read up on Bump Mapping. There are plenty of bump mapping algorithms.

基本的算法是:

对每个像素

  1. 查找上对应于碰撞图像上的位置的凹凸贴图的位置。
  2. 计算表面正常凹凸贴图的
  3. 加入步骤2的表面法线的几何表面法线(在情况下的图像的这是一个矢量指向上),以便在新的方向上的正常点。
  4. 计算新的'颠簸'表面的相互作用使用,例如,海防阴影场景灯光 - 光位置是由你决定,并决定在这里将阴影说谎
  1. Look up the position on the bump map texture that corresponds to the position on the bumped image.
  2. Calculate the surface normal of the bump map
  3. Add the surface normal from step 2 to the geometric surface normal (in case of an image it's a vector pointing up) so that the normal points in a new direction.
  4. Calculate the interaction of the new 'bumpy' surface with lights in the scene using, for example, Phong shading -- light placement is up to you, and decides where will the shadows lie.

最后,这里有一个纯C实现的二维图像。

Finally, here's a plain C implementation for 2D images.

这篇关于水泥的影响 - 艺术效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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