最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to make a fog effect or blur effect in canvas with js? - Stack Overflow

programmeradmin5浏览0评论

I'm using javascript and THREE.js 3d engine,

and I want to do a fog effect,

here's an example .js/examples/webgl_geometry_terrain_fog.html

but it only support WebGL,

so is there any way to simulate fog effect, or a blur effect with javascript and canvas?

thanks alot.

I'm using javascript and THREE.js 3d engine,

and I want to do a fog effect,

here's an example http://mrdoob.github./three.js/examples/webgl_geometry_terrain_fog.html

but it only support WebGL,

so is there any way to simulate fog effect, or a blur effect with javascript and canvas?

thanks alot.

Share Improve this question asked Jan 20, 2012 at 9:07 NamiWNamiW 1,7024 gold badges21 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Three.js is WebGL. The example you're looking at is created by the same person who made three.js.

Three.js supports fog already with scene.fog.

https://github./mrdoob/three.js/wiki/API-Reference#wiki-THREE.Fog


below is for people that searched for fog/blur in Canvas looking for 2D

There are a bunch of places that have implemented various blur effects. The pixastic library has a lot of such effects implemented.

Fog is something different, though. There isn't a universal definition and it really depends on what you're looking for. One way would be to set the globalAlpha of the canvas to something like 0.3 and then draw perlin noise on the locations that you want "fog" to appear. Note that the color gradient of the noise that you most likely want is transparent to dark gray.

发布评论

评论列表(0)

  1. 暂无评论