Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

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

Go down 
2 posters
AuthorMessage
zhongmei




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

Emission of particles occurs in the area defined by the text or image Empty
PostSubject: Emission of particles occurs in the area defined by the text or image   Emission of particles occurs in the area defined by the text or image Icon_minitimeWed 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
zhongmei




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

Emission of particles occurs in the area defined by the text or image Empty
PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Emission of particles occurs in the area defined by the text or image Icon_minitimeWed 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/view/16884121/2
https://servimg.com/view/16884121/3
[img][/img]Emission of particles occurs in the area defined by the text or image 1[img][/img]


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



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

Emission of particles occurs in the area defined by the text or image Empty
PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Emission of particles occurs in the area defined by the text or image Icon_minitimeSun 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
http://spark.developpez.com
zhongmei




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

Emission of particles occurs in the area defined by the text or image Empty
PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Emission of particles occurs in the area defined by the text or image Icon_minitimeMon 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
Sponsored content





Emission of particles occurs in the area defined by the text or image Empty
PostSubject: Re: Emission of particles occurs in the area defined by the text or image   Emission of particles occurs in the area defined by the text or image Icon_minitime

Back to top Go down
 
Emission of particles occurs in the area defined by the text or image
Back to top 
Page 1 of 1
 Similar topics
-
» How to Make two Global transform on particles
» setting the image of SFML quadrenderer
» [SPARK 2] Bug Report
» Bokeh particles
» OpenGL all particles are black

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