react-three-fiber学习笔记
React关于Three.js的生态,相比Vue完善很多,通过react-three-fiber可以大幅提升我们业务开发的效率。
教程
Haunted House:
Haunted House - Part 1 - App Setup ( ThreeJS | WebGL | React Three Fiber ) - YouTube
资料
react-three-fiber:
GitHub - pmndrs/react-three-fiber: 🇨🇭 A React renderer for Three.js
API:
React Three Fiber Documentation
drei- useful helpers for react-three-fiber:
drei这个项目是融合了storybook的,可以作为我们的参考项目。
生态
drei
GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber
这个太强了,很多效果直接都有现成的了,比如:
体积光:Webpack App
荧光粒子效果:Webpack App
词云:Spherical word-cloud - CodeSandbox
真的是太强了,这已经算是Three.js往Unity追赶的一大利器了。
React与Unity
有一个开源库:react-unity-webgl
Vue也有,但是规模质量和维护程度完全比不上:vue-unity-webgl
案例
真实渲染(荒野中的三个球,不到50行代码):
https://codesandbox.io/s/ground-projected-envmaps-lamina-0c5hv9?file=/src/App.js
这个为啥这么真实?环境贴图的缘故吧
(惊艳)Custom shaders:
Custom shaders w/ React Three Fiber and Nodetoy -Meteor Impact- Tutorial ep 1 - YouTube
带小飞机的地球:
Three.js in practice - Earth and planes - tutorial for beginners 2022 - part 2 - YouTube
光线追踪:
https://codesandbox.io/s/lgl-raytracer-rnuve?file=/src/App.js
透明玻璃材质弹弹球:
https://codesandbox.io/s/pinball-in-70-lines-rmfcq?file=/src/App.js
空战游戏,代码量很少:
https://codesandbox.io/s/space-game-i2160?file=/src/App.js
这个小车能精细化控制到轮子: