Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting opacity / size of particles and lines #297

Closed
zenna opened this issue Jun 27, 2011 · 11 comments
Closed

Adjusting opacity / size of particles and lines #297

zenna opened this issue Jun 27, 2011 · 11 comments
Labels

Comments

@zenna
Copy link

zenna commented Jun 27, 2011

I have a particle system and a line. I can easily set the colour of each vertex and edge in my line by creating a colors array and seting VertexColors to true. My question is How can I adjust the a) opacity b) size of each vertex / edge individually in my particle system / line.

Thanks!

Zenna

@rickygrows
Copy link

I, too, would like to know this.

@mrdoob
Copy link
Owner

mrdoob commented Jun 30, 2011

geometry.colors is an array mapping 1 by 1 the vertices. So if you want to change the color of geometry.vertices[ 1 ] you need to modify geometry.colors[ 1 ].

@zenna
Copy link
Author

zenna commented Jun 30, 2011

Hi mrdoob.

geometry.colors[1] would be a Three.color. I can happily change the color, but as far as I know the opacity value is not stored there. So how can I change the opacity of single vertices / lines?

@mrdoob
Copy link
Owner

mrdoob commented Jun 30, 2011

Uh oh...

@alteredq
Copy link
Contributor

You cannot do this easily, opacity is specified per material not per element. We dropped alpha from Color some time ago.

One possible way would be via custom attributes and custom MeshShaderMaterial where you would have 4-component colors.

The same thing for sizes, there is currently no way to change them per-particle or per-line with default attributes and materials. You would need another attribute stream for size and then have custom material which would use this.

@mrdoob
Copy link
Owner

mrdoob commented Jun 30, 2011

Now I can't remember why we decided to remove alpha from Color...

@alteredq
Copy link
Contributor

I don't remember either, I was able to find this:

dc6e335

Seems like hex colors with alphas were making troubles. Now, with more dependencies in asset pipeline, I guess it would be even more painful.

@mrdoob mrdoob closed this as completed Sep 2, 2011
@quyin
Copy link

quyin commented Oct 14, 2015

being able to specify opacity per vertex would be very useful for doing particle systems.

is there any plan for supporting this in a future release?

I'm not sure what the technical difficulty is here. intuitively, having something like geometry.opacityValues seems a backward-compatible, non-intrusive way of supporting this. there can also be a global pointsMaterial.vertexOpacityValues flag to disable this support if not needed or causing troubles, just as the case for vertex colors.

@WestLangley
Copy link
Collaborator

@quyin You can do what you want with a custom ShaderMaterial. See stackoverflow if you need help.

@quyin
Copy link

quyin commented Oct 14, 2015

@WestLangley I see. thanks for the info!

on the other hand it would be nice if this can be done in JS, especially for people who are not familiar with the shader language, including me. thanks all the same though!

@WestLangley
Copy link
Collaborator

@quyin http://stackoverflow.com/questions/12337660/three-js-adjusting-opacity-of-individual-particles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants