|
Tomcatus, Newbie
Posted: 17 September 2013 07:17 AM Total Posts: 8
Hello, this is my first post here so first of all greetings to you all and thanks for such a great piece of software as Away3D
To the problem - I want to create a demo with some particle animation. I’m using the very new version of the library with the new particle engine. I quite easily learnt it and can do almost everything I need, besides one thing.
How can I make my particles have different material? To be precise - how to make the texture on them vary between each other. It has to be done only once, at the beginning, after that they are not changing.
I tried to google this up but without success. As far as I know the material can be different between meshes, not geometries. Does it mean I have to create several different meshes with geometries for different textures and then set animators for them etc? Or maybe there is an easier way to accomplish this.
Thanks in advance,
Tomcatus.
|
Tomcatus, Newbie
Posted: 18 September 2013 08:45 AM Total Posts: 8
[ # 1 ]
Ok, after a day of trying and making mistakes i can finally modify what I need. I have a circle particle, I want to have a lot of them on scene and want to divide them into several different colors. That’s what I need - the solution is completely free, if not textures maybe some color transforms or something. I tried the ParticleColorNode but after setting a color for every particle I run out of registers in the result AGAL code, so it is a large constraint now. But maybe there are other ways to achieve this that I’m missing at the moment. I look forward to any sensible idea of solution.
Regards,
Tomcatus.
|
dottob, Jr. Member
Posted: 18 September 2013 11:19 AM Total Posts: 49
[ # 2 ]
https://github.com/liaocheng
This super man(i think he is) writed the particle system,
The particle system with ColorMaterail is powerful,with TextureMaterial,i didn’t find a good way.
Wish the attachments source file could be help for you.
File Attachments
|
Tomcatus, Newbie
Posted: 18 September 2013 01:50 PM Total Posts: 8
[ # 3 ]
Hey, thanks for your reply. I’ve found this example on Github and analyzed it thoroughly. It seems to achieve what I want, but underneath it’s just two separate meshes with different materials. I’m looking for a solution of changing only the texture/color of a single particle without changing the geometry, duplicating it or dividing. I’m almost certain it’s possible in some way but don’t know how. I hope the author of this particle engine will soon reply and give some insight on this issue
|
dottob, Jr. Member
Posted: 19 September 2013 09:39 AM Total Posts: 49
[ # 4 ]
Is this what you want?
If so,maybe it’s a alternate method.
It’s a accidental discovery.
Made with SegmentSet
File Attachments
|
GoroMatsumoto, Sr. Member
Posted: 19 September 2013 10:05 AM Total Posts: 166
[ # 5 ]
You can use UV offset with single texture.
Here is an example source.
https://github.com/away3d/away3d-examples-fp11/blob/master/src/Intermediate_ParticleTrails.as
//create the particle geometry var geometrySet:Vector.<Geometry> = new Vector.<Geometry>(); var setTransforms:Vector.<ParticleGeometryTransform> = new Vector.<ParticleGeometryTransform>(); var particleTransform:ParticleGeometryTransform; var uvTransform:Matrix; for (var i:int = 0; i < 1000; i++) { geometrySet.push(plane); particleTransform = new ParticleGeometryTransform(); uvTransform = new Matrix(); uvTransform.scale(0.5, 0.5); uvTransform.translate(int(Math.random() * 2) / 2, int(Math.random() * 2) / 2); particleTransform.UVTransform = uvTransform; setTransforms.push(particleTransform); }
particleGeometry = ParticleGeometryHelper.generateGeometry(geometrySet, setTransforms);
And maybe, you should make the “smooth” parameter of your material set to false. For avoiding an artifact of color blending on UV edge.
Cheers.
|
dottob, Jr. Member
Posted: 19 September 2013 10:39 AM Total Posts: 49
[ # 6 ]
GoroMatsumoto - 19 September 2013 10:05 AM You can use UV offset with single texture.
Here is an example source.
https://github.com/away3d/away3d-examples-fp11/blob/master/src/Intermediate_ParticleTrails.as
//create the particle geometry var geometrySet:Vector.<Geometry> = new Vector.<Geometry>(); var setTransforms:Vector.<ParticleGeometryTransform> = new Vector.<ParticleGeometryTransform>(); var particleTransform:ParticleGeometryTransform; var uvTransform:Matrix; for (var i:int = 0; i < 1000; i++) { geometrySet.push(plane); particleTransform = new ParticleGeometryTransform(); uvTransform = new Matrix(); uvTransform.scale(0.5, 0.5); uvTransform.translate(int(Math.random() * 2) / 2, int(Math.random() * 2) / 2); particleTransform.UVTransform = uvTransform; setTransforms.push(particleTransform); }
particleGeometry = ParticleGeometryHelper.generateGeometry(geometrySet, setTransforms);
And maybe, you should make the “smooth” parameter of your material set to false. For avoiding an artifact of color blending on UV edge.
Cheers.
I think your post is the right answer!Nice!
File Attachments
|
Tomcatus, Newbie
Posted: 20 September 2013 11:07 AM Total Posts: 8
[ # 7 ]
@GoroMatsumoto Wow, this is exactly what I was looking for! Thanks Unfortunately I can’t use it in my current project due to some changes in the idea and so on from the client but I’ll surely try it at home and maybe create something worth watching. Thanks again!
|