[英]Three.js - sphere that glows
I have a problem. 我有个问题。 I want to make a sphere which works like a source of light (sun).
我想制作一个像光源(太阳)一样工作的球体。 I found out that
meshPhongMaterial
has an option like emissive: color
and shininess: intensity
but I did not manage to code the sun. 我发现
meshPhongMaterial
有一个选项,如emissive: color
和shininess: intensity
但我没有设法编码太阳。 Does anyone know how to do it? 有谁知道怎么做? Thank you for answers!
谢谢你的回答!
If you are looking to create a glow-style effect, I have a written a number of examples at http://stemkoski.github.io/Three.js/ that may be helpful, including: 如果你想创造一种发光效果,我在http://stemkoski.github.io/Three.js/上写了一些可能有用的例子,包括:
http://stemkoski.github.io/Three.js/Selective-Glow.html http://stemkoski.github.io/Three.js/Selective-Glow.html
with accompanying blog post 随附博客文章
http://stemkoski.blogspot.com/2013/03/using-shaders-and-selective-glow.html http://stemkoski.blogspot.com/2013/03/using-shaders-and-selective-glow.html
as well as the more atmospheric-style glow effects 以及更具大气风格的发光效果
http://stemkoski.github.io/Three.js/Atmosphere.html http://stemkoski.github.io/Three.js/Atmosphere.html
and 和
http://stemkoski.github.io/Three.js/Shader-Halo.html http://stemkoski.github.io/Three.js/Shader-Halo.html
Hope this helps! 希望这可以帮助!
Since you don't have a specific problem, I can't give you a specific answer. 由于您没有具体问题,我无法给您一个具体的答案。 You seem a little lost though, so here's the thing you may be missing: In order for something to look like a source of light it must do two things:
你似乎有点失落,所以这就是你可能缺少的东西:为了使某些东西看起来像光源,它必须做两件事:
There are more advanced techniques which you could try, like adding godrays . 您可以尝试更多高级技术,例如添加godrays 。
I wish you luck. 祝你好运。
meshPhong material has parameters 'emissive' and 'shininess' that affect the calculations within material shader, but those won't give you the effect that you want, they are just used for calculating final color. meshPhong材质具有参数'emissive'和'shininess',它们会影响材质着色器中的计算,但这些参数不会提供您想要的效果,它们仅用于计算最终颜色。
You can put spotlight, for example, at the exact position as the sphere, so it would lighten up object around it. 例如,你可以把聚光灯放在与球体一样的确切位置,这样它就会照亮它周围的物体。 However, if you want to achieve the effect of glowing sphere, you would have to write post-processing shader:
但是,如果要实现发光球体的效果,则必须编写后处理着色器:
Also, some examples don't use actual post-processing to achieve glowing, but they use trick. 此外,一些示例不使用实际的后处理来实现发光,但它们使用技巧。
You render sphere and then render some quad with "glow aura" texture in the back. 渲染球体,然后在背面渲染一些带有“发光光环”纹理的四边形。 Visit: http://threegraphs.com/charts/sample/world/ to see how you can maybe simulate glow and create eclipse-like circle around sphere.
访问: http : //threegraphs.com/charts/sample/world/ ,了解如何模拟发光并在球体周围创建类似日食的圆圈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.