Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Reflection Probes for procedurally generated scenes

Discussion in 'Unity 5 Pre-order Beta' started by Void24, Oct 30, 2014.

  1. Void24

    Void24

    Joined:
    Oct 15, 2013
    Posts:
    50
    Hello folks!

    I have really been impressed with the new light and material models in the Unity 5 beta. I have noticed however that procedural content is basically out of luck for much of it. (This was expected, cant bake content in real time)

    I have been unable though to get even a basic reflection probe working without clicking a hard coded bake button. Even when using the code example provided for adding a reflection probe during run time, I get a blank contribution.

    Am I missing something? They work fine if I make a scene and click [BAKE].
     
  2. Void24

    Void24

    Joined:
    Oct 15, 2013
    Posts:
    50
    This has been answered in another thread, so I will leave the answer here for others potentially interested in the same problem.

    "In the current beta only baked reflection probes are available and they are baked in the Editor."

    Shame. Not everyone drags models into the scene and clicks bake. Even heavily hand authored games now regularly re-arrange content in real time.

    Looking forward to the inclusion of dynamically updated reflection probes as described in the docs.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,914
    Doesn't the old way of making real time cubemaps still work? There are a bunch of scripts around that do that.
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,053
    We are working on adding reflection probes that can be generated at runtime.

    The hard part in this has been making the convolution filters run fully on the GPU so this is feasable in realtime, but we managed to do it and it's freaking fast. Generation of reflection probes is timesliced so it's realistic to do it while the game is running.
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,914
    I was referring to the old school non-convolved cubemaps. Those can still be generated at runtime right now, right?

    Also... Cool!

    Does that mean, realtime updated convolved cubemaps are in for 5.0? As amazing as the dynamic GI is, if you bake your cubemaps with some sort of dramatic lighting setup and then you change the lighting at runtime, things end up looking really wrong because the cubemaps never update, which was kind of a bummer.
     
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    Regarding reflection probes - is there a pretty decent cg/frag compatible macro to calculate the uvs so it might be used in custom shaders, and also how does one pass which probe to use in these style of shaders? We've a lot of custom shaders but would certainly benefit from Unity's own reflection probe system as opposed to what we're doing atm.
     
  7. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    so it will be in 5.0?
     
    sqallpl likes this.
  8. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,053
    Thats the plan.
     
  9. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I hope so
     
    sqallpl likes this.
  10. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    494
    I'd also be happy if you could trigger baking from the application rather than the editor even if its not suitable for realtime. I can build the level and hold at a loading screen while it bakes if that was possible.

    As it is probe only bakes are extremely quick in the editor for the size of my levels.
     
    shkar-noori likes this.
  11. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    @Joachim_Ante Do you think it will be possible to attach one of these real time probes to a movable transform? Say, for a character?

    Seems to me we could reflect dynamic objects with that! As well as get round the blending from probe to probe problem.
    @kurylo3d
     
  12. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    685
    This is an interesting theory for sure. I suppose the only problem would come from the fact that you would have to change the box projection volume on the fly as well according to your surroundings. In a corridor like scene, though, this wouldn't be too bad, you could conceivably just do six recasts to determine the dimensions and then project the cube from there. However, even using such a technique, in this restricted type of scene, you wouldn't be able to reflect dynamic objects... You'd somehow have to combine it with ssrr to get reflections for objects that would exist within the cube map parallax projection.
     
  13. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    @macdude2 I take your point, particularly if you're planning on using this probe for reflections in the walls and floor.

    I was really just suggesting using it JUST for the main character, and if the probe's camera origin is positioned at the character's location then the parallax correction becomes much less needed. People have used infinite box projections in that situation for years and it's looked great.

    I'm thinking of a character with burnished steel armour or something.
     
  14. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    827
    Reflection probes can be moved and with the probe set to "custom" you can already render a realtime cubemap for it, you just won't get rough surfaces because of the (at the moment) missing convolution calculations.
     
  15. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    226
    Awesome. What about dynamic light probes?
     
  16. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    @Roni92 Light probes are already dynamic :)
     
  17. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    226
    By dynamic I mean like automated creation of them in key locations ;)
    Let's say I have 3x3km extensive map, with rarely forests and buildings. Can you see someone setup manually little spheres next to every forests, buildings etc where light changes? I can't ;)
     
    shkar-noori likes this.
  18. Void24

    Void24

    Joined:
    Oct 15, 2013
    Posts:
    50
    This is awesome news. Thanks!

    I don't necissarily need them FAST fast. Just fast enough that I can load time bake a few dozen of them. Exciting!
     
    shkar-noori likes this.
  19. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    @Joachim_Ante Do you think it would it be possible to use the convolution filters on a regular render texture as well?

    Sometimes I think it's still useful to be able to use a regular old second camera to render reflections. For example, for an actual mirror.

    It would be really cool to be able to use the convolution to make a nicely steamed up / scuffed up mirror.
     
  20. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,183
    When I set my reflection probes Refresh mode to "Via Scripting" - whats the needed code to call a baking-process, e.g for every 10 frames/seconds?

    Solved:

    Code (JavaScript):
    1. var myProbe:ReflectionProbe;
    2. var everyXFrame:int=10;
    3. private var i:int;
    4.  
    5. function Update () {
    6.  
    7.     i++;
    8.     if(i==everyXFrame){
    9.         i=0;
    10.         myProbe.RenderProbe();
    11.     }
    12. }
     
    Last edited: Feb 20, 2015
    shkar-noori likes this.
unityunity