Search Unity

See Through - Fade away objects in line of sight

Discussion in 'Assets and Asset Store' started by cygnusprojects, Nov 27, 2015.

  1. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Don’t miss out on any action as from now on you can always make sure your player character is visible. With the See Through asset from Cygnus Projects it is possible to fade away objects that are in line of sight.



    Features:
    • No special shaders and post effect
    • Easy to set up
    • Fully documented source code included
    • Allow linked objects (when only a part of the object is obscuring the sight you can fade away the complete object)
    • Works with any game object including legacy trees and SpeedTrees

    Overview video:



    Screen shots (with included standard assets)
    Even if the player is only behind a part of the column the whole column renders transparant:

    and even when the player is behind a second column he's still visible:

    Now available on the Asset Store

    Questions? Comments? Feel free to post them here or contact me at support@cygnusprojects.com.
     
  2. HelixU4

    HelixU4

    Joined:
    Jan 25, 2013
    Posts:
    61
    Does this work even when the terrain tree painter have been used? And not placed the tree by hand
     
  3. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @Saturn-Ent, no I don't support this feature.
    Let me explain: The system always returns the terrain as the object it is hitting. Of course it it possible to get all the trees within that terrain but it has some huge drawbacks:
    1. One has to check all trees on every hit to determine which ones should be faded
    2. The tree prefabs placed on the terrain should all have some sort of collider.
    In my opinion this will make your project slowing down way to much, so it is best to determine the playable area and place fading trees where you know the player can be obscured by it.
     
  4. HelixU4

    HelixU4

    Joined:
    Jan 25, 2013
    Posts:
    61
    Bah, I use top down camera but the trees are in the view often. The terrain is quite big so placing the trees by hand would be a massive task and it would draw down the performance.
     
  5. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    You don't have to place all trees by hand, but yeah if you are building some kind of an open world game you can't predict the paths players will take. Don't see the link why manual placing trees are source of performance though as when you use occlusion culling (specially with a top down camera) trees not visible won't even draw. But yeah, anyway, thanks for the interest in the asset though.
     
  6. Dunfee

    Dunfee

    Joined:
    Jan 14, 2013
    Posts:
    14
    Hey!
    Few questions because this looks like a solution I can use!
    Does the tree need to have a collider on it?
    Is there a way to smooth fade in/out instead of jumping straight to the full transparency?
     
  7. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @Dunfee, thanks for the interest. To answer your questions:
    - Yes the tree needs to have a collider as the manager component is ray casting towards to player to detect the game objects that need to be faded.
    - Not at the current stage of the product. I'll add this feature request to the list of improvements and see if it's possible to implement it for a next version.
     
  8. Dunfee

    Dunfee

    Joined:
    Jan 14, 2013
    Posts:
    14
    Thanks for the info!
    One last question. Is there a way to keep the shadows the same while fading out the object?
     
  9. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Not in any way I can think off, as the materials is changed to a transparent alternative the shadows do indeed vanish (which is quite noticeable but not something that can be fixed due to the nature how the system works). While I was typing this I was wondering if baking should make this possible but then you can't use dynamic sky boxes (where the sun or moon is changing positions in game) any longer.
     
  10. Dunfee

    Dunfee

    Joined:
    Jan 14, 2013
    Posts:
    14
    I have a sort of solution to this but it involves having two versions of the same gameobject. One that doesnt cast shadows and another one with its mesh renderer set to "shadows only"

    Not ideal but it seems to be the only way that it will work at the moment
     
  11. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @Dunfee, that's indeed another way to achieve the desired results. But as you mention, not that ideal as well. I think it will always be a trade-off.
     
  12. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Version 1.0.3 is now live and does add support for orthographic camera's.
     
  13. RavenWoodsDE

    RavenWoodsDE

    Joined:
    Jul 13, 2015
    Posts:
    12
    Would it work with 2018's terrain trees?
     
  14. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    @Kougasama, thanks for your interest in See-Through.
    The asset does only work with manually placed trees, not with those placed on the terrain with the tree placement tool. Also as the trees need to have a collider to work with the system, having those for all your trees would have an impact on your game performance.
     
  15. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Update 1.0.4 is now life on the asset store, added a demo scene and script to show how to use the asset in case you have a target that is instantiated.
     
  16. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi all,
    In case you are still eyeballing the asset and in doubt to buy it now or later just a heads up that the price will increase towards 8$ beginning April 2022.
     
  17. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Hello there,
    I'm using a Fixed camera that follow the player, so for the user there's no way to move the camera.
    For that reason I can't even use obstacles avoidance system for the camera.
    So could happen that the camera get inside other objects, (for example a tree)
    Reason why if RayCasting is made from camera, the occluder object couldn't be detected 'cause the norma are on the opposite way of the camera view point, so the raycast should be made from the target toward the camera.
    Is it possible?
     
  18. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @MaximilianPs, sorry for the late reply as it seems Unity forum didn't notify me.
    Thank you for your interest in SeeThrough.
    I will have to check this user case and will get back to you during the course of next week.
     
    MaximilianPs likes this.
  19. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @MaximilianPs,
    I had a look at your user case and while it is not possible by default I made it an extra feature of the asset. I will be launching an update on the asset store soon (later this week or next one). However if you already own the asset let me know by sending your invoice id to my support e-mail and I can provide you already the updated scripts.
     
    MaximilianPs likes this.
  20. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Don't worry, I worked on it myself and also realized that replacing the material would be a problem for a single-dev like me, however if I bought your asset (I will send the invoice in PM) your work has me helped a lot to get what I need, so it was still worth buying :D
     
    cygnusprojects likes this.
  21. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Ok great, thanks for the update. Wishing you the best with your project.
     
    MaximilianPs likes this.
  22. weblanzarote

    weblanzarote

    Joined:
    Jun 11, 2020
    Posts:
    4
    Greetings.
    I just got this asset and I'm trying to make it work in my project. I have a script to instantiate the player in the level and I'm not sure how to integrate the spawner that comes in the demo for this purpose. maybe you could help me.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace PLAYERTWO.ARPGProject
    5. {
    6.     [AddComponentMenu("PLAYER TWO/ARPG Project/Game/Level Respawner")]
    7.     public class LevelRespawner : MonoBehaviour
    8.     {
    9.         [Header("General Settings")]
    10.         public float fadeOutDelay;
    11.         public float fadeInDelay;
    12.  
    13.         [Header("Respawn Settings")]
    14.         public bool resetExperience;
    15.  
    16.         protected Coroutine m_deathRoutine;
    17.         protected Coroutine m_respawnRoutine;
    18.  
    19.         protected Entity m_player => Level.instance.player;
    20.         protected Transform m_respawn => Level.instance.playerOrigin;
    21.  
    22.         protected virtual void InitializeCallbacks()
    23.         {
    24.             m_player.onDie.AddListener(OnPlayerDie);
    25.         }
    26.  
    27.         protected virtual void OnPlayerDie()
    28.         {
    29.             if (m_deathRoutine != null) StopCoroutine(m_deathRoutine);
    30.             if (m_respawnRoutine != null) StopCoroutine(m_respawnRoutine);
    31.  
    32.             m_deathRoutine = StartCoroutine(DeathRoutine());
    33.         }
    34.  
    35.         protected IEnumerator DeathRoutine()
    36.         {
    37.             yield return new WaitForSeconds(fadeOutDelay);
    38.  
    39.             Fader.instance.FadeOut(() =>
    40.             {
    41.                 m_respawnRoutine = StartCoroutine(RespawnRoutine());
    42.             });
    43.         }
    44.  
    45.         protected IEnumerator RespawnRoutine()
    46.         {
    47.             var position = m_respawn.position;
    48.             var rotation = m_respawn.rotation;
    49.  
    50.             m_player.Teleport(position, rotation);
    51.             m_player.Revive();
    52.  
    53.             if (resetExperience)
    54.                 m_player.stats.ResetExperience();
    55.  
    56.             yield return new WaitForSeconds(fadeInDelay);
    57.  
    58.             Fader.instance.FadeIn(() =>
    59.             {
    60.                 m_player.inputs.enabled = true;
    61.             });
    62.         }
    63.  
    64.         protected virtual void Start() => InitializeCallbacks();
    65.     }
    66. }
     
  23. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hope my answer in yesterdays mail does cover your question, if not don't hesitate to reach out again.