Search Unity

ProFlares - Ultimate Lens Flares for Unity3D [RELEASED]

Discussion in 'Assets and Asset Store' started by ProFlares, Nov 3, 2013.

  1. Loden_Heathen

    Loden_Heathen

    Joined:
    Sep 1, 2012
    Posts:
    480
    Apologies if this has already been asked; but I am working on a space game and my ships have shields which can project from the ship a fair ways; these need colliders and so cause flares to occlude is there any way to specify layers to ignore when checking for occlusion or can you point me to where in the scripts I might look to adjust the ray cast?

    Thanks
     
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    Can't you just put the flares on a "flare" level and have a second camera show what's on the flare level?
     
  3. JulianButler

    JulianButler

    Joined:
    Nov 17, 2013
    Posts:
    15
    Hey Hobstob, about your tip to use debug mode to change the flare scale - it'll revert to it's default limit of 2000 if you adjust any other parameter on the flare inspector. You can however go and edit the proFlareInspector.cs script in the Editor folder and on line 253 set the upper limit of the UI slider to be whatever you like. I'm doing a space thing with very far away flare sources and needed bigger flares too. Apologies if you already know this etc.

    -j

    P.S. I have been happily able to use ProFlares in my oculus project now using the VR helper script above. Just a suggestion for anyone else who could only find the youtube clip on how to setup proFlares, those steps in the tutorial clip [and the main proFlare batching nodes it creates] are unnecessary for Rift projects. The leftEyeAnchor batching node is all you'll need. Just make sure to follow the instructions and unzip the provided OculusRift.zip archive and replace the contents of the ProFlaresOculusHelper.cs script with the example provided above.
     
  4. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    Hey, I'm trying to add Flares to a new project, but nothing is showing up. I'm sure it's a simple issue with the setup, but the documentation site is down, so I'm working in the dark.
     
  5. kritchie

    kritchie

    Joined:
    Mar 17, 2013
    Posts:
    7
    Just checking to see how the progress is going on doing per-pixel occlusion of Pro Flares. I cannot use the physics system on all of our occluding geometry because it is too costly.

    This single feature would allow me to ship with this asset. Otherwise I'm afraid I cannot use it, which would be a shame because it looks absolutely phenomenal.
     
  6. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    +1
     
  7. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hey Braddas,
    have you succeeded to solve this?
    as I am having exactly same issue...
    Culled flares still take some time to fade out which looks really wrong in the middle of solid wall...

    @ProFlares any news on the update?
    Cheers
     
  8. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Also is it possible to get rid of this spam in console?
    and this one

    it gets really annoying as being spammed all the time during play
     
  9. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154

    Hi Almakos,

    Do you have an example scene/project with the issue? As it would really help me get to the bottom of the problem. If you do just PM me a link.

    As for the debug read outs, if you double click them in the console. It should take you to the line in the code and just comment out the line.

    Regards,
    David.
     
  10. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hi David,
    Unfortunately I don't have a good test scene for this as we are using custom character controller and I can't share any of the production assets, but if you create a solid wall with collider attached and several flares behind the wall with culling enabled
    simply by standing in front of the wall and looking around while still facing wall you will notice how flares pop out at the camera borders and fade away

    What's happening is that flare comes into frustum and starts to draw, but then it realises that being occluded by wall and starts to fade away...if that makes any sense


    Another question:
    ProFlares eats big amount of CPU on mobile....And lots of that is because of constant raycasting to check whether they are visible or not
    is it possible to have flares culled by Unity's Umbra occlusion culling or any other way to optimise performance on mobile?
    Easiest example: parent bunch of flares to a building and when that building being culled, disable flares inside it entirely

    Thank you
     
  11. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Ok I will take a look.

    Good idea on linking with buildings that are culled with umbra, I will see if i can get it to work.

    David.
     
  12. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    with 180 proflares scene size changed from 15mb to 50mb
    loading time increased from 12 to 35 sec
    and of course performance hit was too dramatic to be able to play on the device

    I remember some time ago there was a pdf with manual but I can't find it anywhere...are there any suggestions to decrease ProFlares footprint and make it usable again?

    Thank you
     
  13. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Wow thats a lot of flares!

    I'm not sure why it would increase your scene sizes or slow the loading so dramatically, I will investigate to see if there is something I can do to improve your situation.

    180 flares is more than imagined people using, especially if they are complex multi element flares. You can get away with this on PC but on mobile its a lot to ask.

    Reducing the number of elements in your flares could make a big difference to the overall performance cost.

    I'm planning to have a totally revamped documentation and tutorials for the end of March/early April along with the long promised update.

    David.
     
  14. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    indeed that number is a bit extreme, but it shows performance impact much more dramatically than let's say I have 5 flares and my scene is 2 mb bigger...
    It's just those flares are spread out through whole map and usually player won't see more than 10 at the same time, but the total count is quite high indeed...

    If there was way not to care about other 170 flares when I am inside the building, that would work ... in theory.
    Anyways the update is extremely anticipated on our side as those flares are sexy as hell, but we will have to look for something a bit less expensive at the moment.

    Thank you
     
  15. bome99

    bome99

    Joined:
    Sep 14, 2009
    Posts:
    119
    Hi there

    Love the flares.
    Is there any fix for the unity 5 beta?
     
  16. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Are you having problems? I had a number of users mention that its working fine in the Unity5 Beta.

    David.
     
  17. Sexydonut

    Sexydonut

    Joined:
    May 25, 2013
    Posts:
    3
    Hello,

    Is your pro flare package compatible with unity 5?

    Best regards,

    H.
     
  18. Sexydonut

    Sexydonut

    Joined:
    May 25, 2013
    Posts:
    3
    Sorry for the quick post. Here is more details:

    When I try to import the proflare package, I get the error message: "Failed to create a shader variant in 'ProFlareShader'. You probably have precompiled shader asset from an old Unity version."

    Any idea how to fix this?

    Thanks,

    H.
     
  19. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Hi,

    I don't have access to the Unity 5 Beta unfortunately .

    Are you upgrading a project or importing ProFlares into a new project?

    If your upgrading maybe try deleting and re importing the shader. This will force it to recompile and might fix it..

    David.
     
  20. JulianButler

    JulianButler

    Joined:
    Nov 17, 2013
    Posts:
    15
    Hi David,

    I released my Oculus demo scene incorporating Proflares. Took some time tuning things and getting the sun to look nice. I optimised performance by reducing the number of elements per flare as you suggested. Worked a treat although I'm on the PC and have a bit of headroom to spare in this scene.





    Thanks for making Proflares!

    -julian

    P.S. here's a link to the oculus dev forum post if anyone with a DK-2 wishes to try it out: https://forums.oculus.com/viewtopic.php?f=28&t=20072
     
  21. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    How to be if I want to use fog? ProFlares do not seem to work with in a nice way...
    Thanks
     
  22. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154


    Looks awesome Julian, great work. I'm glad ProFlares was able to help :)

    Do you mind if I post it on my blog? (When its back up and running that is...)

    It can work with fog, as it would in the real world fog would occlude the flare sources. If you set your flares to fade with distance a the same rate as your fog it can work.

    David.
     
  23. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Doesn't work for me for some reason...thinking where I could mess up
     

    Attached Files:

  24. Protolith

    Protolith

    Joined:
    Jan 18, 2013
    Posts:
    16
    Hi David,
    I'm using v1.05 and when I add a setup to a scene, I'm getting some NullReferenceExceptions. When I hit the Force Refresh button in the inspector, my flares begin working and the errors go away. The problem is its doing this in play mode since I add the setup during play mode. Can this be fixed, or can you think of a workaround? Possibly run the ProFlareBatch script at run-time?

    NullReferenceException: Object reference not set to an instance of an object
    ProFlareBatch.Start () (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:186)

    NullReferenceException: Object reference not set to an instance of an object
    ProFlareBatch.UpdateGeometry () (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:753)
    ProFlareBatch.UpdateFlares () (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:333)
    ProFlareBatch.LateUpdate () (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:323)

    NullReferenceException: Object reference not set to an instance of an object
    ProFlareBatchInspector.OnInspectorGUI () (at Assets/Third Party/ProFlares/Editor/ProFlareBatchInspector.cs:179)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/Inspector/InspectorWindow.cs:1124)
    UnityEditor.DockArea:OnGUI()

    Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?
    UnityEditor.DockArea:OnGUI()

    When I run the Force Refresh manually, and everything begins working normally, this is the output in the console..
    ProFlares - Rebuilding Geometry : ProFlareBatch (MegaAtlas)
    UnityEngine.Debug:Log(Object, Object)
    ProFlareBatch:ReBuildGeometry() (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:363)
    ProFlareBatch:Update() (at Assets/Third Party/ProFlares/Scripts/ProFlareBatch.cs:312)
     
  25. JulianButler

    JulianButler

    Joined:
    Nov 17, 2013
    Posts:
    15
    Go ahead, you're more than welcome!

    -j
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I'm trying to manually fade out a flare from script as I transition between scenes. I tried setting the GlobalBrightness on the flare, but as far as I can tell that isn't actually used by anything at runtime. Am I missing something? It looks like the editor is the only thing which actually uses it..
     
  27. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    I don't have access to the ProFlares source at the moment so I would have to do a little test to see exactly how to go about doing it.

    One thing that might help is a script that added a flicker effect. It might get you close to what you need to do.

    I should be back on ProFlares full time in a few weeks so a lot of stuff should happen then.

    I hope this helps in the mean time,

    Regards,
    David.


    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class FlareFlicker : MonoBehaviour {
    5.    
    6.     public ProFlare flare;
    7.    
    8.     private float tempBrightness;
    9.      
    10.     public float Amount = 0.5f;
    11.    
    12.     public float Speed = 1f;
    13.    
    14.     public AnimationCurve curve = new AnimationCurve(new Keyframe(0,0f),new Keyframe(0.2f,1f),new Keyframe(0.4f,0.2f),new Keyframe(0.5f,1f),new Keyframe(0.7f,0.2f),new Keyframe(0.9f,0.5f),new Keyframe(1,0f));
    15.    
    16.     void Start () {
    17.         flare = GetComponent<ProFlare>();
    18.        
    19.         if(flare == null){
    20.             Debug.Log("No Flare Connected");
    21.             this.enabled = false;
    22.             return;
    23.         }
    24.        
    25.         curve.postWrapMode = WrapMode.PingPong;
    26.  
    27.         tempBrightness = flare.GlobalBrightness;
    28.     }
    29.    
    30.     void Update () {
    31.         flare.GlobalTintColor = new Color(flare.GlobalTintColor.r,flare.GlobalTintColor.g,flare.GlobalTintColor.b, tempBrightness-(curve.Evaluate(Time.time*Speed)*Amount));
    32.     }
    33. }
    34.  
     
  28. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Has anyone got ProFlares to work with the official Unity 5 using Oculus Rift? The demo works for me only on the left eye and it's odd that the instructions state that there should be two ProFlareBatch components (should there be one for each eye?)
    "To use, select your OVRCameraController then use option. : 'Window->ProFlares->Create VR Setup On Selected OVR Controller' This will add a ProFlares VR setup, this includes Two ProFlareBatch components".

    In the demo there is only one Proflare batch component and it was default on the left eye and the Proflare batch mode was set to standard rather than VR by default..
     
  29. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    I've been using this for a while now and it's an amazing product. However, for some reason, I can't seem to get any flares to render at ALL, not even in the editor. This is a new problem, as I have it working in a few other scenes, but even if I just create a new scene and setup the ProFlares stuff, it doesn't work - nothing shows up when I drag one of the flare prefabs into the scene. If I create a new project, everything works fine - so something has happening in my main project and I can't for the life of me figure out what.

    It's doubly bizarre, because I have them working in in other scenes, but adding any new flares doesn't work. Strangely enough, if I copy/pase an existing flare into another scene, it will work. Any idea what the hell could be happening here? I've already tried deleting the plugin and re-importing it, but to no avail. Please if you can offer any solutions/suggestion. Thanks!
     
  30. GreenLion

    GreenLion

    Joined:
    Oct 7, 2013
    Posts:
    3
    I've been using Proflares successfully with Unity 4.6.3 for the last few months, but now can't get it to function in Unity 5.

    If I copy the folder structure across from another project I get error messages that begin as "Pro Flares - NOOOO.... It must of been deleted, resetting to first in list..." as soon as I drag a flare into the scene. It can't seem to find the individual elements that make up a flare. Each element appears as a black square in the preview and has its name replaced by a random string of numbers (4357468635463423574467f4678987790076 etc...)

    If I download Proflares fresh and import directly into my project I get no error messages, but the same end result - no visible elements and garbage numbers in place of element names.

    This doesn't seem to be a problem in projects that were created in Unity 5. With a fresh project, Proflares functions correctly. The problem seems to arise in projects that were initially created in older versions.

    Has anybody else encountered this issue? Can anybody suggest a fix?
     
  31. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154

    Hi,

    I was not aware of the Unity5 upgrade issue, I will take a look at it right away to see if there is a simple fix.

    I'm now actively working on ProFlares so you should see a number of updates over the coming weeks, also ProFlares.com is now finally back online.

    David.
     
    hopeful and OnePxl like this.
  32. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Hi,

    I'm currently working on your issues when upgrading a project to Unity5.

    I can't manage to recreate the problem, are you doing anything interesting when upgrading your project? How I would normally upgrade a project is make a duplicate of the project as a backup then open the original with the latest version of Unity.

    From what you are saying, It looks like the ProFlaresAtlas definition is being lost some how, when the ProFlare checks itself against the atlas it can't find elements.

    Are you using custom atlases? All of the included atlases come with a json file that defines the texture positions, you can use this to rebuild any corrupt atlas by dragging the json file onto the slot in the ProFlareAtlas. If you then have a backup of the Flare presets they will probably relink correctly.

    Any extra information you can give me will really help get to the bottom of this problem.

    Regards,
    David.
     
  33. GreenLion

    GreenLion

    Joined:
    Oct 7, 2013
    Posts:
    3
    Hi David,

    Thanks for your response.

    We didn't do anything special when upgrading. We use SVN, so we simply opened the project in Unity 5, let it do it's auto-update, fixed a few compile errors in our scripts and recommitted the project.

    I'm not using any custom flares yet - just trying to load the example flares from the MegaAtlas set. You are correct about the json file - it does seem to be the cause of the problem. The Atlases have lost the link to the json file, and relinking it doesn't work - I drop it into the correct spot and it refuses to hold.

    Interestingly, trying to relink the json does affect it in some way. Once I've attempted to relink, all elements in a flare that is dragged into the scene are named 'Caustic_Abstract_06' and take on the appearance of this element. Previously all elements were drawing black and were named as a gibberish string of numbers.

    I'm still getting the same errors as before though, repeated for each element:

    Pro Flares - Where did my elements go? - Lets try and find it. -537065637472756d5f506f696e745f3031
    UnityEngine.Debug:LogWarning(Object, Object)
    ProFlare:LateUpdate() (at Assets/ProFlares/Scripts/ProFlare.cs:394)


    and

    Pro Flares - NOOOO.... It must of been deleted, resetting to first in list. :( -537065637472756d5f506f696e745f3031
    UnityEngine.Debug:LogError(Object, Object)
    ProFlare:LateUpdate() (at Assets/ProFlares/Scripts/ProFlare.cs:411)


    EDIT 1: I should include the fact that I'm using a clean version of ProFlares, freshly downloaded from the Asset Store and imported into the project. During the import process it tells me there are elements in the package that need to be unpdated to Unity 5 (presumably because it was created in a version of Unity 4).

    EDIT 2: Even in my freshly created Unity 5 project, the Atlases seem to retain no link to the json file (the field reads as 'None (TextAsset)' BUT the flares function correctly, which all elements present and named correctly.

    Screenshot attached, showing missing json file alongside functioning flare.
     

    Attached Files:

    Last edited: Mar 30, 2015
  34. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154

    Hi,

    Sorry for the confusion, the json file import is just a onetime thing, the json file just contains the UV data for all of the elements in the atlas. The isn't any kind of link between the atlas and the json file after the import.

    As an insight into how the relationship between the ProFlares and ProFlaresAtlas works, A ProFlare can only use elements that are stored in the ProFlaresAtlas array of element definitions. For performance reasons when the main loop of the ProFlareBatch is executed, it only uses the index of the element to access the UV data for the element, comparing string names would be too slow. This leaves you with a problem if the order of the elements in the ProFlaresAtlas array changes the indexes would be wrong. Code that only runs in the editor constantly checks to see if anything in the ProFlaresAtlas array has changed, and corrects any indexes that might have changed. This code can be seen in the LateUpdate of the ProFlare.cs.

    To fix your project, I not sure how the data has become so corrupt. I think the only way to restore it would be to rebuild the atlases from the json file. As the flares them selves have been damaged beyond repair its probably necessary to reimport all of the preset assets. If they are already being used within a scene is to then revert them to the prefab.

    Hope this helps,

    Regards,
    David.
     
  35. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Hello,
    Is the Rift package up to date? i'm using SDK 0.4.4, getting this...

    Assets/Editor/ProFlaresOculusHelper.cs(21,17): error CS0246: The type or namespace name `OVRCameraController' could not be found. Are you missing a using directive or an assembly reference?
     
  36. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Try this update to the ProFlaresOculus helper I posted a little while back. I will be adding support for the latest SDK in the next update which I should be ready to submit to the asset store next week.

    David.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4.  
    5. public class ProFlaresOculusHelper : MonoBehaviour {
    6.     const int menuPos = 10000;
    7.    
    8.     static int FlaresLeftLayer = 8;
    9.     static int FlaresRightLayer = 9;
    10.  
    11.  
    12.     [MenuItem ("Window/ProFlares/Create VR Setup On Selected OVR Camera",false,menuPos+30)]
    13.     static void CreateVRFlareBatchCamera () {
    14.  
    15.         OVRCameraRig _OVRCameraRig = null;
    16.         GameObject OVR_GO = null;
    17.        
    18.         if(Selection.activeGameObject){
    19.            
    20.             _OVRCameraRig = Selection.activeGameObject.GetComponent<OVRCameraRig>();
    21.            
    22.             if(_OVRCameraRig == null){
    23.                 Debug.LogError("ProFlares - Please Select Your OVRCameraRig");
    24.                 return;
    25.             }else{
    26.                 OVR_GO = Selection.activeGameObject;
    27.             }
    28.         }else{
    29.             Debug.LogError("ProFlares - Nothing Selected");
    30.             return;
    31.         }
    32.  
    33.         Camera[] cameras = OVR_GO.GetComponentsInChildren<Camera>();
    34.        
    35.         Transform CameraLeft = null;
    36.        
    37.         Transform CameraRight = null;
    38.  
    39.         for (int i = 0; i < cameras.Length; i++)
    40.         {
    41.             if(cameras[i].name == "LeftEyeAnchor")
    42.                 CameraLeft = cameras[i].transform;
    43.            
    44.             if(cameras[i].name == "RightEyeAnchor")
    45.                 CameraRight = cameras[i].transform;
    46.         }
    47.  
    48.        
    49.         GameObject batchGOLeft = new GameObject("ProFlareBatch_VR");
    50.        
    51.         batchGOLeft.layer = ProFlaresOculusHelper.FlaresLeftLayer;
    52.        
    53.         batchGOLeft.transform.parent = CameraLeft;
    54.        
    55.         batchGOLeft.transform.localPosition = Vector3.zero;
    56.        
    57.         batchGOLeft.transform.localRotation = Quaternion.identity;
    58.        
    59.         batchGOLeft.transform.localScale = Vector3.one;
    60.        
    61.         ProFlareBatch batchLeft = batchGOLeft.AddComponent<ProFlareBatch>();
    62.        
    63.         batchLeft.FlareCamera = CameraLeft.camera;
    64.        
    65.         batchLeft.FlareCameraTrans = CameraLeft;
    66.        
    67.         batchLeft.GameCamera = CameraLeft.camera;
    68.        
    69.         int layerMaskLeft = CameraLeft.camera.cullingMask;
    70.        
    71.         batchLeft.mode = ProFlareBatch.Mode.SingleCamera;
    72.        
    73.         batchLeft.SingleCamera_Mode = true;
    74.        
    75.         batchLeft.zPos = 1;
    76.     }
    77. }
    78.  
     
  37. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Thanks! that did it. Seeing something odd, I cannot move my player when the ProFlareBatch is active. I'm using UFPS...

    Edit:
    This also breaks SECTR streaming for me. I'll come back to it later, the next version you mentioned.
    Thanks
     
    Last edited: Apr 1, 2015
  38. XeviaN360

    XeviaN360

    Joined:
    Jun 3, 2010
    Posts:
    181
    Hi, i'm just requesting an update because i'd like to buy this package.
    Is ProFlares compatible with Unity5 and Oculus Rift DK2 ?
    Thank you
     
  39. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    I'm actually working on this at the moment, it will be fully compatible with Unity5 and Oculus rift in the next update. I should be submitting the update in a few days.

    I will post here as soon as the update has been submitted.

    Regards,
    David.
     
    OnePxl likes this.
  40. XeviaN360

    XeviaN360

    Joined:
    Jun 3, 2010
    Posts:
    181
    Thank you David!
     
  41. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    Just wanted to say a big thanks to David for helping with the problem I had. Fast, responsive, and on a sunny Sunday too. Very happy!
     
  42. XeviaN360

    XeviaN360

    Joined:
    Jun 3, 2010
    Posts:
    181
    Any news? We are short on time D:
     
  43. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Hi,

    I just wanted to add an extra feature before I publish to the store.

    It's nothing sexy, JSON import/export for flares. Useful for porting and backing up flare settings.

    David.
     
  44. tbg10101_

    tbg10101_

    Joined:
    Mar 13, 2011
    Posts:
    192
    Quick bug report.

    I get this error sometimes while exiting my game in the Windows standalone player:
    Code (CSharp):
    1. NullReferenceException
    2.   at (wrapper managed-to-native) UnityEngine.Component:get_gameObject ()
    3.  
    4.   at ProFlareBatch.OnDestroy () [0x00000] in <filename unknown>:0
     
  45. tbg10101_

    tbg10101_

    Joined:
    Mar 13, 2011
    Posts:
    192
    Also, this comment in ProFlareBatch.cs:
    Code (CSharp):
    1.     //First checks if the flare is already in the list, if not adds it and rebuils the Flarebatch Geometry
    'rebuilds' is spelled incorrectly.
     
  46. Steve2375

    Steve2375

    Joined:
    Mar 28, 2015
    Posts:
    42
    Quick question: In the script ProFlaresBatch.cs the raycast is done from the light flare to the camera and not from the camera to the light flare. Is there a specific reason for this?

    I have the problem that my camera is sometimes inside a box collider that represents a cockpit and wants to see the flares that are "outside". Or is there a better way to solve this? (unfortunately I cannot move the collider to the IgnoreFX layer)
     
  47. ProFlares

    ProFlares

    Joined:
    Nov 1, 2013
    Posts:
    154
    Hi Steve,

    It was a while ago when I wrote the ray cast code, I'm sure there was a reason for doing it that way round but I can't recall it.

    But each flare has its own layer mask settings so you don't need to rely on the IgnoreFX layer, just tell the flare to ignore the 'CameraBoxCollider' Layer.

    Regards,
    David.
     
  48. NorthernVisionStudio

    NorthernVisionStudio

    Joined:
    Oct 18, 2013
    Posts:
    60
    For my car lamps, I had to reverse the direction in the ProFlares code and it worked better for me.
     
  49. NorthernVisionStudio

    NorthernVisionStudio

    Joined:
    Oct 18, 2013
    Posts:
    60
    I have the same need "z-buffer based occlusion". In my project, the God Rays feature uses this occlusion method. But, the rendering of the feature is entirely in the shader. I tested copying just a few pixels of the depth buffer each frame, but it really slowed things down. The point of that was to cue the ProFlare on whether it was occluded or not based on Z Depth.

    I think the solution I will go for is to implement the flare rendering entirely in the shader, such as the included Bloom 'complex' mode.

    David, it would be great to hear your opinion on how to solve this problem. I have 200,000 trees and even if I used physics, it wouldn't be accurate to occlude between the alpha cutout leaves.

    Thanks

    Geo
     
  50. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Zbuffer occlusion's probably best for desktop. Wouldn't take any extra frame time really. But the problem is he would have to read the zbuffer texture since he has to affect the behaviour of the sprite or flare, not just individual pixels. So that means he'd need to sample the zbuffer texture for the center of the flare. I don't know how fast (slow) that would be.

    Unless rendering is also moved to geometry/fragment shader.

    Still, I'm interested as well since it would indeed look pretty crap coming through speedtree foliage (large visible flares in front of a bushy tree).