Search Unity

Marmoset Skyshop - Image-Based Lighting Tools [RELEASED]

Discussion in 'Assets and Asset Store' started by monkeyscience, May 31, 2013.

Thread Status:
Not open for further replies.
  1. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123

    according to monkey it seems the gloss map also adjusts the specularity.. less gloss less visible spec.. unless im mistaken on what hes saying.
     
  2. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I did try this and it looked really strange... and I was at my shader limit :(
     
  3. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Also heres another question. The lightmappign extended. I read somewhere that i can include the image based lighting in it. Question is though will that work on a per ojbect basis, objects that use different sky boxes independently... not an overall scene ibl?
     
  4. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
  5. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    That one is a toughie... Though, I will figure out a workaround...
     
  6. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    yea cause having that ability makes it easier to help show off baked occlusion on a per environment basis...
     
  7. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I am aware that in Unity 4 you can bake GI per object, but that is cumbersome as hell... BUT, you could do your GI baking, and then capture a probe :)
     
  8. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    But with that per object baking... doesnt it mean the rest of the scene does not effect that object? or am i wrong.
     
  9. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I have never tested it... I do know, that each static object will have their own lightmap... the only thing you could do is use custom cubemaps (provided you baked the GI beforehand)
     
  10. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705


    Hey guys, could we keep this a thread of Skyshop Q&A? Discussions on the merits Unity's baking pipeline, or best practices for beard transparency are fun, but maybe belong in a separate thread (or as PMs).
     
  11. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    lol it is on topic... were talking best lighting practice with marmoset shaders with seperate skyboxes in lightmaps.. hence the ability of baking seperate objects with seperate skyboxes with lightmappign extended skybox per bake.
     
  12. superme2012

    superme2012

    Joined:
    Nov 5, 2012
    Posts:
    207
    Hope this one is on topic? and if already answered please point me in the correct direction.

    DDO to Unity Skyshop:

    Not sure the Gloss is getting picked up in unity as the alpha of the specular.. It’s a straight export from DDO, (Gloss as “A” of Specular).

    Specular is defiantly there, but the surface seems very flat in comparison with the DDO skyshop
     
  13. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Just to be clear, you are experiencing the Skyshop, (input panorama, 3 output cubemaps, compute button, etc) clearing? Or the actual Sky objects you drop in your scene?

    The Skyshop window clears every time you close it or Unity is closed. Its more of a content generation tool and doesn't really save state or a "sky project" file anywhere.

    The Sky objects in your scene (3 cubemaps + bunch of sliders) should definitely not be clearing during app restart, script compile, or any reason. If this is happening, please let support@marmoset.co know.

    As a work-around, I would recommend attaching the Skyshop window as a tab somewhere in your UI to keep it open. If you do loose your inputs, the "Edit Active" button will pull the three cubemaps from the currently bound sky into Skyshop as the outputs. You'll still need to locate the input panorama yourself, skies don't know the assets they were generated from.
     
  14. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Do all your lights cast shadows? Marmoset materials catch shadows from every light source. This is unlike Unity's built-in shaders, which catch shadows from only one light-source in Forward rendering. This could explain the slow-down as you are adding lighting to your scene.
     
  15. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Crank the "Specular Sharpness" slider all the way to 1.0. This value defines the maximum gloss, what white gloss-map pixels correspond to.
     
  16. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Edit Active was what i was looking for. It's the little things.
     
  17. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    How can I increase the amount of AO in my scene. I was a Lightmap Extended user before starting with Skyshop. The AO settings seemed to have a lot more effect. Thanks.
     
  18. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    A tricky problem with a complicated answer.



    This question is commonly asked in the form of 'Halp, everything is too bright!' Here is an illustrated answer: http://www.polycount.com/forum/showpost.php?p=1903767&postcount=58

    As of Skyshop 1.04 I've also added some sliders to help balance the lightmap and sky lighting contributions:
    http://forum.unity3d.com/threads/18...ols-RELEASED?p=1373384&viewfull=1#post1373384

    When Unity lightmaps things, the AO settings only occlude the light that is being baked. You can either use Lightmapping Extended to bake the sky lighting into your lightmaps and let all diffuse IBL come from the LM, or you can bake just direct lights (no GI, no Beast IBL), and let the Sky object contribute all ambient, image-based lighting.

    If you opt for the latter, you'll need to take care of shadowing the IBL yourself. Use the Marmoset/Occlusion/ shaders to add an AO map to your materials. AO can be baked in a modeling package or 3rd party app of your choice and should use the second texture coordinate set (uv1). Make sure your models are exported with this UV set and that Unity is not generating baking UVs and overwriting them.

    I don't know how to bake and use ambient occlusion with Beast as input to the Occlusion shaders, but it may be possible.
     
  19. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Hmm... I'm a little bit ahead of that then, I was just being greedy. Is there a performance benefit to either one of the methods you mentioned, with and without the GI, IBL baked in? I'm still feeling my way through this, I don't know what's going to work best for me. The problem it's currently at least an hour bake process, so it's not easy to run a lot of tests.

    Quick question about your transparent shades, they don't let my directional light through. Everything in these images is baked. I've been turning my glass of before I lightmap the scene. Thanks,
     

    Attached Files:

  20. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Beautiful renders! There is no performance difference between baking with IBL and using Skyshop's IBL. Qualitatively I can tell you baked IBL looks way better. The ambient lighting is directionally occluded and not just darkened in corners. The down side is long bake times and you can't rotate or swap out skies at runtime.

    Interesting, this could be a bug. Do Unity transparent shaders let baked light through? And do they color it properly?
     
  21. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Never mind, my bad. The transparency shader works fine, my material was the problem. Thanks.
     
  22. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Gorgeous renders man... makes me want to work on a level now :)
     
  23. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    any update on the issue with running in Opengl es3 mode? have the desktop shaders become the es3 shaders now or is anyone on the project looking into this?
     
  24. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I am trying to get results similar to the video in this thread of the glossy room and the 'sphere gun'. I have a basketball court, and I have created a probe from within the room. Is it possible it's because I haven't lightmapped it with that probe active? But I plan on baking the GI and using the real time IBL specular anyway. Please advise, thanks.

    I just had a thought. How would I bake a scene with several different skys? Baking selected? :/
     

    Attached Files:

  25. OH NO

    OH NO

    Joined:
    Oct 16, 2013
    Posts:
    14
    I just had a thought. How would I bake a scene with several different skys? Baking selected? :/


    You can bake your scene with different skies. just add another SkyshopSky into your scene and highlight the new created one to bake your scene with that...aso..so you can do this with many as skies you want... but you need to backup your earlier made lightmaps ( rename for example) and you maybe need to switch between tho different lightmaps manually. Another solution would be to add the imported geometry again into your scene ( maybe you need to rename it as well) but you can bake a new created sky on that. But i dunno if that makes sense :)
     
  26. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
    Some architectural interiors. Thanks for the toolset team Marmoset!

    Gary
    $Shot1.jpg $Shot4.jpg $Shot6.jpg $Shot9.jpg
     
  27. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Hi monkey science,

    I contact you by email about vertex limit excess on iOS using vertex color shader.

    I hope in your time :) thanks
     
  28. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    I don't know why, and it seems like I'm the only person with the issue, but I still get black textures even on PC platform until I open up the marmoset demo's, then when I go back to my scene the textures will show correctly.

    It happens on both computers in every project I use marmoset in....sometimes it shows black textures in the published build despite showing correctly in the editor....but more commonly when I close the editor and re-open it I get black textures until I open the demo's.

    Any idea on how I can fix this? Other than that things are gorgeous :)
     
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi MonkeyScience.

    I have just bought Skyshop and I wanted to try and integrate my SSR with Skyshop.
    I wanted to do this as a post process because of obvious screen space advantages, but I am kinda hit the wall with acquiring right information from the Skyshop shader.

    Basically, I am using deferred renderer and for reflection, I need to get roughness and reflection level (specular level?) so I can adjust the reflection coming from SSR per material basis (per pixel basis) At the moment, I am just outputting spec.a to alpha channel and using that to moderate the reflection, but that's just for an specular , I am wondering about roughness data (gloss), and what would be the best way to get that.

    I really don't want to do another pass to get these information, but thinking about maybe somehow use single alpha channel to get both information (even at the cost of precision)

    Any advice?

    Here is 4 shots of bike with and without SSR.

    $SSR11.jpg $SSR12.jpg $SSR13.jpg $SSR14.jpg

    Here is link to my SSR thead :

    http://forum.unity3d.com/threads/205549-Screen-Space-Local-Reflection
     
  30. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    I'm using Skyshop for terrains, and no matter what, I just get too much tiling. is it possible for me to implement multi UV for skyshop terrain shader if I try? i.e., is there enough free samplers left for it inside shader?
     
  31. Gangsta-Geek

    Gangsta-Geek

    Joined:
    Aug 11, 2012
    Posts:
    32
  32. Smartline-Games

    Smartline-Games

    Joined:
    Aug 15, 2013
    Posts:
    67
    Where did you get this whole building model?
    Please reply, that would help me.
    Sorry for my bad english..
     
  33. DigitalGlass

    DigitalGlass

    Joined:
    May 12, 2009
    Posts:
    88
    Just food for thought, but could you use renderwithshader, and have a replacement shader that writes the specular level into the r channel, and roughness into b channel to get the data you need?
     
  34. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I work for an architect. PM me what you are looking for.
     
  35. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I could, but that means another pass for the possibly whole scene. And I would rather try to avoid having to do re-run most of the Skyshop shader code just to get those information into another rendertarget texture.

    If we can manage our own deferred render path pipeline then we should be able to do wonderful stuff.. Like have access to all sorts of buffers. But unfortunately this is not the case... I guess it is limit of using middleware engine.

    Anyway, my initial thought is to somehow encode both roughness and spec amount into one alpha channel... Kinda use 4 bits each for 2 values. Some encoding and then decoding.

    Also for changing reflection according to roughness I am thinking about just changing the blur sampling offset. I don't think it is possible to do blur iteration + offset. But it *should*+*hope* to be good enough?

    Edit : I really wish Unity can do multiple output inside pixel shader, like out to renderbuffer + some other buffers. In this way we can write fast / custom deferred render path.
     
    Last edited: Nov 6, 2013
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    MonkeyScience.

    While providing the function to do multiply IBL lighting on lightmap objects are cool, but I think this needs to improve a bit. What I am seeing is that if I bake IBL lighting ( and plus directional lighting ) into lightmap , it bakes information like diffuse lighting , ambient occlusion , shadow etc based on IBL env.

    This is all good, but when you add IBL lighting on top of that , it basically causes everything to be in "additive" mode. What I am saying is that with value of 1 setting for both diffuse and spec for "Lightmapped multiplier" everything just gets brighter, because you essentially adds on top of what is already baked. I can make the multiplier to 0 and let baked lightmap does everything, but then I am missing this nice IBL reflections and speculars.

    What I think it should be doing is that I should be able to modulate realtime IBL lighting by the light intensity value baked in the lightmap.
    In this way, I can still keep the nice and dark corners generated by the beast lightmap and have some IBL light reflections on the brighter surface.

    This is just an idea and it is probably not perfect, but I think using lightmap to control the realtime IBL reflection contribution is critical. This is especially important for static background and env models.

    If I lose IBL reflection due to lightmapping then Skyshop shaders are not much different than the ordinary Unity ones except you use HDR as env lighting when you do baking.

    And

    If I add IBL on top of the baked lightmap just as is now , then it affacts my shadow and occlusion area created by the beast.

    So, I have tried to actually do it myself, but then it seems that there are no ways to access lightmap data inside the surface shader! (you can do it in CG). So what do you think about this and does anyone know if it is possible to access lightmap data inside surface shader? ( inside surf code to be exact)
     
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    The same thing with the occlusion.

    occlusion works well for non lightmap objects, but it only affects ExposureIBL. It means that it only shows when you have lightmap multipler in sky setting > 0

    I think occ should affect lightmapped and non lightmapped objects in regardless of lightmap multiplier in Sky setting.

    So when I turn the multiplier down :

    I don't see occ map effect ... but my other brain tells me that occ on map should affect my diffuse and spec lighting of lightmapped object as well.

    Like if I have a brick tile texture and had occ map generated around occluding light info surrounding each bricks to simulate cracks and etc, I should be seeing that regardless if I use IBL or baked lightmap.

    I can ofcouse "try" to approximate it by applying occ into actual diffuse texture and spec color texture, but I am not sure if that is correct way of getting around it.
     
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I took a long read of this thread and I finally understand what occ map is for. Its usage was little different than what I was expecting.

    So my idea of using lightmap to control the IBL sky lighting was not too far off...

    But I think in practice , baking occ map in another 3d app is not very practical. Because many of us uses Unity's generate uvs for lightmap, and sometimes lightmap spans across multiple maps.

    We need some work around within Unity to do this... either we find way to get lightmap info inside surface shader or have to rewrite Skyshop shader into CG version!

    And that is the first step... And then somehow make useful use of lightmap info to occlude IBL sky light...

    OR... I am thinking of perhaps make use of Directional light mapping path... I didn't use Directional lightmap path due to the fact that in Deferred path , you can't cast shadow onto lightmapped surface. I think you can access Directional Lightmap info inside Surface shader..


    ughh.. too many facts that doesn't work too well together! Haha.. XD
     
  39. Smartline-Games

    Smartline-Games

    Joined:
    Aug 15, 2013
    Posts:
    67
    Well, at first I have a long experience to with making models like this. I use Google sketchup, and it's very easy to use. I started learning this when I was 12 just for fun. I am looking for a modular building with several floors just like you did. (2 floors)
    I'm working right now on a very complexed "map/level" for my game. The idea came from a dream from me.

    Thanks for reading, and you can always reply me via a PM on this site.
     
  40. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Do you have a sky in your scene?
     
  41. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Each layer in the advanced terrain shader has its own tiling settings, give these fields a try:

    Edit: Also the standard shaders don't have room for any more interpolators, which is why the terrain shader implements the tiling scale and bias in the fragment shader. You can add as many separate UV tilings that way, and to any shader.

     
    Last edited: Nov 7, 2013
  42. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey Monkeyscience, I solved the flickering with the transparency maps and the sorting issues... check your PM.
     
  43. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    castor76,
    Lots of questions, let me see if I can address some.

    Gloss in a deferred rendering buffer -
    Sounds like a hard problem. You have one remaining color channel and two values, not much I can do on the marmoset-side to help with that. Consider passing your SSR buffer from the last frame to the material itself. The material knows all sorts of interesting values and settings like gloss, fresnel, reflectance, etc.

    Lightmaps vs. occlusion -
    The Marmoset occlusion maps do not occlude direct lighting because occlusion is to ambience as shadows are to direct lights. Similarly, occlusion maps do not shadow lightmaps because lightmaps are typically bakes of only direct light. If you do happen to bake ambient light into them, either from a solid color or IBL, Beast's raytracer takes care of the occlusion during the bake. The only thing left to occlude would be any Skyshop IBL you want to add on top, and that's what the occlusion maps are for.

    Lightmaps modulus -
    Some here have requested that I multiply Skyshop IBL with lightmaps. This would work but you couldn't bake anything besides AO. Direct lights and radiosity still needs to be added, while shadows multiplied with the IBL. The lightmap contains all this data but it is combined into one RGB value and is inseparable.

    I would like to have Beast bake me ambient occlusion in the LM alpha channel or in a separate map like with dual LM so I can have both light and shadow data. No idea how to get Beast to output custom data though. Lua scripting somehow?
     
    Last edited: Nov 7, 2013
  44. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Great news! I just learned that the Direct3D 11 spec mandates that cubemap edges be filtered properly. This means those annoying edge artifacts in low-gloss reflections are fixed in Direct3D 11, by mandate, and in all graphics drivers.

    I tried it out in Unity. Enabling Direct3D 11 for your project fixes everything. Hazaa!



    There is an OpenGL extension for doing the same on non-PC platforms, I'm going to find out if Unity is using it.
     
  45. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This is a BEAUTY... I have to update to Unity4 ASAP... I also saw the Anisotropic IBL from Toolbag 2... I hope that makes it into Skyshop... I also sent you some screenshots, Monkeyscience that fixes the hair clipping :)
     
  46. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @MonkeyScience

    Thanks for the reply.

    I think I understand what occ means for Skyshop and while I think its implementation is correct, but like you said, there is no way to get AO only from lightmap so its practical usage is limited. I guess it will only work if all your lightmap object uvs are layered in Max or Maya so you know that uvs for occ is always fit in 0-1 uv space. If you use generate lightmap uvs (Unity) then it won't work unless maybe you only have 1 lightmap generated?

    I have tried to come up with some work around, and so far this is what I got.

    Using Deferred mode , I baked my lightmap using Dual lightmap. In this way, I don't bake directional shadow info on my near lightmap. And I multiply IBL contribution by lightmap and multiply again by the light color coming from PrePass. This is not entirly correct because light coming from PrePass is not just attenuation value from shadow but it is : _LightColor.rgb * (diff * atten);

    I have separated IBL contribution into diffuse and spec using another set of input (OUT.IBL) and then for lightmapped object , I discard the IBL diffuse and only add IBL spec into Emission (after multiplied by LM and Light from PrePass)

    In this way, I have lightmapped object with IBL spec on non shadowed area, but it is dimmer because it gets multiplied by other factors too.

    Again, I wish I can just get shadow intensity value into .w part of output from Internal-PrePassLighting shader, but then it is used for specular as well. So I can't do that. It's kinda similar issue as we can't get AO only from Beast. :(
     
  47. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    curious, would your shaders become cheaper to render on mobile if they did not react to dynmaic light.? only the cubemap light/spec... with lightmapping..

    Sort of an unlit shader version...
     
  48. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Up
     
  49. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    It becomes an ambient lit version of the shader when you turn off all of the lights kurylo3d, unless ofcourse your lightmapping, then yes unlit with lightmapping support.

    and yes the performance does go up a good amount depending on the device and how well the device handles lights.

    and/or shadows if youve got those turned on as well.
     
    Last edited: Nov 8, 2013
  50. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Yeah, it probably would be faster, good idea. I'll see if I can't add an IBL-only set of at least the basic shaders.
     
Thread Status:
Not open for further replies.