zadvorsky / three.bas

THREE.JS Buffer Animation System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I change an opacity for each prefab using a PrefabBufferGeometry?

ArthurBardakov opened this issue · comments

What if I have a PrefabBufferGeometry, but I just wanna change the opacity for each prefab separately in the fragment shader using StandardAnimationMaterial, is it possible to achieve this? Or after PrefabBufferGeometry creation it is considered as one object?

There are a few ways you can fo this.

You could create an attribute (let's say aOpacity), with 1 number per prefab. Then you need to pass this value to a varying vOpacity, so it can be used in the fragment shader as diffuseColor.a = vOpacity.

The Standard Material example should have what you need.

Also don't forget to set material.transparent to true.

The thing is that I did exactly like you said, but I didn't really seem to notice any changes (or at least not clear ones), `cause PrefabBufferGeometry was constructed from ExtrudeGeometry which depth parameter was making opacity not really clear and with StandardAnimationMaterial having 'side' param to be THREE.DoubleSide. But anyways thanks for the answer and for the library too!!)