A帧图像亮度



我有一个A帧AR场景,里面有一个图像(透明png(,我可以通过手势四处移动和调整大小。

我现在要做的是根据相机输入估计的光线来改变该图像的亮度。我有光估计位工作,我最初的想法是简单地使用光估计输出的值将 CSSfilter: brightness(x.x)应用于图像。

可悲的是,在<a-image>上应用 CSS 似乎没有任何效果。

因此,我认为这可能可以通过材质和着色器来实现,但我不知道会如何,我尝试使用平面着色器并更改其不透明度,但这会改变整个图像的不透明度,所以我最终得到一个稍微不透明的黑色阴影。

这是我尝试的着色示例:

<a-scene>
<a-image src="http://assets.stickpng.com/thumbs/580b57fcd9996e24bc43c52d.png" 
position="0 2 -3"
rotation="0 0 0"
height="5" 
width="5"
material="shader:flat;color:black;opacity: 0.5; transparent: true">
</a-image>
</a-scene>

我还尝试使用带有emissiveIntensity的标准着色器,但我似乎无法使其适用于黑色,任何其他颜色似乎或多或少地出现在我想要的地方,尽管我无法获得完全黑暗的图像(如果亮度为 0(:

//if i change emissive to black then the image is unaffected
material="shader:standard;color:white;emissive:red;emissiveIntensity:0.5; 
//like this i can get full black but the image is no longer visible, only the shape
material="shader:standard;color:black;emissive:white;emissiveIntensity:0.5"

斯菲德尔

知道如何实现这一目标吗?

我明白了,我所要做的就是将材质设置为标准着色器,没有其他任何东西,然后更改我手动添加的环境光强度以替换默认的 A 帧添加。

material="shader:standard"

如果有更好的方法可以做到这一点,请发布答案。