Search Unity

[RELEASED] MadGoat SSAA and Resolution Scale

Discussion in 'Assets and Asset Store' started by Raul_T, Mar 25, 2017.

  1. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    Hi! I've just imported MadGoat into my project, and now my console full of the following error messages:
    Releasing render texture that is set to be RenderTexture.active!
    UnityEngine.RenderTexture:Release()
    MadGoat_SSAA.MadGoatSSAA:SetupRender(Single) (at Assets/MadGoat-SSAA/MadGoatSSAA.cs:281)
    MadGoat_SSAA.MadGoatSSAA:OnPreRender() (at Assets/MadGoat-SSAA/MadGoatSSAA.cs:172)

    Initially my project was on Unity 5.6 -- when I saw this error the first time. Than I updated Unity to 2017.1 (1f1) hoping that this'll help, but with no success. Still the same problem :( Disabling all components except basic ones on a camera where MadGoat lives does not seem to help.
    OS Windows 10 x64.
     
  2. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    I finally got it working by this simple fix:

    var cameraTexture = currentCamera.targetTexture;
    cameraTexture.Release();
    cameraTexture = null;

    currentCamera.targetTexture.width = (int)(Screen.width * mul);
    currentCamera.targetTexture.height = (int)(Screen.height * mul);
    currentCamera.targetTexture.Create();


    Some kind of strange Unity behavior? Anyway, tell if this fix is correct and maybe include this in next release.
     
    hopeful likes this.
  3. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello. I wasn't able to reproduce the issue but I'll include your fix if it doesn't interfere with other functionality. I'll look over it ASAP.

    Also have some new features and fixes regarding compatibility with third party offline render solutions, coming in the next update :)

    P.S. Sorry for late responses and not seeing all the emails/thread replies etc. I'm currently really busy with our studio's game project as our Kickstarter campaign will come later this year and we need to get things ready.
     
  4. orrinjones

    orrinjones

    Joined:
    Jan 14, 2017
    Posts:
    8
    Hi Can this be used for mobile platforms. I just want to downscale game resolution without affecting the HUD nothing else
     
  5. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello, I haven't personally tested on mobile but it should work just fine :)
     
  6. orrinjones

    orrinjones

    Joined:
    Jan 14, 2017
    Posts:
    8
    Okay I have purchased and tested it and it works just fine as you stated. very handy I actual learned a thing or two from playing with the source code.
     
  7. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    black screen (unity UI visible) - on android device, when built il2cpp (EDIT: mono too).
    webGL works ok.
    unity 5.6.3f1.
    SSAA settings like default 4x with F (FSSAA)

    adb last in log
    https://prnt.sc/gll9xy
    complains about not supported format for render texture
     
    Last edited: Sep 15, 2017
  8. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello, what device are you testing on?
    Try to fiddle around with the RenderTextureFormat at line 129 and see what works. Try with ARGB32 for example.

    I really have no experience with mobile gpus and what they support and not. :( The plugin was designed with high end platforms in mind
     
  9. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    ARGB32 is work on android, but slow fps (text updated by timer has lags),
    it's better on webGL due to hardware,
    our game contains many static images, need quality antialiasing,

    some other questions:
    -- why filtering params does nothing (sliders for cubic interpolation)?
    --which setting for SSAA will be like MSAA 8x? SSAA 4x or SSAA 8x (and which coeff? sqrt(8)?) for quality it should be better whan MSAA 8x? but now MSAA 8x is imho better than SSAA 4x, on thin lines
    but if I checkbox F it's blurred more than need , can I tune this blur?
    I append some screenshots, on all: left - unity with some setting, on right - flash.
    https://prnt.sc/glin04
    https://prnt.sc/glinfn
    https://prnt.sc/glinbs
    https://prnt.sc/glj97s
    FSSAA 4x is better on thin line (screen 2)(better than no F, on screen 3) but blurry on small scale (screen 4).
    -- may be you know which exactly antialiasing type is used in flash?
    I have tested many AA types, MSAA and SSAA give better results, but i don't know how to increase quality. Also exist some algorithms for vectorization with antialiasing on build time, not on post-processing, but it has some artifacts, and also take more time on runtime, which is costly on our svg runtime renderer
     
  10. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    Actually, this still happens, but much less often, so this "fix" is not a legit fix at all) Seems like MadGoat texture create request sometimes starts to interfere with something else. But with what? Even if I turn off everything on a camera, including built-in post-processing script, this still happens. But with my portion of code I get dozens -- not thousands -- of errors.
     
  11. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    SSAA x4 is really not ideal for mobile devices as it renders at double the resolution (width*2 x height*2) causing performance issues. The MSAA and SSAA can't be really compared directly since they work differently. SSAA renders the whole image at a multiplied resolution, while MSAA is only applied on object's edges at geometry level (iirc). The disadvantage to MSAA is that it's not supported in deferred rendering, where SSAA might come in handy.

    As for the FSSAA's being to blurry, I will add a slider to control the power of it in the future update.

    I'm somehow still unable to reproduce the issue. Can you upload a scene that does it somewhere and send it to me? Would help.
     
  12. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    I'll try to reproduce this behavior on a simple scene and if I succeed, I'll send it to you. Maybe it's some combination of post-processing effects (built-in and "foreign" ones) that causes this to happen.
     
    Raul_T likes this.
  13. icewuerfel

    icewuerfel

    Joined:
    Oct 22, 2016
    Posts:
    5
    Found a bug in the version 1.2, MadGoatSSAA.cs Line 711 ( ScreenPointToRay method). There is the position parameter but then you are using Input.mousePosition. That seems wrong :)
     
    Raul_T likes this.
  14. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Version 1.3 is now out :)
    f4c3453b-1630-423f-ad65-102135f2a2b3_scaled.jpg 2bc826a2-0639-441e-84c8-dd5d68ccdaef_scaled.jpg 1f419c36-4f74-4f0a-9477-0b51904a37a3_scaled.jpg
    Changelog:
    - Added MadGoatSSAA_Adv script dedicated for offline rendering and other similar workflows
    - Added compatibility with MadGoat Debugger & Benchmark
    - Added option to change the internal image format (under General tab)
    - Added slider to control FSSAA intensity
    - Fixed a bug that was causing FSSAA to corrupt alpha channel when using offline render systems
    - Improved Nearest Neighbor image filter
    - Fixed a bug inside the ScreenPointToRay method
    - Fixed a bug causing "usefilter" in screenshots to automatically turn on when taking screenshots from editor
    - Performance improvements to the demo scene
    - Minor UI fixes
    - Minor code improvements
     
    wetcircuit, hopeful and Freznosis like this.
  15. charlsZgy

    charlsZgy

    Joined:
    Apr 28, 2017
    Posts:
    1
    Can you help me see how this works?
    NullReferenceException: Object reference not set to an instance of an object
    MadGoat_SSAA.MadGoatSSAA.Update () (at Assets/MadGoat-SSAA/MadGoatSSAA.cs:145)
     
  16. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    I'll look into it as soon as possible.
     
  17. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    I was thinking that down scaling the resolution (for example 70% of 1920x1080) would increase performance. However it does not, can someone explain to me why this is? I'd like to be able to understand this asset better.
     
  18. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Maybe your game is CPU bound and not GPU bound?
     
  19. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    My project consists of multiple light sources and 1 singular model at a time (these models have upwards for 60k tris per). It is also pretty GUI heavy, but i've heavily optimized that portion. If I downscale, is performance supposed to go down? I'd assume it would go up, as opposed to when i upscale and performance goes down (which makes sense). If i turn on the plugin, i lose 30fps alone. Then another 10 fps if i move the slider below 100%. I lost 60fps if I move the slider up to 200%.
     
  20. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    It should indeed increase the performance unless your project is cpu heavy. I tested it again just to make sure I haven't broke something with the last update. First half is at native 1080p and second half is at 50% scaling. Performance scales almost perfectly when the project is not bottlenecked by the cpu.

    Something has to do with either your code or the draw calls of your scene.

    Anyway the fact that you lose 30fps just with the plugin set at 100% is odd. Make sure the OnClick() Compatibility mode is turned off in the General tab(if you don't need it) as it makes the scene to render twice in order to compute collision data for mouse.

    On what specs are you testing?
     
  21. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    Hello there,

    I just bought your SSAA solution and I can't wait to see the result in a serious project.

    I'm having however an issue with menus : I can't select anything even with the OnClick() option selected. I'm using the UMenu Pro asset for my menus and I don't know if there is any interference with it.
     
    Last edited: Dec 4, 2017
  22. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello, it definitely looks like a compatibility issue. I'll try to get the UMenu Pro asset and find the issue ASAP. Sorry for any inconvenience.
     
  23. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    Okay, thanks. :)

    Also, I'm having really bad performance with Screen Space Reflections (Post-Processing Stack) with your SSAA ; it's dropping from 60 FPS to 15 or less. Is SSR really not usable with SSAA ?
     
  24. Deleted User

    Deleted User

    Guest

    Hi,

    Your update it's ready for VR ?
    Thank you ;)
     
    LostPanda likes this.
  25. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    110
    Looks very good, when will you support VR?
     
  26. LangTao92

    LangTao92

    Joined:
    May 13, 2017
    Posts:
    15
    Yes,I expect your production aviable to VR ready!
     
  27. trzmiel

    trzmiel

    Joined:
    Nov 5, 2013
    Posts:
    28
    Just bought your plugin. It looks great. But it does not cooperate with AVI recorder "AV Movie Capture "(https://www.assetstore.unity3d.com/en/#!/content/2670) which I use for a long time. I have black video in captured AVI. This is strange because I have tested a lot of post-processing plugins, antialiasers and they always works great with my favourite recorder. Could you point me any direction, please?
     
    Last edited: Jan 8, 2018
  28. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    MadGoat SSAA & Resolution Scale 1.4 has been released!

    The 1.4 version has just been released to the asset store, and marks an important milestone for our plugin, coming with all new VR support, and the fresh out of “alpha” 360 screenshot mode. With this comes a small bump in pricing, from 10$ to 15$, which we consider to be fair given the amount of time and effort we have put into this asset and its functionality from the initial release to this version.


    What’s New?

    • Added MadGoatSSAA_VR script dedicated for VR devices
    • Added option to select screenshot/panorama save file format
    • 360 panorama screenshot mode is now out of "alpha" state
    • Added easier to read color theme for the inspector when using unity pro (not tested)
    • Added button to open online documentation in General Tab

    What’s Fixed?

    • Fixed major bug causing MadGoatSSAA_Adv to throw errors and cause black screens when added to camera.
    • Fixed 360 panorama color issue when using super-sampling
    • Fixed a bug causing Panorama settings to reset when taking 360 pictures from editor
    • Updated all the shaders to support singlepass stereoscopic rendering
     
    FoxAlphaX likes this.
  29. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi,
    I'm trying to use madgoat SSAA in my project, the results are great but also there is a problem I don't know how to fix.
    I'm using unity's camera API worldToScreenPoint to make some of my UI follow the actual object in the scene like this:
    upload_2018-2-9_14-40-49.png

    But after I turn on the SSAA, this projection got wrong:
    upload_2018-2-9_14-41-56.png

    Any ideas how to avoid this?
     
  30. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello. The SSAA component has its own API for these functions, that need to be used in order to get correct results.

    https://docs.google.com/document/d/...zsn73_AdWNtCqCj5I/edit#heading=h.n2h41inpumic

    You will have to use these while ssaa is enabled, and unity's Camera.WorldToScreenPoint() when it is not.
     
    hopeful likes this.
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
  32. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Subscribers of Unity Plus and Unity Pro can now get MadGoat SSAA & Resolution scale with a 20% discount as part of Unity's Asset Store subscriber benefit :)
     
  33. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    Hi the MadGoatSSAA doesn't seem to work correctly when the camera clear flags is set to depth only?
     
  34. TchPowDog85

    TchPowDog85

    Joined:
    Dec 29, 2015
    Posts:
    124
    Can someone help me out?? Getting massive performance hit with arguably worse quality

    w/ MadGoat x2 SSAA only - no FSSAA: (with FSSAA the fps is at about 39)


    w/ Unity Post Processor Stack - Extreme Quality setting:


    Notice the framerate difference in the top left.

    MadGoat SSAA settings:
     
  35. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    Supersampling is heavy, there's no way around it. You can see the difference in the triangles that are only occupying one pixel or less, in those cases the SSAA example has smoother lines and transitions while the post-processing isn't doing anything since it has no information.

    With that said it definitely looks like the first image is not being smoothed enough, the edges are too sharp.
     
  36. TchPowDog85

    TchPowDog85

    Joined:
    Dec 29, 2015
    Posts:
    124
    What do you mean by "image is not being smoothed enough"? Are you talking about the actually geometry? If so, nearly everything you see there has at least a 1-segment beveled edge. Many of the the objects have two-segment edges.

    Or are you talking about the "smooth" setting for the object?
     
  37. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I still have issues about UI with this asset.

    I dont know why but it reduces the size or increases the resolution of the UI (Camera canvas) depending of the x2 or x4 quality. If x2 UI will be scaled like 0.75 the normal size and 0.5 if x4.

    And I still cannot interract with UIs even with OnClick support enabled.

    It's not urgent yet I wish it would work perfectly with UIs.
     
    ScourgeGames likes this.
  38. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    Yes, mouse input is currently not working even with OnClick support enabled. I have a top-down game that uses movement with mouse position and using SSAA won't work in it's current implementation.
     
  39. Imperatoss

    Imperatoss

    Joined:
    Mar 24, 2018
    Posts:
    51
    Has someone already with this assets and unity 2018.1? Is it working fine?
     
  40. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    I just wanted to make you guys aware of a conflict with Cinema Pro Cams. When combined it locks up the current Unity 2018.
     
  41. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    Quick question: our project is built around rendering to a texture, which is both drawn to the screen and written out to a file at a specific resolution. Is MadGoat SSAA compatible with this setup?
     
  42. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    bump
    same question.
     
  43. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    122
    Hi. Just curious if using MSAA x2 on top of FSSAA x2/x4 would be a good idea. Would it be overkill or would that extra edge aa be beneficial, especially since I'm working in VR.
     
  44. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello and sorry for the absence in the past two months. We've been focusing on our game project as the planned release date comes closer and closer. I'll try to answer all the questions in this post.


    Can you provide more info on how the Canvas component is set up? Make sure the canvas in discussion is set to scale with the screen resolution. Otherwise it will become smaller as you increase the SSAA resolution. (Just like increasing the resolution on a screen without increasing the screen size has the same effect. The change in DPI is what causes it.)

    Can't say a lot without testing myself. I'll see what I can do to get it, and get back to you if something comes up. However if that plugin doesn't play well with cameras that render to target textures it's not in my hands to fix the issue, as the SSAA system can't work without it.

    Unfortunately it is not compatible with depth only cameras at this point. The internal render camera that the SSAA is using doesn't send depth data to the main camera. It was a planned feature but I came across a problem while implementing camera depth copy in unity 2017 and I kinda gave up on it. I'll take a look to see if things got better with newer unity versions or if there's other ways to copy depth buffer from one camera to another.

    That really depends on the hardware used and the complexity of the scene. FSSAA x4 already takes out a lot of performance itself, so MSAA x2 on top of it would only make it worse. Using FSSAA and MSAA would mean you are using 3 different AA methods at the same time (SSAA + FXAA and MSAA), so yes I'd consider it overkill, but again it's up to you and the hardware you are targeting.
     
  45. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    122
    I decided to try it out but I'm having issues. I've attached the MadGoatSSAA_VR script to my camera and I'm getting this weird double image effect (see attached). I'm using Unity 2018.2.0f2, SteamVR camera, forward rendering, and single pass. It seems to be the single pass that's messing it up. When I switch to multi pass it works fine. Any idea why?
     

    Attached Files:

    Last edited: Aug 2, 2018
  46. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    I'll check the issue out. Thanks for letting me know and sorry for the inconvenience.
     
  47. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    592
    i want to buy this asset i asked around but didn't hear that will serve my needs , i need to reduce the resolution to 648p i was told it's not possible with asset even if i reduce the resolution by half the performance will stay like you are using SSAA can you confirm that ?
     
  48. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    Does it work with HDRP? i tried it but it only gets gray screen
     
  49. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello, I have updated the asset to version 1.5.1 in which the issue should be fixed. Can you try it out and tell me if it's also fixed on your side?

    That's not true. Reducing the resolution with our SSAA plugin does improve the performance in the same way as reducing the actual screen resolution does. However if the framerate is limited by factors that are not related to the graphics processing power, such as high drawcall number, poorly optimized scripts, slow cpu, etc., there won't be much performance gain from reducing the resolution.

    Here you can see the difference between ssaa off (native screen resolution) and ssaa x0.5 on my laptop (i7 and gtx950m)
    off:
    https://i.imgur.com/67XNdLG.jpg
    0.5x:
    https://i.imgur.com/1f91reH.jpg

    HDRP (or any SRP in fact) is not supported yet, as the cameras in the new pipeline are working somewhat different when it comes to rendering, and affects the way in which our plugin works. Support will come in the future, but I don't have any exact date on that. It will probably be there when the new render pipelines leave the "Preview" state :)
     
    blackbird likes this.
  50. saxovr

    saxovr

    Joined:
    Dec 13, 2017
    Posts:
    25
    Hi there, just bought this asset and am trying to use the adaptive mode using the MadGoatSSAA_VR.cs component. It seems to me that the framerate sampling is not being done and the adaptive mode is not working? The base class onEnable method is not being called in the MadGoatSSAA.cs class and so the AdaptiveTask courroutine is not running. I am on 2017.4. Seems like the base class methods are private and without calling base.Enable from the MadGoatSSAA_VR.cs class, the relevant setup of the AdaptiveTask courroutine is not done. Am I missing something? Any advice? Thanks
     
    Raul_T likes this.