Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm learning about using Ogre particles and had some questions about how the point type particles work.

Q. I believe point type particles are implemented as a single position. Is one single vertex is passed to the vertex shader?

Q. If one vertex is passed to the vertex shader then what gets sent to the fragment shader?

Q. Can I pass the particle size to the shader? Perhaps with a custom parameter?

share|improve this question
    
I think, if my memory hasn't failed me, that particles in Ogre can be simulated using sprites. But most effects imply 4 vertices for each billboard, where the billboard position is at the center of that rectangle/square. You can then pass the size to your vertex shader and modify the billboard size by multiplying the vertices since their origin is (0,0,0) in object space. That's one way to dynamically control the size of the billboards via uniforms. I don't know how sprites are implemented behind the Ogre interfaces, but in all cases, you have at least 4 positions sent to the fragment shader.. –  teodron Nov 20 '12 at 8:38
    
I haven't found all the answers yet, but it looks like you can pass a single vertex to the video card. Since it's not a polygon you must also pass the size of what you want to render (PSIZE semantic in nvidia Cg language). I think some of my answers are in chapter 6 (particles): http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter06.html –  Jay Nov 20 '12 at 12:41
    
Since you're using Ogre to do the job, and not manually interacting with the point sprite code (as suggested here gpgpu.org/forums/viewtopic.php?p=21834 ), try it and see if it works just by writing shaders for that particular particle system. You can then do some magic in the pixel shader if you like, since the vertex isn't good at scaling things anymore (apart from tampering with that PSIZE semantic). –  teodron Nov 20 '12 at 12:57
add comment

1 Answer

Ogre can do 'point sprites' but it has some important caveats.

  • if the center of the sprite hits a screen edge it will be culled. Half the visible sprite will vanish when it's culled.

  • some video cards don't allow large sprites.

If you do choose to use point sprites under opengl you must set the pixel attenuation values or pixel sprite mode will not be enabled. The PSIZE parameter in the shaders will just not work. It's not obvious what it's doing under the covers. Generating vertices for the billboard for you or just generating a point sprite.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.