Shiny: Unity Demo’s Screen-Space Raytraced Reflections

Fancier, more realistic reflections will come as standard in Unity’s next major version (screen-space raytraced reflections, if you want to get technical), and we should probably pay more attention to the engine considering it’s almost everywhere nowadays. So here, let’s come coo over how nicely light reflects around a bedroom in this newly-released tech demo. You can download it to have a fiddle on your own computer, if you’d like, or just watch this:

The demo’s showing off the difference SSRR would make to architectural visualisations (which Unity is often used for), but you can imagine shiny things in games too, can’t you? To simplify it massively, SSRR renders reflections more accurately than many other common techniques, so lighting seems more realistic. Look, I won’t pretend to be an expert, just check out this close-up comparison:

Unity hasn’t invented this idea, of course, but it’s a major engine used by squillions of devs so improvements to it go a long way. Not that every Unity game will use it (most won’t), but it’s nice to have the option. Anyway, look I just wanted to point out something shiny and pretty because I know people coo over shiny things. You can download the demo for Windows and Mac and have a fiddle yourself, changing colours and textures of objects in the bedroom to see how it changes the room. Shiny things!

44 Comments

  1. Text_Fish says:

    All that expensive tech and they couldn’t even iron the fucking bedclothes.

    • SanguineAngel says:

      This comment is a thing of beauty and you have my gratitude

    • Premium User Badge

      cockpisspartridge says:

      I can’t recommend saying that to the Mrs. I did once, and all hell broke loose.

  2. Clavus says:

    Makes Unity look very Unreal Engine 4-ish. It’s quite amazing how you can get all this stuff for free nowadays.

    • Czrly says:

      This is true. Epic and Unreal do have the edge in the marketing department, though. There are so many ways Unity could have blown us away with their demonstration video but randomly flicking through texture-sets like a thirteen year-old flicks through television channels does not strike me as a good way.

      • rgbarton says:

        If where talking about marketing department Unity’s greatest strength is also its greatest weakness. For it prides itself on how friendly it is to independent developers, the only problem is a lot of hack developers end up using unity and recycled and store bought unity assets to flood steam with shitty games that everybody associates with unity.

  3. Neutrino says:

    You’ve completely broken your website. Pagination no longer works on the article list, the list just goes on and on for ever loading ever more articles.

    The obvious and problematic issue with this is that once the page has loaded a hundred or more articles any attempt to move the scrollbar causes the page to jump half a dozen articles at once, hence making it completely unnavigable.

    Did someone in your web department think they were being clever?

    • BobbyFizz says:

      Are you using Netscape Navigator??

    • TheMightyEthan says:

      Infinitely scrolling pages are standard nowadays. Who in the world actually grabs the scroll bar to scroll?

    • mike2R says:

      Its a fairly common design choice these days, and getting more popular. Personally I prefer it, since you can just keep scrolling down while more content is loaded for you in the background, without having to click a link and wait for each page to load. It also means that if you’ve scrolled down several “pages” worth and want to find something you passed a while back, you can do a Ctrl-F search on the page to help find where you were. Rather than having to guess which page you were on and go back to it.

      Accurate scrolling by using the scroll bars may be more difficult I guess, if you have scrolled down a huge amount, but its a problem you’d have with any very long web page, and there are other ways of scrolling on any device (eg using the mousewheel) where the precision is not dependent on how big a document you are viewing to deal with this.

    • rabbit says:

      mouse wheel

    • Neutrino says:

      Oh I see! I’m supposed to actually be grateful for the opportunity to spend minutes at a time pedalling backwards and forwards on the mouse wheel, as if RSI is a worthy objective all by itself.

      • FriendlyFire says:

        Page Up/Page Down. Up/Down arrows. Touchpad swipe. Inertial scroll wheels. Middle-click mouse move.

        There are so many ways to navigate a web page in this day and age and it would appear you’ve not looked at any of them. Congratulations for missing the past ten years of HID evolution.

        • Faxmachinen says:

          Don’t have a scroll wheel, thank you very much. Arrow and page keys only work if the page has focus, which would be easy enough to achieve if websites (including RPS) didn’t run those fucking full-page background ads that open a new tab when you click them.

          • noodlecake says:

            Get a mouse with a mouse wheel? You’re telling me you can’t afford £3/$5?

          • Faxmachinen says:

            Brilliant suggestion. Now to fix your problem, you should get yourself a keyboard without keys.

            Scroll wheel doesn’t work when the page doesn’t have focus anyway though.

      • rabbit says:

        good god you’re ridiculous

      • Stardog says:

        It’s called “endless scrolling” in the industry. It’s nothing more than patience-testing wank made for mobile users at the expense of desktop users.

        They should implement a system that works for both.

        • noodlecake says:

          I am a desktop user and it’s not an issue for me, except if I’ve gone through a lot of pages and my computer starts to struggle a bit. The only time I can imagine that happening is because of porn.

    • AlexClockwork says:

      So that’s why I could only see a page on mobile and couldn’t go further. :-/

    • Czrly says:

      I agree. “Infinite scrolling” is just evil and annoying.

      If you lose your browser session or tab, you lose your place. There’s no way to refresh the page or return to it from your browser’s history. You are forced to scroll using a wheel, page-down key, arrow keys – all of which are much much slower (and less accurate) than the scroll bar if you want to scroll down a long way. You cannot use Ctrl+F to find things that haven’t loaded yet (with paged lists, you can use ctrl+F and just click one “next page” button to keep jumping forward instead of having to induce an Ajax call by scrolling.). It breaks search engines – they cannot return a result that links to “page 2” because there is no “page 2” URI. It relies on Ajax so people for whom the script fails (or is blocked) can only ever see one page (paged results are much more low-tech, using only URL parameters and GET requests) …

      I could go on but, honestly, I couldn’t be bothered. There are many people more eloquent, more educated and more qualified to comment on this, Randall Munroe among them: link to xkcd.com

      • zarniwoop says:

        I was about to go apeshit about this.

        But turns out the RPS version of infinite scrolling tells you what page you’re on at all times. So as you scroll down, the url will change to page 2.

        So this actually works.
        link to rockpapershotgun.com

        I am fine with this implementation.

  4. ZoeM says:

    Screen space reflections are actually a very straightforward, no-nonsense technique in a deferred rendering engine. They’re essentially the same idea as parallax mapping – March a ray through the depth buffer until you find a collision – except with the direction of the ray being computed based on the surface normal at the source position. Still, it’s good to have the effect come standard.

    It’ll be interesting to compare the performance of this technique to my current pseudo-realtime reflection probes. (Feasible mostly as my game is set in space, and there aren’t a ton of individually reflective objects) Might be good as a higher end alternative setting.

    • DanMan says:

      It’ll have GI, too, so they’ll be pretty close to the big boys.

    • Geebs says:

      Yup, a screen space reflection shader takes up about 20 lines of code. I’ve written a really fancy one that fell back to rendered “rear view” reflections and finally a cube map, and that’s all of 30 lines. Dummy screen space global illumination is just an ambient occlusion shader that reads from a colour buffer as well as depth.

      “Raytraced” sounds impressive but in terms of rasterising it just means “inefficient”.

      • Geebs says:

        (By the way, screen space reflections are not “more accurate”, they are an appalling hack that happens to work ok most of the time)

        • KillahMate says:

          Screen space reflections are absolutely far “more accurate” than no reflections. And almost all realtime graphics techniques are variably appalling hacks.

          • Geebs says:

            For a single-room scene like that, it would be more accurate to use a cubemap. SSR is absolutely riddled with rendering artefacts (e.g. thing in front of scene is reflected in objects behind it, double reflections). Try using SSR on a convex object and get back to me…

          • Czrly says:

            I wouldn’t call them “appalling” hacks but rather “embarrasingly ingenious” ones.

      • rabbit says:

        wasn’t doom raytraced? and wolfenstein? i thought raytracing was the name given to the technique that birthed all the real early FPS games …. is this a different technique using the same theory?

        • Geebs says:

          Doom and Wolf3d used a bunch of clever tricks in the way they structured their level data which made finding the right polygon to draw a lot more efficient, but they weren’t ray tracing per se.

          The screen space reflection technique used here works like this:
          1) draw everything in the scene so that you have a record of the “normal” at each pixel. The normal is perpendicular to the surface of whichever thing is at that position.
          2) at the same time you’re recording the distance from the camera to every pixel – the “depth buffer”
          3) for every pixel on the screen:
          – work out the direction from the camera to that pixel
          – reflect the direction from the camera in the normal at that pixel
          – take a bunch of little steps in the new direction until you hit something in the depth buffer (you can tell you’ve hit something by comparing the distance from the camera of the ray you are “marching” with the distance already recorded in the depth buffer)
          – that tells you what’s reflected in your object.

          Screen space reflections save you having to draw and light everything in the scene twice, but marching a ray is a slow, iterative process and the size of steps you take relies on guessing; plus you can’t reflect anything that’s not already on screen. Putting a reflective sphere close to the camera utterly destroys SSR.

  5. zeep says:

    Ah Ikea.
    This gave me an idea for the bedroom floor.

    • Urthman says:

      You can tell the furniture is crappy plywood because you can change the veneer of woodgrain with the touch of a button.

  6. Saarlaender39 says:

    Ok,…I’m 43 years old, and I have seen a lot of “Flokatis”(*) in my life, due to some weird taste in my family – but not a single one, where the hairs/fibers(?) stood so erect.
    Honestly – I’d fear my feet getting speared by stepping onto this abomination.

    So – meh! ;p

    (*)I have no clue, if the term “Flokati” is actually used/known in English, too (maybe “Sheperd’s Carpet”?).

  7. KillahMate says:

    So here, let’s come coo over how nicely light reflects around a bedroom in this newly-released tech demo

    I’m only moderately familiar with Unity’s lighting setup, but I’m guessing most of what you’re referring to (ie the light bounce) is unrelated to SSRR – the bounced light is actually being done by Geomerics’ Enlighten global illumination middleware, which now comes standard with Unity 5. You can even see the intraframe GI propagation when the material properties or Sun’s position change abruptly.

  8. Megadeth dude says:

    To the editor: if you don’t know the subject at hand, don’t pretend you do and try squeezing a lengthy article out of it full of mistakes caused by your ignorance. Thank you.

    • rabbit says:

      to the commenter: it’s possible to be critical of a piece in a way which will help to improve future articles. you chose instead just to be rude.

    • rabbit says:

      also dave mustaine is a fucking joke

  9. PampleMoose says:

    Yes, but can you actually move the bedsheets? I swear, the first game to have good looking realistically movable bedsheets can have all my money.

  10. Premium User Badge

    Don Reba says:

    It still looks Unity’y.