Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by 3dDude · Apr 13, 2011 at 12:11 AM · particlesbillboard

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.

Cheers!

EDIT:

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[i] = cloudParticles[i].rotation;
    }
}
function Update () {
    var particles = particleEmitter.particles;
    for(i = 0; i < particles.length; i ++){
        particles[i].rotation = cloudRotations[i] + camera.main.transform.eulerAngles.z;
    }
    particleEmitter.particles = particles;
}

This sorta works... It has a few glitches... But its also pretty intense on the CPU.

Anyone know a better way thats less glitchy? :P

Thanks!

EDIT:

Bump... Still looking for solutions... Vertex shaders? I am not sure does anyone have any input on this?

Cheers!

Bump one more time.

Started a bounty..

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 3dDude · Apr 13, 2011 at 02:51 AM 0
Share

Can't you use: ParticleEmitter.particles[somenumber].rotation?

avatar image Joshua · Apr 13, 2011 at 09:25 PM 0
Share

If that's true then just do if(i=0;i

avatar image 3dDude · Apr 14, 2011 at 02:50 AM 0
Share

I don't thing you can turn off billboarding on particles?

Plus the rotation variable is only the local y axis. If you look at the docs it says that particle rotation is a float.

If you can access that, I am sure there is Some way to do it... Any ideas?

avatar image 3dDude · Apr 14, 2011 at 03:05 PM 0
Share

Alright a new version is in the first post. Any ideas?

avatar image flaviusxvii · Apr 28, 2011 at 07:06 PM 0
Share

$$anonymous$$ay I ask why you want to constrain the rotation to only two axes? I'm wondering if this is a case where you've decided on implementing an answer you came up with when a different approach might be better.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by flaviusxvii · May 04, 2011 at 02:02 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 3dDude · May 04, 2011 at 09:24 PM 0
Share

Unless you know any way to achieve this with just using particles. I will accept this answer.

avatar image
1

Answer by Owen-Reynolds · Apr 13, 2011 at 06:28 AM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 3dDude · Apr 13, 2011 at 02:44 PM 0
Share

Hmmmm, I am trying to figure this out for my 3D Cloud system. Because when you look up and rotate the particles rotate on the y-z axis also. It makes it look like a swirly tornado... lol. If you are not sure what I mean you can go on unity forum and see my cloud system and give it a try... I think there is a webplayer.

avatar image
0

Answer by synapsemassage · Apr 13, 2011 at 08:19 PM

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 3dDude · Apr 13, 2011 at 09:01 PM 0
Share

Well, I know it is possible. Everything works with particles except the rotation bill boarding.

avatar image synapsemassage · Apr 18, 2011 at 08:44 PM 0
Share

What I mean is using the particles position only (cloudPositions[i] = cloudParticles[i].position) and place your own billboards (or any other objects) at these positions. In Update() make a lookAt (see script reference) with camera as target and set localRotation.z = 0

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Particle pivot - unexpected results 0 Answers

Disabling a particle's billboard attribute 1 Answer

A different kind of billboarding for particles.. 3 Answers

Flat 2d image on 3d character. 0 Answers

Is it possible for Shuriken Billboard particles to receive shadows from shadow maps? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges