HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Emission of particles occurs in the area defined by the text or image

View previous topic View next topic Go down 
AuthorMessage
zhongmei



Messages : 6
Date d'inscription : 2011-08-10

PostSubject: Emission of particles occurs in the area defined by the text or image   Wed Sep 14, 2011 8:43 pm

hi all,

Here is a question.

There is an image with a text on it. The text is while, and the background is black.
Is there any way to limit the zone of the emitter to the area defined by the text?

Thx a lot!

Back to top Go down
View user profile
zhongmei



Messages : 6
Date d'inscription : 2011-08-10

PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Wed Sep 21, 2011 10:54 pm

hi,

I'd like to share my method to this problem.

For image:
1. map the image to a quad in the world coordinate;
2. go through the pixels of the image, if the gray value of the pixel is >= the threshold,
translate the pixel coordinate to the corresponding world coordinate,
and push the world coordinate to a vector;
3. generate a vector index at random, get the corresponding world coordinate,
set the particle position to this world coordinate like what the generatePosition() function does;

For Text:
1. generate the image of the text;
2. use the same way of the image;

Here is a snapshot:
https://servimg.com/image_preview.php?i=2&u=16884121
https://servimg.com/image_preview.php?i=3&u=16884121
[img][/img][img][/img]


Last edited by zhongmei on Mon Sep 26, 2011 12:03 am; edited 1 time in total
Back to top Go down
View user profile
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Sun Sep 25, 2011 7:20 am

Thanks for sharing your solution.

One thing that can be done to make it more generic (to use an image mask on a 3D quad or to use a scaled image in 2D) is adding a random delta to coordinates when generating position so that the texel discretization is removed.

Coordinates of the particle to generate in the image space become :
x + random(0.0f,scaleX)
y + random(0.0f,scaleY)

Another thing that can be added if used in 3D is a extrusion parameter to give the image a thickness.

I ll add a mask zone in SPARK 2 later on I think.

Back to top Go down
View user profile http://spark.developpez.com
zhongmei



Messages : 6
Date d'inscription : 2011-08-10

PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Mon Sep 26, 2011 12:06 am

A nice idea for spark2.

Add a picture and a little more explanation for my demo on my second posted message, hope it could be a little helpful for you:)
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Today at 9:29 am

Back to top Go down
 
Emission of particles occurs in the area defined by the text or image
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» How to update any field(text area) in selenium RC using C#
» Pain in the heart area
» pain in temple area
» Back to School Sweepstakes *Michigan and Wisconsin only*
» How could I pass datafile as parameter to dataProvider

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: