百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

lensflare-threejs-vanilla

> 编程语言
开源

Vanilla Threejs 的镜头闪光效果

196 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

Vanilla Threejs 的镜头闪光效果

Lens Flare for Vanilla Threejs

by Anderson Mancini

Lens Flare adds the optical aberration caused by the dispersion of light entering the lens through its edges. This one doesn't use any post-processing pipeline and it is very easy to use and customize. See the demo here

Check a simple Code Sandbox implementation here

HOW TO USE?

1. Download the files component and save it on your project

Download the Lens Flare source code and save into your project

2. Import the component

javascript
import { LensFlareEffect, LensFlareParams } from './LensFlare'

Then add the LensFlare to your Scene

javascript
const lensFlareEffect = LensFlareEffect()
scene.add(lensFlareEffect)

That's all you need ✨


Ignoring occlusion on some objects

To disable the occlusion effect, simply add userData={{ lensflare: 'no-occlusion' }} to your object/mesh. This feature is particularly useful for creating realistic skyboxes in demos. By utilizing this setting, the internal raycaster of Lens Flare will exclude the designated object/mesh from occlusion calculations.

Debud interface

You can add this to your project to have a debug interface to change the parameters.

javascript
import * as dat from 'lil-gui'
…

Improving performance

⚠️ The StarBurst option is very intense for some GPU's to compute. If you have any issues with the performance, you can disable it.

Compatibility

Lens Flare is compatible with all modern browsers that support WebGL 2.0 (WebGL 1 is not supported), using three.js version r153 or later is recommended.

Getting Started using this demo project

Download and install Node.js on your computer (https://nodejs.org/en/download/).

Then, open VSCODE, drag the project folder to it. Open VSCODE terminal and install dependencies (you need to do this only in the first time)

bash
npm install

Run this command in your terminal to open a local server at localhost:3000

bash
npm run dev

License

A CC0 license is used for this project. You can do whatever you want with it, no attribution is required. However, if you do use it, I'd love to hear about it!

Can you leave a star please?

I genuinely appreciate your support! If you're willing to show your appreciation, you can give me a star on GitHub or consider buying a coffee to support my development at https://www.buymeacoffee.com/andersonmancini. The funds received will be utilized to create more valuable content about Three.js and invest in acquiring new courses. Thank you for your consideration!

Credits

Hard to remember everything I read to achieve this, but here's a list of resources that have been helpful to me:

  • https://www.shadertoy.com/view/4sK3W3
  • https://www.shadertoy.com/view/4sX3Rs
  • https://www.shadertoy.com/view/dllSRX
  • https://www.shadertoy.com/view/Xlc3D2
  • https://www.shadertoy.com/view/XtKfRV
  • https://blog.maximeheckel.com/posts/the-study-of-shaders-with-react-three-fiber/
  • https://skybox.blockadelabs.com/

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptlensflarethreejsthreejs-journey

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言