Skip to content

Request for Feature: Screen Space Reflections #8248

Closed

Description

@bhouston

Activity

  1. jgwinner commented on Nov 16, 2017

    @jgwinner

    My only concern here is that it doesn't work really well with stereo Rendering, so it would be tough in WebVR, but please don't think I'm against the feature :) 👍

  2. bhouston commented on Nov 16, 2017

    @bhouston
    ContributorAuthor

    Just turn it off in VR. A lot of the costly effects do not work well in VR. UE4 even suggests going with forward rendering rather than deferred in the VR context for speed purposes.

  3. jgwinner commented on Nov 16, 2017

    @jgwinner

    Exactly, which is why I'm not against it.

    I stumbled on here while working on a React Native implementation of reflection mapping, Screen space reflections are great for non-VR games.

  4. mrdoob commented on Nov 16, 2017

    @mrdoob
    Owner
  5. jgwinner commented on Nov 16, 2017

    @jgwinner

    Nice!

    Although even on Nightly I get "VR Not found" but I'll check it out.

    My particular problem (which isn't the OP's) wasn't to solve the reflection problem, it was how to create three.js native objects, and render them within ReactVR's existing scene and renderer. I got OK results, the only thing was the background image was a little strange, so reflections look weird - but that's as expected, React VR creates an inside-out sphere for the background pano. I haven't tried a cube map, but that might work better.

    I'm WAY over on pages on the book so I'll probably leave the existing demo the way it is, but this looks like a great technique.

  6. gkjohnson commented on Jul 28, 2018

    @gkjohnson
    Collaborator

    I've been wanting to learn more about this type of effect so I tried my hand at making a composer effect for it. There's still some work that could be done but here's what I put together based on Kode80's implementation and Morgan McGuire's blogpost (the sponza scene takes a bit to load in):

    https://gkjohnson.github.io/threejs-sandbox/screenSpaceReflectionsPass/

    Some things to do next would be cleaning up the jitter artifacts, glossy reflections (with a blur pass or mip map sampling + depth map pyramid) and multiple bounces via temporal reprojection.

    If anyone is actually interested in using this effect I'd be happy to work with someone to polish this out a bit more!

  7. WestLangley commented on Jul 29, 2018

    @WestLangley
    Collaborator

    @gkjohnson Sweet. Your scene may be too complex, however. In any event, your demo seems to be largely unresponsive. Can you create a simpler example? Also, an on-off toggle would be nice.

  8. gkjohnson commented on Jul 29, 2018

    @gkjohnson
    Collaborator

    @WestLangley

    your demo seems to be largely unresponsive

    Are you able to see the demo? The screen may be black for a few seconds or so because the Sponza scene will take a little bit to download depending on your connection.

    If it's not working at all I can take a look at creating something simpler -- it works on my Pixel 2, though

    an on-off toggle would be nice.

    Turning the "intensity" slider down to 0 looks the same as turning it off, though ray tracing is still happening so there won't be any performance difference in that case if that's what you're looking for.

  9. WestLangley commented on Jul 29, 2018

    @WestLangley
    Collaborator

    @gkjohnson Got it. On my mac, your demo is black for awhile, and then the frame rate is 4.

  10. gkjohnson commented on Jul 29, 2018

    @gkjohnson
    Collaborator

    @WestLangley It's a very resolution-dependent effect so if you make your window smaller the framerate will probably go up. Doing the ray tracing at a lower resolution and then compositing with the full resolution buffer would help make the effect more scalable, but I haven't taken the time to optimize it.

  11. added this to the rXX milestone on Jul 29, 2018
  12. bicubic commented on Aug 23, 2018

    @bicubic

    @gkjohnson how would you mask it to reflective surfaces only? If I crank up the intensity everything starts reflecting and there are some pretty jarring artefacts.

  13. gkjohnson commented on Aug 23, 2018

    @gkjohnson
    Collaborator

    @bicubic At the moment no surface attributes are being taken into account but it shouldn't be too hard to add a basic version of that. You could fade or blur the effect based on the specular / roughness attribute of the material.

    Unfortunately I have no use for the effect at the moment so I haven't gone out of my way to add these other features. Like I mentioned before, though, if there's interest in using it for something I'd be happy to collaborate and round out the effect!

  14. looeee commented on Aug 23, 2018

    @looeee
    Contributor

    You could fade or blur the effect based on the specular / roughness attribute of the material.

    It would be more useful to be able to specify objects as reflective / non-reflective. At the moment everything is reflective, including things like curtains and plants. Ideally, only the floor should be reflective in this demo.

  15. 20 remaining items

  16. gonnavis commented on Aug 25, 2020

    @gonnavis
    Contributor

    @WestLangley Thanks! but when I use Spector.js on Sketchfab, I got "No frames with gl commands detected. Try moving the camera." error.

    I doubt that after SSRPass is optimized as I said earlier, the performance of Sketchfab will still lead significantly. Especially in the case of continuous rendering and no downgrade strategy as @bhouston @looeee mentioned. I even think that if don’t talk about the implementation details, the core concept of this SSRPass may be already the optimal solution.

    @gkjohnson Thank you for your information and support! I'll keep improving.

  17. mrdoob commented on Aug 25, 2020

    @mrdoob
    Owner

    @gonnavis

    I recommend Safari's Graphics tab:
    Screen Shot 2020-08-25 at 8 00 45 AM

    If you use Linux you can use Epiphany (aka Gnome Web):
    https://webkit.org/downloads/

    I don't think there is any WebKit build for Windows though...

  18. gonnavis commented on Aug 25, 2020

    @gonnavis
    Contributor

    @mrdoob Thanks! Though I mainly use windows, I'll try on Mac if needed.

    But I'm wondering whether it is allowed to upload Sketchfab's code to open source library, if find any useful stuff such as glsl function?

    This SSRPass's structure is base on three.js SSAOPass, and demo scene uses three.js webgl_shading_physical example, key pointToLineDistance function comes from wolfram.com, and others mainly wrote by my own (of course is based on a lot of other previous experience, especially other three.js examples ). I think these all no any problem, but is it the same case of Sketchfab's code?

  19. WestLangley commented on Aug 25, 2020

    @WestLangley
    Collaborator

    Thanks! but when I use Spector.js on Sketchfab, I got "No frames with gl commands detected. Try moving the camera." error.

    Scroll the mouse to zoom the camera. That should be sufficient to trigger Spector.

    Also, use a static scene in your example that does not require a render loop. Currently, the frame rate is too low to be acceptable.

  20. gonnavis commented on Aug 25, 2020

    @gonnavis
    Contributor

    @WestLangley Succeeded in this scene, thanks!

  21. bhouston commented on Aug 25, 2020

    @bhouston
    ContributorAuthor
  22. gonnavis commented on Aug 25, 2020

    @gonnavis
    Contributor

    @bhouston OK, for reference only if necessary.

    I even often feel that, after receiving some inspiration, keep looking at other people’s paper and code is more difficult than writing it myself, especially when in different environment.

    For example, this time, I was mainly inspired by this tut, but it is difficult to clearly understand the meaning of the text at start, and because of the different coordinate system he uses, and I don't know how to run the .cxx file, so I only read a little text and hardly read the code. So in the end, the two pictures imgA imgB that helped me the most.

  23. gonnavis commented on Aug 26, 2020

    @gonnavis
    Contributor
  24. gkjohnson commented on Sep 19, 2020

    @gkjohnson
    Collaborator

    Inspired by @gonnavis I finally got around to trying out a few new things in the SSR implementation I posted a couple years ago so I thought I'd share here. I have no plans to use this in a real project so it's not optimized and at this point and it's become a heap of different SSR features but I've learned most of what I want to from it so I'm going to call it "done" for now. Perhaps there are a few things others can take, though. There are still things that I know could be added or improved but maybe if I ever pick it back up I'll leverage some features in WebGL2 to simplify things.

    Some of the new features:

    • Support for blue noise ray jitter so the intersection pattern is less regular.
    • A depth and normal-weighted upscale / blur from a lower resolution march texture to preserve detail.
    • A couple of eye-tweaked approaches to rendering glossy reflections with jittered samples and mipmaps.
    • Support for normal maps and alpha maps.

    It is a pretty intensive effect but I feel like with a mix of reflection upscaling, blur, jitter, and low step count you could something that works well especially with smaller embedded canvases rather than full window apps. By resolving the final image over multiple frames like has been discussed in #14048 you could probably get decent glossy reflections, as well. Of course as has been mentioned elsewhere the reflections still won't be really right without separate passes for diffuse and whatnot but there's always something else to improve.

    Here are a few screenshots with higher step counts:

    No Glossiness Multisample Glossiness Depth Hierarchy Glossiness
    image image image

    And here's the demo:

    https://gkjohnson.github.io/threejs-sandbox/screenSpaceReflectionsPass/

  25. Ben-Mack commented on Sep 27, 2020

    @Ben-Mack
  26. removed this from the rXXX milestone on Feb 27, 2021
  27. 01000001khan commented on Aug 6, 2024

    @01000001khan

    Was support for disabling reflections on rough surfaces ever added? This is something I'm struggling to figure out in my project. I don't need diffuse reflections on rough surfaces, just the ability to turn them off per object or material.

  28. gonnavis commented on Aug 6, 2024

    @gonnavis
    Contributor

    I've tried #21487, but full PBR integration was too challenging for me and I couldn't complete it yet. However, it might still be helpful as a reference.

  29. 01000001khan commented on Aug 6, 2024

    @01000001khan

    Oh wow, good luck! I had thought roughnessCutoff might be what I was looking for, but I guess not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions