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. Marcan888

    Marcan888

    Joined:
    Aug 29, 2014
    Posts:
    3
    Hello Monkey Science !! It's for PC so I don't use Marmoset's mobile shader. I don't have any console errors too.. I really don't know why the skinned meshes are not lighten by the sky.. :(
     
  2. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    They should perform the same unless you are using box projection or blending. Both add some math to the shaders.
     
  3. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Hmmm I don't know then. I've just tested skinned meshes and they seem to render fine with or without GPU skinning. Do you think the model could have normal map problems? What does it look like under direct lights?
     
  4. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    Hey MonkeyScience, any updates on the iOS performance issues with Mobile Bump Spec (or any Bump Spec shaders)?
     
  5. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Which of your shaders contain the most key words. I have run out and I need to prioritize. Thanks.
     
  6. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I'm having trouble using Skyshop and RTP3.1 together. I'm working in a blank project with only Skyshop and RTP. I have tried every combination of settings in each asset. But when I play the scene, the terrain turns black. If I disable the Sky Manager, everything seems to work fine. But I need to be able to switch sky objects so I need that active. What am I doing wrong or what have I missed? Please advise, thank you.

    black_02.png
    black_01.png
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Seems like something's wrong with function that refreshes renderers here. After digging for a while I found that references to almost all textures and props of RTP used on a mesh vanish in playmode. Skyshop looks for MeshRenderers in the scene and processes its materials (probably to perform dynamic blending).

    To solve this you can disable "Auto Apply in Game" option or exclude RTP objects from Skyshop processing. To do it one would need such addition in the Skyshop code. In SkyManager.cs find "RegisterNewRenderer(Renderer rend)" definition and add this line at the beginning of function code:

    Code (csharp):
    1. if (rend.gameObject.GetComponent(typeof(ReliefTerrain))) return;
    ATB, Tom

    P.S. Monkeyscience - could your check this ?
     
  8. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Skyshop 1.09 keyword use is as follows -

    All Shaders:
    Code (csharp):
    1. #pragma multi_compile MARMO_SKY_BLEND_OFF MARMO_SKY_BLEND_ON
    2. #pragma multi_compile MARMO_BOX_PROJECTION_OFF MARMO_BOX_PROJECTION_ON
    3.  
    Render to Probe Shaders (Marmoset/Shader/Probe/):
    Code (csharp):
    1. #pragma multi_compile MARMO_RGBM_INPUT_ON MARMO_RGBM_INPUT_OFF
    2. #pragma multi_compile MARMO_RGBM_OUTPUT_ON MARMO_RGBM_OUTPUT_OFF
    3.  
    If you pull the later, render to cubemap will likely stop working.
     
  9. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    This is a question for the RTP folks I'm afraid. If you are using RTP terrain shaders instead of the Marmoset ones, likely they are breaking somehow and rendering black. RTP didn't really ask me before integrating anything so I don't know what their implementation is like.
     
  10. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    But I'll probably ask you next version, because you changed diffuse lighting to spherical harmonics, while RTP still uses cubemaps for this purpose. Is it OK, if I just put an #include of your MarmosetCore.cginc in case a user got it installed in my terrain shaders and use its values in my lighting pipeline ? Would be great. It does not make sense to reimplement SH in RTP in case somebody got Skyshop installed anyway.

    The problem with RTP here is, however, different. When we disable all IBL (integrated or not) in RTP used on mesh still gets black (in opposite to terrains because they don't use MeshRenderer). I found that functions called after ifdef EDITOR checking in LateUpdate() in SkyManager.cs do something with materials attached to all MeshRenderers present in scene. It somehow breaks references to textures in material used in RTP's MeshRenderer. I can simply give you an example scene with case so you can detect the problem. It might be Unity bug, who knows, but I think there is probably something with material treatment in Skyshop.

    Kindest Regards, Tom

    P.S. BTW - Skyshop is more and more fantastic piece of software with each release :).
     
  11. DominicNorman

    DominicNorman

    Joined:
    Sep 20, 2013
    Posts:
    7
    Hi,

    I am trying to achieve SetGlobalSky / SnapToSky through script with 1.07+ but cant make it work. I could not find clear indication in the doc. Can you give a code exemple of how you would do it?

    I found this
    http://www.marmoset.co/skyshop/reference
    • Sky blending can be triggered in script using the SkyManager BlendToSky function
    • Sky blending can be bypassed with the SkyManager SnapToSky function
    But these function are in SkyAnchor.. not SkyManager...

    You also specify the following in the same page:
    • SkyManager can be fetched with mset.SkyManager.Get()
    • Global skies can be changed through the SkyManager by invoking SetGlobalSky or BlendToGlobalSky
    However, there is no SetGlobalSky or BlendToGlobalSky function in SkyManager either...

    Thank you for your help!
     
  12. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I am grateful for a solution to the black mesh terrain problem I was having, but I think it's weird I was the only one having it. Anyway, In a conversation with tom about further implementing IBL with my terrain, he pointed out the diffuse IBL isn't synchronizing anymore because of the lack or diffuse Skyshop cube map. Is there any way you could include diffuse cube map creation as a menu item possibly? ShaderForge users could benefit from this also. Thank you.
     
  13. DominicNorman

    DominicNorman

    Joined:
    Sep 20, 2013
    Posts:
    7
    I managed to make it work. It was easy in the end, just had stupid error on my side. (code example in doc would still help!)

    Here is how I did it:

    You can also do this:

    Cheers!
     
    Last edited: Sep 9, 2014
  14. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    Hello

    So the Skyshop [Issues with skyAnchor.LateUpdate() and skyManager.LateUpdate()]

    Are you still working on patching these things for a mid-September release?
    Altered S
     
    Last edited: Sep 9, 2014
  15. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    I just had another thought on this, 1.07 enabled sky rotation for all mobile shaders, it had to for oriented local reflections to work. This means all mobile shaders have additional matrix math overhead in versions. 1.07+, and double the overhead for specular shaders because the reflection vector needs to be rotated also.
     
  16. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Would this work:
    Add meshes using RTP to a custom layer
    Tell the SkyManager to ignore said layer

    Skyshop 1.09 introduced a list of layers that are ignored by all Auto-Apply features. Set the "Ignored Layer" count in the manager to >0 and pick your layer from a drop-down list.
     
  17. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    I got rid of the diffuse cubemaps and was super glad I did :p. One less thing to compute and wait on and manage. I think we're going to get RTP going with Skyshop spherical harmonics instead. The Shader Forge Skyshop node also already uses spherical harmonics.
     
  18. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    I have one more I forgot to add to the list:
    Code (csharp):
    1.  
    2. #pragma multi_compile MARMO_TERRAIN_BLEND_OFF MARMO_TERRAIN_BLEND_ON
    3.  
    This is needed only if you are using the terrain shaders. Delete the whole Shader/Terrain/ directory and it will go away.
     
  19. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    Thanks! Is there a way to get rid of the overhead or other ways to speed up the shaders? I have a completely static scene setup (one sky and some static objects), only the camera moves.
     
  20. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    When using a custom SkyShop IBL Sky and setting the shader to the roughest specularilty (closer to 0 sharpness) I'm seeing the corners of the skybox. As sharpness increases everything starts working as expected. On further testing I found that this issue only happens when using GPU Compute. The rougher/higher mips look fine when using CPU Compute.
     
  21. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    Update: I just noticed it is still happening with CPU Compute (just not quite as obvious). Maybe I'm doing something wrong. I tried with the Austria stock asset and still get the issue
     
  22. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I have problems creating skys to use as probe/box projected skys. Is there a sequence to order your supposed to set it up in? I create the shy and position it in my room. I hit New and select a resolution. Some times I get a cube map, sometimes I don't. When I try to create the cube map, it checks Is Probed. Settings those options first does not seem to affect anything. What am I missing? Thanks.
     
  23. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Also, I was going over the dialog carefully looking for what I missed. The tooltip for the Box Projected check box says '...only effects box projected shaders for now'. The last time I used this it was still in beta, and you had variants with a 'box' suffix or something. When I was able to create a probe I wasn't getting the results I remembered. So I applied the I applied the only Box Projection specific shader I could find to my Substance. There are no texture inputs, it just a cube map property, obviously not what I was looking for. When I change it back to any other shader, it crashes Unity. Not every time, but I had it happen on both of my machines, and only with substances. Your box projection demo scene is using regular Bumped Specular IBL shaders. What is that Box Projection shader for? Thanks.

    PS, i need to create sky probes badly, previous post. How can I get this to work? Thanks.
     
  24. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Hey guys, I'm putting the finishing touches on a new version that will address a lot of auto-update and sky manager performance overhead from both static and dynamic objects in the scene. Currently there are two bottle necks in mobile performance, CPU overhead and shaders. This release will be focusing on addressing CPU short-comings (and I found several).

    The shader side will be tougher, and short of cutting features I'm having a hard time squeezing mobile performance further. I've tried to keep the feature set on mobile as close to what Desktop and Web can handle, but the final verdict might be that bumped specular IBL with glow maps, shadows, lightmapping, box projection, and blending all turned on at once simply won't fly on mobile GPUs.

    I would encourage those of you struggling with mobile performance to try limiting the shaders and features you use. Here are some pro tips for pros:

    Shaders
    • Mobile GPUs hate texture lookups.
    • Specular-Fast shaders combine two texture lookups into one diffuse + specular map, making a huge difference on mobile.
    • Normal-maps add a lot of unavoidable math overhead to all shaders and should be used sparingly.
    • Ditto for box projection, more math for every fragment rendered.
    • Vertex lit shaders don't look as bad as they sound ;-), especially along with specular reflections.

    Blending & Skies

    • Blending between skies doubles specular cubemap lookups and diffuse light computation. Limit blending to brief interpolations and keep the number of dynamic objects passing between sky triggers to a minimum.
    • Don't change sky rotation or IBL intensity parameters unless you need to. In the upcoming version, global skies that don't change or rotate will not be applied to the world every frame for potentially huge savings.

    Auto Apply
    • Mark as many objects "static" in your level as possible.
    • Don't use "Auto-Apply" unless you need probed local skies and sky triggers. Auto-Apply fragments material instances and is generally terrible for batching and draw calls.
    • All active, non-static objects with MeshRenderer components are put through the Auto-Apply ringer. Keep active dynamic object counts low.
    • Create a layer for objects you want Auto-Apply to ignore completely. This can be a great early-out for masses of dynamic geometry like bullets, particle meshes, and other objects with materials that don't need Skyshop.
     
  25. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    This is an issue with pre-Direct3D11 drivers where texture lookups at the corners of cubemaps are not filtered across faces. You'll get a sharp crease between any two cube faces and it only becomes worse when each face is comprised of only 16 or 4 pixels.

    The CPU Compute method tries to pre-blur the edges so its not so noticeable but nothing solves the artifact quite like turning on D3D11 with native edge filtering. I don't know if GLES 3.0 has edge filtering or not, I hope it does!
     
  26. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    You should be able to create new, empty sky objects and click the "New" button on the "Specular Output" slot in the inspector. This should work every time. If it's not creating a new cubemap asset when you click new, something's wrong. Are you seeing any console errors?

    Check out this video tutorial for step by step instructions:


    Good catch! Also don't use the old shaders :p.
     
  27. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Disabling Auto-Apply is probably the first thing you should try.
     
  28. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    Ah interesting and good to know! Man sometimes I wish I was working with DX11. Working around limitations is interesting but it's also a pain in the ass sometimes.
     
  29. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999

    Yea, watched your video several times, it's great. ;) Turns out it was creating the cubemaps, just not assigning them to the sky. There were going into either the scene's lightmap folder, if there was one. Or the directory where I keep HDR images, global sky cubemaps. I can drag them into the sky inspector and everything works.Is there action or circumstance in my project/scene that would be causing this?

    Also, sometimes I don't get the gizmo arrows on the Projector box to adjust the size. And there seems to be something going on with the specular properties of the material before and after I create the local probe. Before when the material is reflecting the global sky, it's like a mirror (solid white specular map). After I create the probe, it's doesn't appear to be as reflective.

    probe.png probe-2.png
     
  30. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    Hah funny seeing another BBall game in Unity (I worked on a 2 day pitch - very rushed / needs a lot more TLC / using default Unity shaders. For the reflection map I just did a hand painted cubemap).

    Look forward to seeing what you can do with some awesome IBL/SS shaders. I'm guessing you're not planning on using the Etnies Skate Park HDR but you'll probably find you have similar issues with outdoor/strange objects in the reflections ;) (unless you've got an HDRi of a court / plan to make one/ or obscure the reflections with roughness).

    I haven't experimented with probes in Marmoset yet but am wondering what you're using them for in that scene? Aren't probes just for your dynamic objects? Also what are you projecting?

    I find SS usually sticks new skies in the folder with your source HDR panorama and hitting "Add To Scene" sometimes helps refresh it. Same with Edit/Refresh SkyShop
     
  31. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Make sure you're pressing the new button in the inspector and not the Skyshop window, it should auto-assign...

    The gizmos could be glitching out, I'll keep an eye out for it.

    Not sure what to make of this. It could be your global sky is just higher res than the probe and looks more mirror-like? Or if your sky doesn't have mips, gloss (specular alpha * the specular sharpness slider) would be ignored when the global sky is active but starts working when the probe is done.
     
  32. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    It's a 90,000 sf classroom building/gymnasium, it's killing me! There is a gigantic 3 story atrium/lobby and the gym that have to look great. I'm not as worried about the classrooms. Ha! I do use that HDR image for a lot. Skyshop shaders reduce my lightmap artifacts to almost nothing. I pull the master intensity and diffuse down to 25% and to bring the AO out. That particular image gives me blueish tint on the floor and a sand like color on the ceiling. I lightmap my scene with a global sky, skyshop shaders and whatever lights I need, Then I create probes for specular and reflections. I'll post back when it's done.
     
  33. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    "Vertex lit shaders don't look as bad as they sound ;-), especially along with specular reflections."

    Have you managed to create a combination that allows this?
    I think i was trying to create one with Box Projection, but it required it to be Per Pixel in order to do that.

    Curious if we're able to get a vertex lit shader with box project ?
     
  34. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    There is no box projection in vertex-lit right now. Projection has to happen per pixel and would have added a lot of math to the fragment program. I was thinking keep the vertex-lit shaders fast fast fast! Is this a deal breaker for people?
     
  35. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    not a deal breaker, im using a vertex lit shader with nothing special as my lowest optional shader, then the next level is just diffuse, then specular, then box projection, then box with bump.

    all with vertex color.

    i had to create my own vertex lit shader with ambient light and vertex color. i squeezed everything i could out of it. But a vertex lit, vertex color shader with ibl would be nice, just not sure if its possible.
    Unless your just making a lighter version of diffuse shader, but with vertex color working. that would be cool.
     
  36. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Marmoset/Vertex Lit/Diffuse IBL already supports vertex color actually (even though it's not in the name). I added a Vertex Lit/Specular Vertex Color IBL equivalent to the next release.
     
  37. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455

    Cant wait for this release !!
     
    poolts likes this.
  38. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    GLSL error: 0:1:F0002:MALI-400 GP REGISTER FAILED FOR VERTEX SHADER

    Marmoset/Mobile/Bumped Specular IBL Fast

    failed compiling vertex shader
     
  39. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Interesting, it sounds like the compiler for a specific mobile GPU is failing to allocate enough registers to do some vertex shader math.

    From malideveloper.arm.com
    (http://malideveloper.arm.com/downloads/tools/osc/Mali%20Offline%20Compiler%20v4.1%20User%20Guide.pdf):

    Do any other shaders give this error? Bumped Specular Fast uses the very same, very straight-forward vertex shader that all Marmoset shaders use. It is mostly constructed by the surface shader system. Does reimport Marmoset/Shader/* help?
     
  40. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705


    Skyshop 1.10 is now available in the Asset Store!

    Change Log

    Features:

    • Added file format for custom diffuse spherical harmonics data ("SH Encoding File" stored as .asset)
    • Diffuse irradiance files (.ASH) generated by Knald Lys are imported and auto-converted to SH Encoding Files.
    • Added "Custom Diffuse SH" field to skies
    See Documentation/Custom Diffuse Files.txt for more info.

    Performance:
    • Disabled objects are now ignored by Auto-Apply
    • Compute sky exposures, dimensions, and transforms once per frame, instead of per Apply()
    • Static object SkyAnchors call Apply() only when necessary
    • Global Sky is only applied when necessary
    • Misc. memory allocation optimizations

    Bug Fixes:

    • Fixed box projection & sky blending on OSX desktop builds (Disabled MaterialPropertyBlocks on OSX desktop only).
     
  41. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    Sorry i meant to say, also with lightmap. Does your version include lightmapping i think that was the one thing missing from the shaders, which is why i had to write my own and just use ambient light instead of IBL.
     
  42. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    also is "Vertex Lit/Specular Vertex Color IBL equivelent" u mentioned, in 1.10 release?

    And, do all shaders support the ability to rotate the sky? i remember you saying something about you added support to that for mobile.
     
  43. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Lys looks extremely useful, Knald really is an essential tool. I don't know if this is the proper place to ask but is Lys intended to be a part of the main Knald software after the beta?
     
  44. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Thanks for the update, but are there any plans to make Skyshop work with Unity 5?
    I really miss ability to bake cube maps and ones baked in 4.x Unity versions don't look right when copied over to 5...
     
  45. JeyDia

    JeyDia

    Joined:
    Feb 14, 2013
    Posts:
    100
    Hi

    Marmoset skyshop is compatible with linux ?
     
  46. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Oh, there's no lightmapping on the vertex-lit shaders right now :(.


    There was until I realized Vertex Lit/Specular IBL already supports vertex color just like Vertex Lit/Diffuse IBL did, so it's always been there! (Those are the best feature requests.)

    Yes, mobile shaders now also support sky rotation.

    We are looking at keeping it compatible with Unity 5 but probably won't be releasing anything during Unity's beta cycle.

    Yes, anywhere Unity will run, Skyshop will run.
     
  47. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    does rotating the sky apply any special performance issues? like sky.update or is it pretty face to just rotate a sky?
     
  48. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    I have this plugin thanks, its amazing! I have one question do we need this plugin in unity5, with new unity shaders, whats better in skyshop?
     
  49. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    129
    HI,

    I have a pre-existing sky cube map I would like to use in skyshop. Skyshop seems to want a panoramic image to create its skies.

    Also, a quick question for Tom - Does recompiling RTP in one scene affect the other scenes ? Or does can each terrain use different compilation of rtp.

    I have used rtp and skyshop successfully in my game, and the results are beautiful: Thanks guys for making such wonderful tools
     
  50. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,355
    Hi,

    A question about the IBL data from the Skyshop sky. Is there a way to have access to that data (color per direction perhaps) from the sky dome in an easy way ?

    I would love to make my GI Proxy pack compatible with Skyshop (since i use it in my RPG game too), so i wont have to add a sky dome in every scene. My IBL addition to the GI is a simple raycast to the sky (spherical textured dome) right now.

    Thanks
     
    Last edited: Sep 18, 2014
Thread Status:
Not open for further replies.