Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cloud System

Discussion in 'Assets and Asset Store' started by Dantus, Aug 16, 2011.

  1. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Edelweiss.CloudSystem;
    4.  
    5. public class ModifyIndividualParticleColors : MonoBehaviour {
    6.  
    7.     private CS_Cloud m_Cloud;
    8.    
    9.     private void Start () {
    10.         m_Cloud = GetComponent <CS_Cloud> ();
    11.        
    12.             // That is not possible due to a bug.
    13. //      m_Cloud.UseParticleColor = true;
    14.        
    15.             // Workaround: Make sure that the renderer type is the one you are using.
    16.         CS_CustomVerticalColorWithShadingGroupRenderer l_Renderer = GetComponent <CS_CustomVerticalColorWithShadingGroupRenderer> ();
    17.         l_Renderer.useParticleColor = true;
    18.        
    19.         for (int i = 0; i < m_Cloud.ParticleCount; i = i + 1) {
    20.             CloudParticle l_Particle = m_Cloud.ParticleAt (i);
    21.             l_Particle.particleColor = new Color (1.0f, 0.0f, 0.0f, 0.1f);
    22.             m_Cloud.SetParticleAt (i, l_Particle);
    23.         }
    24.     }
    25. }
    As you can see, it is not yet possible to set the UseParticleColor with the cloud reference due to the bug. The workaround is, to set it directly in the renderer. That means, get the renderer and set the flag. But be aware that in general it is supposed that you perform all modifications using the cloud reference! This workaround will only be required until the next release!

    Hope this helps. Let me know if there are still issues!
     
  2. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    Yes! It's working now. Thank you very much! :)
     
  3. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    Hi Andy

    I apologize for these questions once again: I am aware that my queries are very specific to my case because I'm using a custom 3D mesh instead of the 3D shape boxes in the Cloud Editor.... and that such queries will not arise if the clouds were created normally through the editor.

    Bounding Box Recalculation after Repositioning Particles
    I can now position the particles in the shape of a custom mesh, everything is looking great. However, when I call m_Cloud.RecalculateBoundingBox(), it recalculates the bounding box based on the *shape in the editor* instead of the *new particle positions*.

    Is there a way for me to get the bounding box of the m_Cloud to match the new particle positions?
    Because the bounding box is in a different position from the particles, the clouds are being culled incorrectly (bounding box is outside frustrum, but particles are inside)

    Thanks again for always being so patient with my queries!

    Sincerely,

    Ivan
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Are you setting the particle positions in the editor or at runtime?
     
  5. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    Yes, it is done during run time.
     
  6. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    As soon as the cloud is enabled (OnEnable), it computes the bounding box based on the particle data that comes with the cloud. Afterwards, all m_Cloud.RecalculateBoundingBox() calls take the actual particles that you are manipulating. That means if you perform the call in Start() it should work, but it won't work in Awake().
    Are you performing the call in Awake() so far?
     
  7. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    I'm performing the calls in Start(). This is the code I'm using.

    Code (csharp):
    1.  
    2. function Start ()
    3. {
    4.     //Make sure we have a mesh to work with
    5.     if (sourceMeshGO == null)
    6.     {
    7.         Debug.LogError("Source Mesh GameObject missing - please assign");
    8.         return;
    9.     }
    10.  
    11.     //Make sure we have clouds to work with
    12.     m_Cloud = GetComponent.<CS_Cloud> ();  
    13.    
    14.     if (m_Cloud == null)
    15.     {
    16.         Debug.LogError ("Please make sure the script is attached to a GameObject that contains a CS_Cloud!");
    17.     }
    18.        
    19.     sourceMeshFilter = sourceMeshGO.GetComponent.<MeshFilter>();
    20.     var l_Renderer: CS_CustomVerticalColorWithShadingGroupRenderer = GetComponent.<CS_CustomVerticalColorWithShadingGroupRenderer>();
    21.  
    22.     l_Renderer.useParticleColor = true;
    23.  
    24.     var maxParticle : int = m_Cloud.ParticleCount;
    25.  
    26.  
    27.     for (var i : int = 0; i < maxParticle; i = i + 1)
    28.     {
    29.         var tmpCp : CloudParticle = m_Cloud.ParticleAt(i);
    30.         var t : RaycastHit = GetPointOnMesh(sourceMeshFilter);
    31.  
    32.         tmpCp.particleColor.a = Mathf.Clamp01(t.distance * 1.5);
    33.  
    34.         tmpCp.position = t.point;      
    35.         m_Cloud.SetParticleAt(i, tmpCp);
    36.     }
    37.    
    38.     m_Cloud.RecalculateBoundingBox();
    39.  
    40. }
    41.  
     
    Last edited: Sep 6, 2012
  8. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You are a bug hunter :) . As you can see, I haven't tested the runtime functionality enough! Even if the bounding box is computed correctly, it is not passed to the mesh renderer. It should work with all, except for the Custom and SimpleCustom renderers. I'll fix that. Unfortunately no workaround this time.

    Thanks for pointing that out!
     
  9. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    Okay. I'll wait till the next release then. Thank you. :)
     
    Last edited: Sep 5, 2012
  10. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    There is no actual workaround, except for using Shuriken or Legacy as renderer. I am going to fix that as soon as possible. It will take at least one week, because I have to meet a deadline.
    Let me know if you wish to get the updated version before I submit it for review to the asset store. But as already mentioned, it will take about one week.
     
  11. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    No problem at all. :) Take your time. It's not a showstopper bug. I can live with the problem for another week. :)

    and Thank YOU very much for the amazing support!
     
    Last edited: Sep 5, 2012
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Interesting product... would I be able to do ground fog with this?
     
  13. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Yes, absolutely! It certainly depends on what you want to achieve exactly. You model the area where the fog should be and generate the particles there. That should work pretty well. Just ask if you have more specific questions.
     
  14. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I am looking to achieve this creepy town, with an optimised setup. And I am hoping that this will support some kind of self shadowing to really sell how eerie this is: $Deep%20Fog.png

    Also, i can't run your demo scenes... getting compiler errors.
     
    Last edited: Sep 5, 2012
  15. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    This kind of effect should be achievable with the Cloud System (you may even try to use Cloud System Free). The main issue you are going to encounter is the intersection with the solid geometry. You can use soft particles to at least reduces those artifacts, if the target platform supports deferred lighting.

    What do you mean with self shadowing?
     
  16. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Particles that shadow over themselves like blankets of smoke... and also I can't run your demo :(...
     
  17. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Shadows with particles or any other semi-transparent object do not work in Unity and the same is true for the Cloud System. Though, you have a lot of shading control, especially with the paid version. It is possible to cheat a lot like that.

    Which demo do you mean?
     
  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    All of them are getting compiler errors... :/ including the scene I am testing right now... also I am trying to deal with ground fog that unfortunately, I get a warning that says my particles don't fit into shape... also could this be animated?
     
  19. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Can you post the compiler errors you are getting?

    You have to either make the particle size slightly smaller or increase the box shapes a little bit in all directions. All particles are created within the boxes and they need enough space to also rotate, otherwise they are not created and you are getting this warning.

    Animations are not possible right now, except if you code it on your own. You can rotate the whole cloud to give the impression of an animation (that was used in the ring cloud demo).
     
  20. Kayden007

    Kayden007

    Joined:
    Jan 14, 2011
    Posts:
    92
    Do the clouds animate?
     
  21. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    No.

    Edit: It is not built-in. You can change the particle positions with scripts though.
     
    Last edited: Sep 15, 2012
  22. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I have resolved the issues that were reported by DragonDrumstick. Everyone who purchased can have the beta version with the fixes. Just drop me a pm with your invoice number.
     
  23. DragonDrumstick

    DragonDrumstick

    Joined:
    Jul 15, 2012
    Posts:
    14
    Just a quick message to say thanks to Dantus! Everything is working great now! :)
     
  24. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  25. chronosapien

    chronosapien

    Joined:
    Feb 1, 2011
    Posts:
    73
    I downloaded the free version of the cloud system and I've got a few questions:

    1) I'm messing around with the lightning clouds and I can't quite replicate the effects that are in the lightning demo scene.

    I have created clouds as described in the Getting Started guide, switched the material to the lightning clouds shader, and darkened the tint which is all I could see that was different in the demo scene. When I create a point light, it lights the nearby particles but only a few of them. It seems like increasing the radius doesn't have much of an effect while however decreasing does. Also, the light intensity doesn't seem to do anything either. One thing to note is that the scale of the clouds I created are much smaller than the ones in the lightning demo scene; around the order of 2 units. Is there a step in the setup that I am missing?

    2) I would like to use the lightning cloud shader to light particles other than those used in the cloud system. However, when I try creating a particle system with a material that uses the shader, the particles aren't affected by lights. Is is possible to use the shader outside of the system?

    3) We have a dynamically changing environment and so change both the rotation and intensity of our scene's directional light. The clouds in the system seem to respond to rotation changes but not light intensity changes. Is this a feature that could be added or is that another way to achieve the desired effect?
     
  26. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    This is indeed a little tricky. First, keep in mind, this shader cheats like crazy. Basically it only lights particles that are between the light and the CENTER of the cloud. By center I mean the transform position of the cloud. No matter what you do, the other particles will never be lit!
    You can place a point light outside of the cloud, increase the intensity to the max, then start to increase the radius. You will figure out that the cloud has to be covered totally in the radius of the cloud and even more in order to be lit more intensively.

    The Cloud System works with vertex colors. The shader assumes that the mesh has vertex colors, which probably produces your issue.

    Every cloud has a tint property. This one is supposed to be used exactly for that. It can be changed by script, even at runtime.
     
  27. chronosapien

    chronosapien

    Joined:
    Feb 1, 2011
    Posts:
    73
    Thanks a lot for the response. I'm going to push to purchase the full version but either way I look forward to working with it; it looks great so far. Great job with the inspector interface and documentation by the way, it was really easy to follow.
     
  28. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    The shaders used in your cloud system (free) don't seem to account for scene fog. The clouds always stand out. Also I couldn't get the Fading property of the CS_Cloud component to reflect any changes in rendering of the clouds at runtime.
    Is there a solution to this problem (clouds popping up when getting into camera farPlaneDistance, standing out in fogged scenes...)?

    Edit:
    Found a way to achieve what I wanted:

    Code (csharp):
    1. private void FadeCloud()
    2.     {
    3.         float fadeout = Vector3.Magnitude(this.transform.position - this.gameCamera.transform.position) / 4000f;
    4.         CS_Cloud csCloud = GetComponent<CS_Cloud>();
    5.         csCloud.Tint = new Color(csCloud.Tint.r, csCloud.Tint.g, csCloud.Tint.b, Mathf.Lerp(1f, 0f, fadeout));
    6.     }
     
    Last edited: Nov 20, 2012
  29. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    @Marco, you are right, the shaders totally ignore the fog. I simply couldn't find a good generally usable solution. But I am happy you found out that there are ways to get it working!
     
  30. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    Hi Dantus,

    I have been testing the free version before I buy. I love everything about it apart from one issue. When passing through the clouds I get the effect as demonstrated below:



    I was wondering if there is a way of passing through clouds with a more realistic effect rather than what looks like billboard textures passing over the solid. I hope that makes sense ;)

    Thanks

    Paul
     
  31. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    If you mean the straight border on the solid, the answer is no. If you have Unity Pro, you may try to use the deferred rendering pipeline with soft particles. That's the only way to improve that effect. After all, the clouds are billboards with the pros and cons.
     
  32. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    Hi Dantus,

    I've recently bought Unity 4 Pro so I'll explore that area, thanks for the prompt response/advise!

    Paul

    [Update] Out of curiosity is this pretty much the behaviour I can expect from any cloud system in Unity?
     
    Last edited: Dec 5, 2012
  33. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Yes, that's the usual behaviour you have to expect, as about all of them are based on billboards. Though there is one exception: Nuaj. I haven't used it, but it uses a different technique.
     
  34. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    Thank you Dantus. I will play around a bit more this weekend!
     
  35. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Today, I got a report about an error message that pops up when extracting the demo package and that the Shuriken backend for the Cloud System does not work properly with Unity 4.
    It seems that the error message is only related to a version issue, probably related to the demo package. I couldn't find anything that does not work because of that issue. I am going to resolve the Shuriken issue as soon as possible. Keep in mind that Shuriken is still pretty young and the Unity guys make lots of changes to it.
     
  36. RichardPF

    RichardPF

    Joined:
    Oct 29, 2012
    Posts:
    2
    I downloaded your free version and imported the package to Unity 4 (free version). Upon loading Unity threw this error message:

    Assets/Cloud System Demos/Scripts/Effects/ChangeShadingInfluence.js(6,23): BCE0018: The name 'CS_Cloud' does not denote a valid type ('not found').
     
  37. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It is important that you don't rename or move the project itself to a different directory, it must to be in the Plugins folder. That is required for the purpose that the Cloud System can be accessed by all programming languages that are available in Unity.
    As you move it to a different place, those kinds of errors happen.
     
  38. unity3dx

    unity3dx

    Joined:
    Apr 15, 2011
    Posts:
    175
    Your website is dead?

    [h=1]Oops! Google Chrome could not find www.edelweissinteractive.com[/h]Try reloading: www.*edelweissinterac*tive.*com
    [h=2]Additional suggestions:[/h]

     
  39. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    @unity3dx: Thanks for the information. I have the same with Chrome, but surprisingly it works in Firefox and also the Internet Explorer. I'll do my best to resolve the problem as soon as possible.
     
  40. unity3dx

    unity3dx

    Joined:
    Apr 15, 2011
    Posts:
    175
    Must be a DNS issue of some kind.
     
  41. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
    FYI: I'm on Chrome, too (latest version) and i can enter the website without problems. ^^
     
  42. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Thanks a lot for the information! That means, just to wait for at most one or two days until it finally works again.
     
  43. unity3dx

    unity3dx

    Joined:
    Apr 15, 2011
    Posts:
    175
    Not working here in Thailand in chrome, firefox and safari

    Tested from some dedicated windows 2008 server located in Germany, I get this with Firefox


     
  44. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It happens that some people can't access pages, while others can't. It happened to my page in the past and was working again after a few days. As I haven't changed anything and I already checked all my settings, I expect it is just a matter of time until it works again.
     
  45. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    I downloaded the free edition and am really impressed.
    But how can I access the fade of the Cloud from Javascript exactly?

    I tried this in an Update function, but it doesnt work for me:

    Code (csharp):
    1. CloudComponent = MyCloud.GetComponent("CS_Cloud") as CS_Cloud;
    2. CloudComponent.Fade = CloudComponent.Fade-5;
     
  46. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    @HenryChinaski, the Cloud System has a demo, which shows exactly that. When you open the EffectsFree scene, the purple clouds in the middle have a script named FadeCloud.js attached. The issue with your current script is that the fade range is from 0 to 1, but you you subtract by 5, which means the value is suddenly outside of that range and the cloud becomes invisible.
     
  47. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    Ah, thank you. I was not aware that there is a Demo inside. Sorry for that stupid question, but great support, even for the free edition. Great product.
     
  48. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    First, thanks for the great product, Dantus.

    I'm noticing heavy resource usage in the Profiler that's dropping my frame rate down from about 100 to 25-30 or so and about 25-30ms per frame. It's occurring on "Cloud`3.OnWillRenderObject()". In my scene I have a light source with a flare on it. What's strange is that when I move an object in front of the light source blocking out the flare the Cloud`3.OnWillRenderObject() resources become normal. As soon as the light's flare shows up again the frame rate drops.

    Do you have any suggestions on what to do, other than getting rid of the flare? :)
     
  49. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    Hmm, turns out it doesn't have anything to do with the flare. I'm not sure what's causing this slowdown exactly.
     
  50. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    can it's work in ios or android