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

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    That is indeed a bug! I have a fix for it already, I will try getting a new version out ASAP.
     
  2. mrduman

    mrduman

    Joined:
    Jun 3, 2013
    Posts:
    5
    Even though I tried hard to make specular and normal maps work, I couldn't. Should I do something special for mobile(android) version ?

    $skyshop.jpg
     
  3. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Have you tried both the standard and mobile category of shaders? If so, you may have found another bug. Please email your tablet hardware specs to support@marmoset.co

    Also, nice renders!
     
  4. mrduman

    mrduman

    Joined:
    Jun 3, 2013
    Posts:
    5
    I did not test on real hardware, just working on pc. Is there any difference? If yes, I can take a build in the next few hours. And yes I have tried both standart and mobile shaders.
     
  5. cl-apps

    cl-apps

    Joined:
    Mar 16, 2013
    Posts:
    128
    To add, I did notice the mobile shaders were dull in comparison to the desktop counterparts but with tweaking I could get some fairly decent shininess. I assumed this was normal?
     
  6. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Oh! Yes there is a difference. The mobile shaders are currently GLSL-only. We are waiting for a critical bug fix from Unity 4.2 before we can proceed with full-scale mobile shader work.

    Both iOS and Android render with OpenGL so this is fine, but the Unity viewport on PCs is rendered with DirectX and Marmoset Mobile shaders won't draw :(. They fall back to Unity's Diffuse shader, which is what you're seeing. On a mac this is not a problem, mac Unity viewports use OpenGL. I don't know if there is a way to tell Unity to render in OpenGL on a PC though. Anybody?

    Try your app on an actual device, I'd be curious to see if it renders normally.
     
  7. HunterPT

    HunterPT

    Joined:
    Nov 11, 2011
    Posts:
    38
    Those two .exe files you are talking about are probably for the x86 and x64 bit versions of it. Considering the problems you are describing I'm assuming you don't have photoshop? Because dDo is an application that works with photoshop, so if you don't have photoshop you will be unable to use dDo (or nDo2).
     
  8. mrduman

    mrduman

    Joined:
    Jun 3, 2013
    Posts:
    5
    Hi again,

    I have tried on tablet (Google Nexus 7) and phone (Samsung Galaxy S3) here is the result;

    $Screenshot_2013-06-04-00-38-58.png


    Used texture compression DXT5 for Tegra and RGBA32 for SamsungGS3, I tested lightmapped version with&without directional light. Results are same.
     
  9. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Hmmm, yup that looks broken :-(. I will be looking into this post-haste. Do you get the same results without any lightmapping too?
     
  10. mrduman

    mrduman

    Joined:
    Jun 3, 2013
    Posts:
    5
  11. mk1978

    mk1978

    Joined:
    Dec 27, 2009
    Posts:
    276
    Sounds tempting! Are you planning to create also some kind of nature environment example scenes? Also, do you think that this will work ok with big environment scenes, for example terrain size 5000m x 5000m and 40 000 - 50 000 trees?
     
  12. HunterPT

    HunterPT

    Joined:
    Nov 11, 2011
    Posts:
    38
    If unity can handle it, skyshop will be able to handle it, since in what concerns performance, it's just basically two extra texture lookups, which in what concerns performance has very little cost.
     
  13. bigzer

    bigzer

    Joined:
    May 31, 2011
    Posts:
    160
    Thank you ^^
     
  14. -FP

    -FP

    Joined:
    May 28, 2013
    Posts:
    4
    There seem to be a problem with the transparent shader, or am I doing something wrong?

    Diffuse alpha sets the transparency, just like in Toolbag, but in Unity it kind of makes a "projected" transparency.

     
  15. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Are your fan blades also transparent? If so, Unity, like most rendering engines has trouble with transparency-on-transparency sorting sometimes. Try making one or both materials Transparency/Cutout to enable alpha testing.
     
  16. -FP

    -FP

    Joined:
    May 28, 2013
    Posts:
    4
    Yep, using the cutout shader made it work. Also, exporting the fan vent plane as a separate piece of the mesh works with the other shader I was using.

     
    Last edited: Jun 4, 2013
  17. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey Monkeyscience, I have a question for your in regards to the input for the cubemap... can Skyshop accept the Cross format similar to Marmoset? I just got an idea and I will want to eventually try it...using a cross HDR to generate my cubemaps...
     
  18. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Skyshop Inputs can be:
    - Cubemap assets
    - Latitude longitude panoramas (typically 2:1)
    - Horizontal crosses (4:3)
    - vertical column (1:6)
     
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Cubemap assets... such as a cubemap captured in Unity using a cubemap capture tool, similar to this one? http://u3d.as/content/spreadcamp/cubemapper/2LL
     
  20. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
  21. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    That is what worries me right now if i go this route... I will have to try and capture cubemaps for things like buildings and wet concrete... i need to get skyshop ASAP
     
  22. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    From his youtube tutorial, it looks like his tool generates cubemap assets from 6 face images and adds them to your project.

    You can drag these cubemaps as inputs to Skyshop and compute lighting as you would normally would. They will be LDR cubemaps so uncheck the HDR box. Outputs can be LDR or HDR, it does not matter, the input is still dim and low dynamic range.

    Here is an example of Skyshop being used to process one of the skyboxes in Unity's standard Skyboxes package (found under Assets->Import Package->Skyboxes).


    As you can see, HDR is turned off as these skyboxes have some strange alpha channel in them, but they process just fine.
     
  23. Molt

    Molt

    Joined:
    Sep 6, 2011
    Posts:
    103
    Will this work with custom shaders, are we able to add new shaders into this for custom effects such as skin shading or highlighting?
     
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Holy crap...! This is perfect! Thank you so much for testing it out...
     
  25. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    You would have to derive your shaders from the included source code or at least include some of the Marmoset core Cg-include files. It will take familiarity with writing shaders but is doable. There is some included documentation to get you started, as well as how to configure the existing shader source to only use the features you need.

    A good skin-shader is high on our priority list for the future updates, btw.
     
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I'm looking forward to the skin shaders the most... and from what I have seen with Marmoset, the skin shader should look beast with GI and HDR
     
  27. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Some great questions from the WIP thread:
    iOS features:
    Fresnel falloff
    Mipmapped, Blurred Reflections
    Exposure control in realtime
    RGB Specular maps for modulating the reflection (this is where Refl Occlusion would go).
    Gloss maps for varying blurred reflections
    A single rendering pass
    No added vertex instructions beside's Unity's own

    iOS does not feature:
    Gamma correct rendering (iOS hardware does not have sRGB sampling :-()
    Sky rotation (too expensive :-()

    Shaders are written in ShaderLab with both DirectX and GLSL in mind. iOS support has been tested on a third-generation iPad. Android support has not been tested and reportedly has some issues. Android support is high on our list of things to fix.
     
  28. Martin Bustos

    Martin Bustos

    Joined:
    Nov 28, 2012
    Posts:
    4
    What shader model use Skyshop?

    Would it work on XBox360 and PS3?

    Thank you.
     
  29. Martin Bustos

    Martin Bustos

    Joined:
    Nov 28, 2012
    Posts:
    4
    Works perfectly on consoles and it looks fantastic! :mrgreen:
     
    Last edited: Jun 5, 2013
  30. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    82
    Hi I have problems with my normal maps not tiling with the bumped specular ibl shader
     
  31. mrduman

    mrduman

    Joined:
    Jun 3, 2013
    Posts:
    5
    Really? What kind of workflow you have then?. That's really interesting.
     
  32. Martin Bustos

    Martin Bustos

    Joined:
    Nov 28, 2012
    Posts:
    4
    Sorry :(
     
  33. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    You have discovered a material restriction I totally forgot to mention here! The topic is outlined in the Materials.txt docs, here's what it says:

    TEXTURE TILING
    Unity also exposes per-texture tiling and offset controls with each texture slot. However in shaders with many texture slots, this feature can add up and hit shader interpolant-limits very quickly. For this reason, Skyshop's shaders are forced to share tiling coordinates. The Diffuse texture slot tiling coordinates are used to tile all other textures (normal map, specular map, glow map). An unfortunate limitation but in practice rarely an issue.
     
  34. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Who/where can I talk to someone about this? It is troubling.
     
  35. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    That is actually quite smart and it lightens up your shaders by a huge margin...
     
  36. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    Your realtime exposure control I am just curious to know how is that implemented?

    Is this something like an additional color multiplication in the fragment shader that you control by changing a value on every shader? Or something else?

    As for the gamma correct rendering, wouldn't it be possible to fake it somehow? The only thing that I really seek in this is the ability to make the shadows of something less dark. Usually I find if you can't adjust the gamma or fake it somehow, the shadows are too dark.
     
    Last edited: Jun 5, 2013
  37. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    Camera exposure is a multiplier on the Marmoset skybox shader, as well as the direct and image-based lighting contributions in all Marmoset IBL shaders. It is not done with a post effect but as the triangles are being rendered, which avoids having to render to an HDR buffer in the first place.

    Faking sRGB sampling (gamma correction) is expensive, you have to do a pow(2.2) on every texture look-up and it adds up. We do some math to try matching specular and fresnel falloff between linear and gamma space rendering. But the direct lighting portion will still exhibit some of the same problems.
     
  38. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    New tutorial video!

    Hey guys, I just posted a Skyshop walk-through on YouTube.

    It goes through importing an HDR sky image into Unity, processing it into lighting data, and using the resulting cubemaps to light Marmoset materials in a scene. Also covered is the use of direct lights along with IBL, managing multiple skies in the same scene, and an introduction to the glass shader.

     
  39. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Great, thanks!
     
  40. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This is a great primer :), especially knowing that I can use cubemaps that i already made in Unity...and with the cubemapper, I can generate multiple maps at any time in any position
     
    Last edited: Jun 5, 2013
  41. monkeyscience

    monkeyscience

    Joined:
    Dec 13, 2011
    Posts:
    705
    I've taken a screenshot of the vespa material setup. There is not much to the material itself, most of the important variation is painted into the textures. For example the gloss is different for the leather, chrome, and the blue paint. The material slider for shininess determines the max gloss value really, and I have that cranked to 100%.



    You'll notice I don't even use that much fresnel on the vespa, as this usually turns chrome and polished metal into shiny plastic.
    Also the mirrors inside the headlight are rendered as separate materials with a glow map and a specular multiplier of 4 or 5 to really boost the highlights.

    Here you can see the break-down of all the maps that go into texturing the vespa:



    Also important to keep in mind, all lighting looks better all the time, if performed with proper gamma correction. The web demos and screenshots are all set to render in Linear Space. Go to Edit->Project Settings->Player and in the Other Settings rollout, choose Linear Color space.



    Unity stores this setting at the project level so I couldn't include example scenes configured for proper rendering. Also, when changing color-space settings, remember to select each sky in your scene, so that it can auto-detect the color-space and fix its internal data accordingly. When it happens, you will see what I mean :).
     
    Last edited: Jun 6, 2013
  42. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I cant wait to test this out using GI and Beast... I can already imagine how realistic the scenes will look and also the fact that you will able to bake out cubemaps separately for multiple objects. Have you run into issues using Skyshop in Deferred Lighting?
     
  43. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Coder question:
    If I have a good model with diffuse and normal maps... what is the best way to produce "specular" and "gloss" maps? :)

    Is there any tool that can help to produce these textures?
     
  44. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    RGB for the spec maps with all the details, and (from what I have discovered) an alpha channel with all the different ranges of grey with detail maps. You may have to exaggerate the values a bit since stuff like cavity maps and AO details dim the gloss a bit. This seems to happen in Marmoset too.

    Start off with some flat colours, then derive the cavity maps from the normals. This can be done with xNormal. Then bake out an AO map. and blend it with the cavity maps. When i get my bearings, i will post how to actually do it
     
    Last edited: Jun 6, 2013
  45. Mark Duffill

    Mark Duffill

    Joined:
    May 2, 2013
    Posts:
    21
    Hi,
    We are looking at buying this product. How well does it perform on say the S4?

    Additionally are the shaders uncompiled so we can add our own custom functions? Basically we would need different behaviour for calculating the diffuse from a texture. (not the lighting diffuse but colour from the detail texture)

    Thanks
    Mark
     
  46. HunterPT

    HunterPT

    Joined:
    Nov 11, 2011
    Posts:
    38
    Not all shaders come uncompiled since it would take quite sometime to compile them all, however a few of them come uncompiled so you can see how they work, and then create your own if you wish.

    If you have photoshop the best option would be something like quixel dDo, if you don't have it, things get a little bit more complicated, for the gloss map you can use the standard methods or I do believe that there are programs that create those based on images, for the specular map it must be done manually by "mapping" real world reflectance values to the material X part of the texture is representing.

    P.S. Check the alpha channel of your textures to see if it doesn't have a map in them, if it does then that's your gloss map (called in non IBL a spec map), and all you need is the spec map which is easier to do IMO.
     
    Last edited: Jun 6, 2013
  47. Molt

    Molt

    Joined:
    Sep 6, 2011
    Posts:
    103
    Excellent. Was really making sure I wasn't restricted to the included shaders as I know that I'll end up needing my own special custom effects. Purchased, now just need to get the time to play with it.
     
  48. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    You could also bake out a material ID map which is just a bunch of random colours for setting up masks and texture info
     
  49. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    @HunterPT
    @Neptune_Imaging

    Thanks guys for your good advices!
    I'll try but it not seem so easy. :)
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    It is not supposed to be easy :p...
     
Thread Status:
Not open for further replies.