Particles with multiple textures

Software: Away3D 4.x

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 grin

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.

 

   

Avatar
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
Intermediate_ParticleExplosions.as  (File Size: 15KB - Downloads: 373)
Intermediate_ParticleExplosions.swf  (File Size: 207KB - Downloads: 231)
   

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 wink

 

   

Avatar
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
Particle.swf  (File Size: 188KB - Downloads: 288)
   

Avatar
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 01000i++)
   
{
    geometrySet
.push(plane);
    
particleTransform = new ParticleGeometryTransform();
    
uvTransform = new Matrix();
    
uvTransform.scale(0.50.5);
    
uvTransform.translate(int(Math.random() * 2) / 2int(Math.random() * 2) / 2);
    
particleTransform.UVTransform uvTransform;
    
setTransforms.push(particleTransform);
   
}

   particleGeometry 
ParticleGeometryHelper.generateGeometry(geometrySetsetTransforms); 

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.

 

   

Avatar
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 01000i++)
   
{
    geometrySet
.push(plane);
    
particleTransform = new ParticleGeometryTransform();
    
uvTransform = new Matrix();
    
uvTransform.scale(0.50.5);
    
uvTransform.translate(int(Math.random() * 2) / 2int(Math.random() * 2) / 2);
    
particleTransform.UVTransform uvTransform;
    
setTransforms.push(particleTransform);
   
}

   particleGeometry 
ParticleGeometryHelper.generateGeometry(geometrySetsetTransforms); 

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
Intermediate_ParticleTrails.swf  (File Size: 221KB - Downloads: 276)
   

Tomcatus, Newbie
Posted: 20 September 2013 11:07 AM   Total Posts: 8   [ # 7 ]

@GoroMatsumoto Wow, this is exactly what I was looking for! Thanks smile 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!

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X