# GLSL - Particle Systems

This topic is 4558 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Has anyone else read this - http://www.2ld.de/gdc2004/ In essence im trying to create a 2D particle system. What im aiming to do is have a background texture and a number of different particle textures and blend the particle system together with the background texture. So the first stage of my implementation is to parse two textures, one background and one particle through a shader and blend them together. But im not to sure the best way to do this. I can perform multitexturing where the texture coords are the same but I cant seem to work out how to do a situation like this - Does anyone have any suggestions? Im a little stuck where to start. cheers pot

##### Share on other sites
I'm not sure of your overall design, but perhaps this might spark some thought?

...

Pass in the texture's unrotated coordinates in terms of background space (as I'm sure you already are), as well as the desired rotation value.

Perform the rotation in reverse on the current fragment location in background space.

Calculate the blend as normal using this new background space location by first transforming it into the texture's space.

The centre point used to rotate the fragment location is 0.5, 0.5 in background space, , and not 0.0, 0.0 like usual. For this I would probably come up with a way to convert the texture space from 0 to 1 into -1 to 1 on both axes, perform the rotation, and then convert the new background space location back to 0 to 1 notation.

##### Share on other sites
I think I know what you mean, sounds like a good idea if im understanding you correctly.

Could you expand on your points please? Like what do u mean exactly by "Pass in the texture's unrotated coordinates in background space" - what would is background space? How do i perform rotation in the shader?

thanks
pot

##### Share on other sites
If the particle texture starts halfway across the background, then its top-left coordinate in background space is 0.5, 0.5. Of course, in its own local space, that top-left corner is 1.0, 0.0 (according to the UV mapping method you've shown in your diagram).

As for performing rotation on a point in R2, check out some elementary Linear Algebra resources. wikipedia and mathworld should have all of the info you need in order to learn rotation, translation, scaling, skewing, you name it.

Do you know how I can post an image to this forum?

##### Share on other sites
cheers,

see here for image tags
http://www.gamedev.net/community/forums/faq.asp#tags>

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 24
• 9
• 57
• ### Forum Statistics

• Total Topics
632640
• Total Posts
3007615
• ### Who's Online (See full list)

There are no registered users currently online

×