How to cancel the Z-axis rotation on particle billboarding?

Bounty ends tomorrow. Please, anyone have answers?

Hello all,

^ title says it. I am guessing it has something to do with finding the camera rotation and the particle rotation and adding one? maybe.. I am a pretty awful scripter. So I am not sure.



Alright latest version of the script:

var cloudRotations : float[];
function Start () {
    var cloudParticles = particleEmitter.particles;
    cloudRotations = new float[particleEmitter.particleCount];
    for(i = 0; i < particleEmitter.particleCount; i ++){
        cloudRotations _= cloudParticles*.rotation;*_
_*function Update () {*_
 _*var particles = particleEmitter.particles;*_
 _*for(i = 0; i < particles.length; i ++){*_
 <em><em>particles_.rotation = cloudRotations *+ camera.main.transform.eulerAngles.z;*_</em></em>
 <em><em>_*particleEmitter.particles = particles;*_</em></em>
<em><em>_*<p>This sorta works... It has a few glitches... But its also pretty intense on the CPU.</p>*_</em></em>
<em><em>_*<p>Anyone know a better way thats less glitchy? :P </p>*_</em></em>
<em><em>_*<p>Bump... Still looking for solutions... Vertex shaders? I am not sure does anyone have any input on this?</p>*_</em></em>
<em><em>_*<p>Bump one more time.</p>*_</em></em>
<em><em>_*<p>Started a bounty..</p>*_</em></em>

The most common settings are in the Render component under "Stretch Particles." Vertical gives Y-only rotation ("tree" billboards) and Horizontal keeps them flat with no rotation (good for rising swamp mist.)

Anything more than that, the Vertex shader would generally handle.

The popping you're experiencing is a side-effect of the billboarding algorithm Unity is using. There really shouldn't be any rotation of the billboards when the camera rotates (just when it changes position) but they are doing something different. The way the do it doesn't matter when you're using more typical "particle system" type materials, where there is additive blending and render order doesn't matter.

I am pretty sure you're going to need to generate your own billboard geometry and rotate it yourself, only when the camera moves and not when it rotates. This will give you the smoother effect you're looking for. I've written code like this in the past (in python) and you should be able to adapt it to your needs.

If you're interested in the code, send me a PM and I'll put it up on pastebin for you.

I think you could simply use the positions of the particles and attach your own objects to these positions. Then add your own rotation logic to your objects. As far as I remember something similar was done in the Penelope Tutorial.