Is there any information anywhere on the process of creating an hdr source image?
What was the process with which the supplied demo environments were shot? I've got a Canon DSLR that I'd like to try capturing some cool skies with.
The lighting environments we used for the demo were from freely available sources, we didn't make those in-house.
There are a lot of resources out there for creating your own HDR panoramas though. Basic things you will need:
A. A camera that can do exposure bracketing(basically any dslr)
B. A wide lens, usually a fisheye or an ultra wide zoom. Fisheye will allow you to take fewer shots but the detail around the edges is worse.
C. A decent tripod. You don't need a panoramic head but it certainly helps
D. Some sort of software for processing the photos into HDR panoramas, there are a lot of options here. If you manually stitch your photos together you can use photoshop to do the HDR merging.
You can also do the "chrome ball" method, where you take photos with a chrome ball and convert that in panoramas, quality is really bad outside of the center of the ball though.
For the life of me, I can't get any decent lightmaps while using Skyshop.
This is a test scene I've set up in forward rendering mode with one directional light. Trying to get the soft bounce light look (similar to Mirror's Edge). This post on the Unity Forum had a similar issue. I took the Sky Lighting Color down to black, but that did not change the light bakes at all.
I've tried deferred rendering, changing the color spaces, Skyshop mobile shaders, etc. Does anyone have a workflow for dealing with IBL and lightmaps? Thanks!
For the life of me, I can't get any decent lightmaps while using Skyshop.
This is a test scene I've set up in forward rendering mode with one directional light. Trying to get the soft bounce light look (similar to Mirror's Edge). This post on the Unity Forum had a similar issue. I took the Sky Lighting Color down to black, but that did not change the light bakes at all.
I've tried deferred rendering, changing the color spaces, Skyshop mobile shaders, etc. Does anyone have a workflow for dealing with IBL and lightmaps? Thanks!
This is a complicated question but let me take a crack at it.
It helps to think of the Skyshop Sky object as another dynamic light in your scene. Objects with lightmaps can still be lit by other lights in the scene; think muzzle flashes, vehicle headlights moving around, etc. All these other lights are added on top of what's in the lightmap.
In your example pictures you have baked a directional light onto your geometry, which Unity is clever enough to disable when rendering. But the sky is still lighting your entire scene.
Here is a directional light baked onto some geometry:
Here's what happens when the skyshop sky is added on top of it. All of the bright blue sky and mountains still light the floor, the ceiling and the shadows.
You could try and split the difference by setting the Master Intensity or Spec & Diffuse intensities to 0.5. This would raise the relative contrast of your lightmap illumination and Skyshop's IBL.
But the most accurate solution is to bake both the directional light and Skyshop's image-based light all into the same lightmap. This this would mean the sky becomes static; you can no longer swap out skies or spin them around because it is baked into the LM. But the sky will contribute to all of the raytraced lighting, shadowing, and radiosity that happens in Beast.
Skyshop comes with tools for this that are documented more thoroughly in Documentation/Lightmapping.txt in the Skyshop package.
Follow these steps:
Step 0: You will need to create a Beast XML Settings file for your scene with the button at the bottom of Skyshop.
Step 1: You'll need to pick a panorama image for the bake, press "Use as GI" next to one of the cubemap slots in Skyshop. You'll probably want to use the skybox image.
Step 2: Set the baking "Environment Type" to "IBL", and a whole bunch more GUI will appear. NOTE: this may have to happen before Step 1, see what happens :P
Step 3: If you've been spinning your sky object around, click the "Align to Active Sky" button to make sure Beast knows how the panorama should be oriented. The orientation has to match or the baked lighting will be off.
Step 4: Bake!
Finally, you'll want to disable at least the dynamic light contribution from the sky, since neither Unity nor our shaders are clever enough to do this automatically.
Here I've set the diffuse and specular intensities to 0 in the sky, resulting in only baked lighting and a background skybox showing:
And here I've added back a small fraction of specular intensity to make sure some highlights still show through.
Now taking the intensity down in the sky is going to affect both lightmapped and dynamic geometry. Ideally you'll want to disable diffuse IBL on only static, lightmapped objects. Because the lightmapping art pipeline is still rough, this is a little tricky. But what I would do is generate a black cubemap (set the baking exposure in skyshop to 0 and bake a dummy cubemap) and assign it to the "Custom Diffuse Cube" slot of materials that are on lightmapped geometry.
Also, with Unity Pro (a requirement soon to go away) you can "probe" or capture cubemaps from directly inside your scene. Which means you could render a cubemap from inside your room and light all the objects inside that room with it. This is a nice, cheap approximation of bounced lighting and will get you nicer specular highlights as well:
A cubemap probe from the POV of the second sphere, applied only to the sphere:
You are awesome Andres! This is exactly what I needed and worked like a charm! Image is a bit darker online, but it defintely shows shaders and lightmaps playing well together
I appreciate the time and energy spent explaining this! Definitely understand IBL and lightmap interaction better. Thanks for awesome support and tools!
Hey guys, noticed on the unity store that iOS and android support has been added, and thought I'd ask if anyone is using it on those platforms and how it performs etc!
Got a project that it might work quite well for, but thought I'd ask here first. Would probably be being used to light a whole fairly simple env.
If anyone's interested: I have some scripts for a Source Engine-style cubemap implementation in Unity, where you put cubemap probe gameObjects everywhere, bake them in Unity editor, then use another script to "catch" the closest cubemap and swap that into your material. Details here: http://www.blog.radiator.debacle.us/2013/05/cubemapped-environment-probes-source.html
this may be a stupid question, but how do you go about modifying these shaders? I'm wanting to have the diffuse color property of the bumped spec ibl shader to only be applied to an area as indicated by the diffuse alpha channel (the rest just solid white). I was able to do this before with the beta shaders, but everything seems to be hidden away now?
I am also interested in modifying shaders. Ideally, I would like to be using skyshop based shaders for all my materials. If would be great to get some sort of strumpy integration but strumpy isn't supported anymore.
this may be a stupid question, but how do you go about modifying these shaders? I'm wanting to have the diffuse color property of the bumped spec ibl shader to only be applied to an area as indicated by the diffuse alpha channel (the rest just solid white). I was able to do this before with the beta shaders, but everything seems to be hidden away now?
All of the shader source is still included and totally editable. It takes a bit of familiarity with Unity's surface shaders and Cg/HLSL but what you describe should be totally doable. Take a look at the included documentation, Documentation/Shaders.txt:
SHADER SOURCE GUIDE
================
All variations of Marmoset shaders are built in ShaderLab using a core set of Marmoset include files, written in Cg, and included with full source for reference and customization. They can be found in the Marmoset/Shader/ folder as:
MarmosetCore - Shader math and RGBM code
MarmosetInput.cginc - Material parameters and input structures for ShaderLab shaders
MarmosetDirect.cginc - Direct lighting function for ShaderLab. Omni, direct, and spot-light results are computed here.
MarmosetSurf.cginc - Surface Lighting function for ShaderLab. Image-based lighting and texture lookups are performed here.
MarmosetMobile.cginc - Additional #defines, rules, and restrictions shared by all mobile shaders.
The .shader files (Bumped Diffuse IBL.shader, etc) themselves don't contain any real math. They simply include these .cginc files and use #defines to configure them for the a desired feature set.
...
As for Strumpy support, I took a brief look at integration early on but failed miserably. @AlecMoody, when you say it is not supported anymore, is it a dead project?
I'll also include the #define section of the docs here, its a good place to explain it. All major features of the Marmoset shaders can be enabled or disabled using preprocessor variables. This way all code can be in one function with no duplication, and entire blocks of instructions can be turned on or off at the beginning of each shader file.
If you look at Marmoset Bumped Specular IBL.shader, it only #defines the features it needs, specular, normalmapping, etc, and includes the one shared file containing the surface function. This also means the surface function itself is a mess of
#DEFINE FEATURES
--- #define MARMO_HQ
High-quality mode adds extra vector normalization and more rigorous lighting math to a few places in the shader. Disabled on mobile.
#define MARMO_SKY_ROTATION
Rotates reflection and normal vectors by a sky transform matrix passed in by sky objects. This is performed in the fragment shader and is costly. Disabled on mobile.
#define MARMO_DIFFUSE_IBL
Enables a lookup into the diffuse image-based lighting cubemap.
#define MARMO_SPECULAR_IBL
Enables a lookup into the specular image-based lighting cubemap.
#define MARMO_DIFFUSE_DIRECT
Enables diffuse contributions from direct light sources such as point and directional lights.
#define MARMO_SPECULAR_DIRECT
Enables specular contributions from direct light sources such as point and directional lights.
#define MARMO_NORMALMAP
Adds a normal-mapping texture lookup and math to the fragment shader.
#define MARMO_MIP_GLOSS
A SPECULAR_IBL feature that uses the specular sharpness material property to look into a specific mip level of the specular image-based lighting cubemap.
Note: Disable on hardware that does not support textureCubeLod texture lookups.
#define MARMO_GLOW
Adds a glow map texture lookup and math for self illuminating surfaces.
#define MARMO_PREMULT_ALPHA
Premultiplies OUT.Albedo.rgb by OUT.Alpha, to be used with a premultipled-alpha blending mode. This option does NOT premultiply the specular output, so the specular component of the surface is blended additively (See Simple Glass shader).
edit: i really like the way this is set up (in terms of modules) but man its a slow compile, any way to speed things up?
I've been talking to Aras, Unity's shader guru a bit and no, there really isn't a way to speed it up. Unity compiles every shader for every platform in multiple flavors: with lightmapping, without lightmapping, with shadows, without shadows, etc.
They are working on improving the process, caching things, compiling only shaders that are used, etc but that won't be public for a while. I've noticed compile times are way better on OSX because it only has OpenGL and GLES to compile to, as opposed to various flavors of D3D9, 10, and 11.
I'm also in the practice of zipping up all but one shader, say Bumped Specular IBL, and hiding them from the compiler. Makes incremental changes easier.
ok cool, thats a bit more clear now.
I found that at least while testing out changes i'm unsure about i can hide away all but one of the shaders in question then when things appear to be working, re-introduce the others into the project folder. speeds up a bit that way
This works how i want it to, however i need to get everything working off the original maintex's alpha channel. The issue is that i want the area NOT affected by the alpha channel to be colored (thus the example above having an inverted alpha channel), and then the area that IS covered by the alpha channel to just use the diffuse texture multiplied by solid white.
Say for example, I have a ship with multiple decks. The entire ship is destructible, wooden planks etc. Skyshops IBL shaders wouldn't work well with something like this?
With this scenario, the skybox can't affect the interior of the ship only the exterior. Being a destructible ship, it being dynamic, renders skyshop IBL pretty much useless right?
Skyshop seems like it's for games that have non-destructible environments, and area instanced. I'd imagine this would be the same if you have a destructible building and you wanted the interior to different to the exterior.
Skyshop would work really well for your destructable ship. What you would do is use two sets of cubemaps, one for the exterior of the ship and one for the interior.
How exactly would I set something like this up? Do I just create a cubemap inside the deck, and place that on every object's custom diffuse/spec cubemap input slots, on that deck level?
The interior is separated from one layer of planks from the exterior. Does that mean I shouldn't use a cubemap on the actual ship because it will make the cubemap visible on the inside?
Also another problem, my sky also brightens up the interior and even with directional lighting the interior shadows are not strong enough.
With skyshop IBL:
If I turn down the diffuse intensity on the sky gameobject the interior shadows are at a correct level, although then the exterior of the ship is also affected.
This is without skyshop IBL and using default shaders, which is how I'd like it to look. Darker on the inside without the exterior affected:
Increasing directional lighting strength does nothing for shadows even at the highest strength setting.
If you are using lightmaps you will want to force a black ambient cube to prevent it from getting double lit.
Also, lightmapping is probably never going to look right on a destructible environment.
New in Skyshop 1.04: none of the above-mentioned bull-crap! I just posted about a couple of new features people might otherwise miss in the new release on the Unity Forums
Some copy-pasta:
As you're playing around with 1.04, be sure to check out the included documentation and the hefty change-log at http://www.marmoset.co/skyshop/history There are also a few new features that did not make it into the new tutorial video:
New Menu Features - The Edit->Skyshop menu now includes options to do mass shader-to-mobile conversion and upgrad old 1.03 sky objects to the new 1.04 Sky script (required for proper namespace use).
Lightmapping Weights - You can now set diffuse and specular intensity multipliers for objects that are lightmapped. This allows you to adjust how much image-based lighting is added on top of your baked interior scenes.
Baked Diffuse IBL - The weights also allow you to turn off diffuse IBL entirely, in case you've baked your sky lighting into the lightmaps directly.
The other feature which might help your ship scene quite a bit is ambient occlusion. Skyshop 1.04 supports both vertex color ambient occlusion and AO maps, using a secondary UV channel (UV1).
And what's cool about the AO is that it only occludes the image-based portion of lighting. Your direct lights and shadows will still show up nice and bright but the lower deck of the ship will not get spec from the clear blue sky above.
Hello
I have started getting used to skyshop, thank you for this amazing tool!!
I have one question regarding spec maps that were included in the example files for the grinder and the moped. The spec maps were both pngs that contained alpha that was baked in, not in alpha channel as pngs dont support alpha channels (I guess). That said I want to be sure I understand how the png spec map works.
Here is how I think its working, (please please correct me if Im worng)
Alpha = more alpha reduces the strength of the cube map but increases the amount of light hitting the surface. 100% alpha would only allow the light from the light source basically the spec highlight.
Black = prevents both cubmap and light source from coming through, effectively killing all spec/reflection
Grey levels= sets strength of the cube map, white=100%, 127 grey = 50%, black equals = off
Color= Tints the cube map
Please correct me where Im wrong.. feel free to laugh at me openly through the forum
Hello
I have started getting used to skyshop, thank you for this amazing tool!!
I have one question regarding spec maps that were included in the example files for the grinder and the moped. The spec maps were both pngs that contained alpha that was baked in, not in alpha channel as pngs dont support alpha channels (I guess). That said I want to be sure I understand how the png spec map works.
Here is how I think its working, (please please correct me if Im worng)
Alpha = more alpha reduces the strength of the cube map but increases the amount of light hitting the surface. 100% alpha would only allow the light from the light source basically the spec highlight.
Black = prevents both cubmap and light source from coming through, effectively killing all spec/reflection
Grey levels= sets strength of the cube map, white=100%, 127 grey = 50%, black equals = off
Color= Tints the cube map
Please correct me where Im wrong.. feel free to laugh at me openly through the forum
Hi,
First off, PNGs do fully support alpha. The problem is how photoshop opens PNGs, it opens the alpha as "baked in" as apposed to a proper alpha channel like a TGA. We use PNGs for example content to keep the package size down.
Secondly, the alpha in the specular map channel is the gloss map. Darker values = rougher or more matte surfaces, and brighter values = smoother or more shiny surfaces. The alpha does not mask the specular reflection.
Has anyone tried Unity Skyshop with a mobile device yet? Could say the iPhone 5 handle a game with it?
The mobile shaders are very fast and are suitable for games. It's hard to give more in depth performance information as it is highly dependent on the complexity of the specific game, and the hardware the game is running on.
Suppose you have a single low poly character (WoW style) using skyshop for the lighting, think that would run okay?
Yes, Skyshop will be able to light a single WoW style character on mobile devices with very high performance.
First off, PNGs do fully support alpha. The problem is how photoshop opens PNGs, it opens the alpha as "baked in" as apposed to a proper alpha channel like a TGA. We use PNGs for example content to keep the package size down.
Secondly, the alpha in the specular map channel is the gloss map. Darker values = rougher or more matte surfaces, and brighter values = smoother or more shiny surfaces. The alpha does not mask the specular reflection.
I hope this helps.
Awesome thank you that does help!! Thank you for taking the time to respond, I appreciate it.
I'm having some trouble getting my normal maps in Unity to look right. I've tried every tool and process I can think of, but I just get lots of strange artifacts. They look like compression artifacts but they aren't present in the normal map images.
I'm guessing this is a unity problem and not a Marmoset IBL problem?
I'm having some trouble getting my normal maps in Unity to look right. I've tried every tool and process I can think of, but I just get lots of strange artifacts. They look like compression artifacts but they aren't present in the normal map images.
I'm guessing this is a unity problem and not a Marmoset IBL problem?
So basically you can have a texture with an alpha channel and then tint the color of everything outside the alpha (Black areas). This works great if i'm using a .tga which has a dedicated alpha channel, but unfortunately i need to use a .png (since its being downloaded via www class), so what ends up happening is the area that can be tinted, inherits a base color from all the surrounding pixels of the alpha'd areas (since with a .png i cant set a white background and have an alpha channel at the same time) and the tint color (_ColorWRAP) is multiplied on top of that resulting in some bad color blending.
to simplify:
I need a way to specify a white backing on transparent areas that the color can be multiplied on top of
so what ends up happening is the area that can be tinted, inherits a base color from all the surrounding pixels of the alpha'd areas (since with a .png i cant set a white background and have an alpha channel at the same time) and the tint color (_ColorWRAP) is multiplied on top of that resulting in some bad color blending.
to simplify:
I need a way to specify a white backing on transparent areas that the color can be multiplied on top of
So I think what you're describing is the awful way some apps (like photoshop) save .PNG files where if alpha is 0, RGB is discarded for the sake of compression. Unfortunately this is terrible for rendering and unfixable once the color data is gone.
I'm having trouble following your code but if you wanted to replace the bad RGB values at A=0 with white, try this:
//smoothly blends from RGB to white as alpha approaches 0
diff = tex2D(_MainTex, uv_diff);
diff.rgb = lerp(float3(1,1,1), diff.rgb, diff.a);
Alternately, scale and clamp alpha to only swap values 0 to 1/256 with white. All other RGB is intact.
There are also ways to save .PNGs with proper transparency, there's a plugin called SuperPNG for shoop that does it right. Maybe there's a way for you to request the image differently with WWW?
I've got another question regarding some custom work here.
What would be the best way to use the separate RGB channels of a mask texture to tint individual areas of a mesh?
I've managed to get the alpha channel working fine, but i'm not familiar with the process for getting individual color channel information. I thought it would be a matter of breaking it down like "Mask.R Mask.G Mask.B" but that doesn't seem to be the case. any ideas?
What can we say, this release has been a long-time coming! It is by far the most substantial Skyshop release to date. Building upon Skyshop's leading image quality in Unity, localized reflections and a good cubemap manager are paramount to achieving high scene fidelity within dynamic indoor and outdoor real-time projects. Skyshop now brings you the features and tool set to achieve this superb scene fidelity in all of your Unity projects.
1.07 introduces...
Sky Blending/Interpolation
Box Projected Cube Mapping
Spherical Harmonics Diffuse IBL
New Sky & Sky Manager System
Cubemap Probe System
...lest we forget, Shader Forge Integration! You can now tie in Skyshop's high quality image-based lighting with Unity's most popular node-based shader editor.
Thanks for that Shader Forge video, I've been playing around with trying to get that fresnel effect with the specular for a while when trying to create a shader with a PBR format but could never wrap my head around it. This should help quite a bit!
As the following image shows, I'm having some issues with CandellaSSR and the Marmoset skin shader (with Skyshop)
I'm currently using both, plus some other post effects (AA, SSAO, Color correction, lens dirtiness, vignetting, etc).
Please notice the artifacts/heavy blurring on the character on the right side in both deferred and forward renderers.
I'm in DX11, Linear space on PC using the latest released version of all effects and shaders.
Has anyone else experienced seams on specular cubemaps that previously didn't have any issues? All my my spec cubemaps are now showing seams:
This is an OpenGL/D3D9 issue with cubemap texture filtering. D3D11 can filter cubemap faces across corners so low res cubes look nice and uniformly blurry. D3D9, OpenGL, and GLES can only filter per face so you get harsh corners on blurry cubes. And the bigger the texels at the corners are, the worse the seams will appear.
Not much can be done about this at low cubemap mips, even with clever blurring of edge texels. If you have a 4x4 mip face to work with, there's not much room to fudge.
D3D9, OpenGL, and GLES can only filter per face so you get harsh corners on blurry cubes
Hi! Probably you already know this, but the technique in here work great: http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ . I am using that method in my own GLSL shaders (outside of Unity, for a renderer I am doing in OpenGL 3.0) and it works pretty well.
Example:
(high roughness = small mipmap. This must be sampling from the 32x32 and 16x16 ones).
The OpenGL ARB_seamless_cube_map extension works fine also, of course, but it's too modern for my purposes.
I know this is hardly the place to point out this, but just in case it helps
Skyshop asks mto supply one color map, normal map, a specular map with gloss map to be fed into its alpha. I use targa to do so but somehow I never get the gloss values from the map all I get is just the specularity.Is there a workflow to import PBR material setup to unity using skyshop?
Also is there a way to bring metallic/roughness setup instead of spec/gloss in unity 4x? Any shader? I know they have this in unity 5.
Also
I don't really understand This shader. I mean when I'm feeding in the specular colors as a spec map and I'm also feeding in the specular sharpness as a gloss map then whats the point of having additional SPEC SHARPNESS and SPEC COLOR parameters? Correct me if I'm wrong.
It looks like you're using an older version of skyshop that still has per material diffuse cube maps so i'd start by updating.
Next you'l want to plug in your specular cube map since reflectivity and specularity are tied together, so without that you wont be getting the proper effect.
Make sure that Unity is importing an alpha channel when reading your targa, and make sure your texture does not end up compressed in a format without an alpha channel. When in doubt: Automatic True Color.
The additional solid color and sharpness sliders are there for your convenience, in case you want to quickly play with values before going back to photoshop to alter textures. Feel free to keep them cranked at 1.0 and white.
Marmoset shaders don't have a metalness PBR workflow currently (metallic/roughness). However it closely resembles the specular PBR workflow (specular/gloss), with the exception of a different fresnel model and no specular energy conservation (high specular causing dim albedo). Here is a lengthy tutorial on how the two work flows are two sides of the same coin: http://www.marmoset.co/toolbag/learn/pbr-conversion
Replies
The lighting environments we used for the demo were from freely available sources, we didn't make those in-house.
There are a lot of resources out there for creating your own HDR panoramas though. Basic things you will need:
A. A camera that can do exposure bracketing(basically any dslr)
B. A wide lens, usually a fisheye or an ultra wide zoom. Fisheye will allow you to take fewer shots but the detail around the edges is worse.
C. A decent tripod. You don't need a panoramic head but it certainly helps
D. Some sort of software for processing the photos into HDR panoramas, there are a lot of options here. If you manually stitch your photos together you can use photoshop to do the HDR merging.
PTIGUI can stitch and HDR merge, so thats probably the best choice: http://www.ptgui.com/ [ame="http://www.youtube.com/watch?v=iElCsnWEtl4"]Stitching HDR Panoramas with PTGui - HDRPhotographyPro.com - YouTube[/ame]
HDRshop has a lot of HDR tools as well: http://www.hdrshop.com/
You can also do the "chrome ball" method, where you take photos with a chrome ball and convert that in panoramas, quality is really bad outside of the center of the ball though.
This is a test scene I've set up in forward rendering mode with one directional light. Trying to get the soft bounce light look (similar to Mirror's Edge). This post on the Unity Forum had a similar issue. I took the Sky Lighting Color down to black, but that did not change the light bakes at all.
I've tried deferred rendering, changing the color spaces, Skyshop mobile shaders, etc. Does anyone have a workflow for dealing with IBL and lightmaps? Thanks!
This is a complicated question but let me take a crack at it.
It helps to think of the Skyshop Sky object as another dynamic light in your scene. Objects with lightmaps can still be lit by other lights in the scene; think muzzle flashes, vehicle headlights moving around, etc. All these other lights are added on top of what's in the lightmap.
In your example pictures you have baked a directional light onto your geometry, which Unity is clever enough to disable when rendering. But the sky is still lighting your entire scene.
Here is a directional light baked onto some geometry:
Here's what happens when the skyshop sky is added on top of it. All of the bright blue sky and mountains still light the floor, the ceiling and the shadows.
You could try and split the difference by setting the Master Intensity or Spec & Diffuse intensities to 0.5. This would raise the relative contrast of your lightmap illumination and Skyshop's IBL.
But the most accurate solution is to bake both the directional light and Skyshop's image-based light all into the same lightmap. This this would mean the sky becomes static; you can no longer swap out skies or spin them around because it is baked into the LM. But the sky will contribute to all of the raytraced lighting, shadowing, and radiosity that happens in Beast.
Skyshop comes with tools for this that are documented more thoroughly in Documentation/Lightmapping.txt in the Skyshop package.
Follow these steps:
Step 0: You will need to create a Beast XML Settings file for your scene with the button at the bottom of Skyshop.
Step 1: You'll need to pick a panorama image for the bake, press "Use as GI" next to one of the cubemap slots in Skyshop. You'll probably want to use the skybox image.
Step 2: Set the baking "Environment Type" to "IBL", and a whole bunch more GUI will appear. NOTE: this may have to happen before Step 1, see what happens :P
Step 3: If you've been spinning your sky object around, click the "Align to Active Sky" button to make sure Beast knows how the panorama should be oriented. The orientation has to match or the baked lighting will be off.
Step 4: Bake!
Finally, you'll want to disable at least the dynamic light contribution from the sky, since neither Unity nor our shaders are clever enough to do this automatically.
Here I've set the diffuse and specular intensities to 0 in the sky, resulting in only baked lighting and a background skybox showing:
And here I've added back a small fraction of specular intensity to make sure some highlights still show through.
Now taking the intensity down in the sky is going to affect both lightmapped and dynamic geometry. Ideally you'll want to disable diffuse IBL on only static, lightmapped objects. Because the lightmapping art pipeline is still rough, this is a little tricky. But what I would do is generate a black cubemap (set the baking exposure in skyshop to 0 and bake a dummy cubemap) and assign it to the "Custom Diffuse Cube" slot of materials that are on lightmapped geometry.
A cubemap probe from the POV of the second sphere, applied only to the sphere:
And as applied to the entire scene:
I appreciate the time and energy spent explaining this! Definitely understand IBL and lightmap interaction better. Thanks for awesome support and tools!
Got a project that it might work quite well for, but thought I'd ask here first. Would probably be being used to light a whole fairly simple env.
All of the shader source is still included and totally editable. It takes a bit of familiarity with Unity's surface shaders and Cg/HLSL but what you describe should be totally doable. Take a look at the included documentation, Documentation/Shaders.txt:
As for Strumpy support, I took a brief look at integration early on but failed miserably. @AlecMoody, when you say it is not supported anymore, is it a dead project?
If you look at Marmoset Bumped Specular IBL.shader, it only #defines the features it needs, specular, normalmapping, etc, and includes the one shared file containing the surface function. This also means the surface function itself is a mess of
#ifdef MARMO_SOMEFEATURE
...
#endif
But such is the price of progress ;-).
edit: i really like the way this is set up (in terms of modules) but man its a slow compile, any way to speed things up?
I've been talking to Aras, Unity's shader guru a bit and no, there really isn't a way to speed it up. Unity compiles every shader for every platform in multiple flavors: with lightmapping, without lightmapping, with shadows, without shadows, etc.
They are working on improving the process, caching things, compiling only shaders that are used, etc but that won't be public for a while. I've noticed compile times are way better on OSX because it only has OpenGL and GLES to compile to, as opposed to various flavors of D3D9, 10, and 11.
I'm also in the practice of zipping up all but one shader, say Bumped Specular IBL, and hiding them from the compiler. Makes incremental changes easier.
Aras also linked me an interesting slideshow on the subject:
http://aras-p.info/texts/files/201301%20Shader%20Pipeline%20in%20Unity.pdf
I found that at least while testing out changes i'm unsure about i can hide away all but one of the shaders in question then when things appear to be working, re-introduce the others into the project folder. speeds up a bit that way
i've got something that works, but only with an aditional alpha input
in MarmosetSurf.cginc
//DIFFUSE
#if defined(MARMO_DIFFUSE_DIRECT) || defined(MARMO_DIFFUSE_IBL)
half4 diff = tex2D( _MainTex, uv_diff);
half4 diff2 = tex2D( _WrapAlpha, uv_diff);
diff2.rgb = diff2.a * _Color;
//camera exposure is built into OUT.Albedo
diff.rgb *= (_ExposureIBL.w -diff2.a) + diff2.rgb;
OUT.Albedo = diff.rgb;
OUT.Alpha = diff.a;
#ifdef MARMO_PREMULT_ALPHA
OUT.Albedo *= diff.a;
#endif
#else
OUT.Albedo = half3(0.0,0.0,0.0);
OUT.Alpha = 1.0;
#endif
This works how i want it to, however i need to get everything working off the original maintex's alpha channel. The issue is that i want the area NOT affected by the alpha channel to be colored (thus the example above having an inverted alpha channel), and then the area that IS covered by the alpha channel to just use the diffuse texture multiplied by solid white.
any help would be much appreciated
With this scenario, the skybox can't affect the interior of the ship only the exterior. Being a destructible ship, it being dynamic, renders skyshop IBL pretty much useless right?
Skyshop seems like it's for games that have non-destructible environments, and area instanced. I'd imagine this would be the same if you have a destructible building and you wanted the interior to different to the exterior.
The interior is separated from one layer of planks from the exterior. Does that mean I shouldn't use a cubemap on the actual ship because it will make the cubemap visible on the inside?
Also another problem, my sky also brightens up the interior and even with directional lighting the interior shadows are not strong enough.
With skyshop IBL:
If I turn down the diffuse intensity on the sky gameobject the interior shadows are at a correct level, although then the exterior of the ship is also affected.
This is without skyshop IBL and using default shaders, which is how I'd like it to look. Darker on the inside without the exterior affected:
Increasing directional lighting strength does nothing for shadows even at the highest strength setting.
Also, lightmapping is probably never going to look right on a destructible environment.
New in Skyshop 1.04: none of the above-mentioned bull-crap! I just posted about a couple of new features people might otherwise miss in the new release on the Unity Forums
Some copy-pasta:
As you're playing around with 1.04, be sure to check out the included documentation and the hefty change-log at http://www.marmoset.co/skyshop/history There are also a few new features that did not make it into the new tutorial video:
New Menu Features - The Edit->Skyshop menu now includes options to do mass shader-to-mobile conversion and upgrad old 1.03 sky objects to the new 1.04 Sky script (required for proper namespace use).
Lightmapping Weights - You can now set diffuse and specular intensity multipliers for objects that are lightmapped. This allows you to adjust how much image-based lighting is added on top of your baked interior scenes.
Baked Diffuse IBL - The weights also allow you to turn off diffuse IBL entirely, in case you've baked your sky lighting into the lightmaps directly.
And what's cool about the AO is that it only occludes the image-based portion of lighting. Your direct lights and shadows will still show up nice and bright but the lower deck of the ship will not get spec from the clear blue sky above.
I have started getting used to skyshop, thank you for this amazing tool!!
I have one question regarding spec maps that were included in the example files for the grinder and the moped. The spec maps were both pngs that contained alpha that was baked in, not in alpha channel as pngs dont support alpha channels (I guess). That said I want to be sure I understand how the png spec map works.
Here is how I think its working, (please please correct me if Im worng)
Alpha = more alpha reduces the strength of the cube map but increases the amount of light hitting the surface. 100% alpha would only allow the light from the light source basically the spec highlight.
Black = prevents both cubmap and light source from coming through, effectively killing all spec/reflection
Grey levels= sets strength of the cube map, white=100%, 127 grey = 50%, black equals = off
Color= Tints the cube map
Please correct me where Im wrong.. feel free to laugh at me openly through the forum
Suppose you have a single low poly character (WoW style) using skyshop for the lighting, think that would run okay?
Hi,
First off, PNGs do fully support alpha. The problem is how photoshop opens PNGs, it opens the alpha as "baked in" as apposed to a proper alpha channel like a TGA. We use PNGs for example content to keep the package size down.
Secondly, the alpha in the specular map channel is the gloss map. Darker values = rougher or more matte surfaces, and brighter values = smoother or more shiny surfaces. The alpha does not mask the specular reflection.
I hope this helps.
The mobile shaders are very fast and are suitable for games. It's hard to give more in depth performance information as it is highly dependent on the complexity of the specific game, and the hardware the game is running on.
Yes, Skyshop will be able to light a single WoW style character on mobile devices with very high performance.
Awesome thank you that does help!! Thank you for taking the time to respond, I appreciate it.
I'm guessing this is a unity problem and not a Marmoset IBL problem?
Can post images later tonight.
Take a look at this: http://docs.unity3d.com/Documentation/Components/class-Texture2D.html
from MarmosetSurf.cginc
//DIFFUSE WRAP
#if defined(MARMO_DIFFUSE_DIRECT_WRAP) || defined(MARMO_DIFFUSE_IBL_WRAP)
half4 diff_Wrap = tex2D( _MainTex, uv_diff);
half4 Inverted_Diff_Wrap =1.0- tex2D( _MainTex, uv_diff);
//pseudo code: Inverted_Diff_Wrap .rgb = (Inverted_Diff_Wrap .a = color.White ) * _ColorWRAP;
Inverted_Diff_Wrap.rgb = (Inverted_Diff_Wrap.a ) * (_ColorWRAP - diff_Wrap.a);
diff_Wrap.rgb *= (ExposureIBL.w -Inverted_Diff_Wrap.a ) + (Inverted_Diff_Wrap.rgb);
OUT.Albedo = diff_Wrap.rgb ;
OUT.Alpha = diff_Wrap.a;
#ifdef MARMO_PREMULT_ALPHA
OUT.Albedo *= diff_Wrap.a;
#endif
#else
OUT.Albedo = half3(0.0,0.0,0.0);
OUT.Alpha = 1.0;
#endif
So basically you can have a texture with an alpha channel and then tint the color of everything outside the alpha (Black areas). This works great if i'm using a .tga which has a dedicated alpha channel, but unfortunately i need to use a .png (since its being downloaded via www class), so what ends up happening is the area that can be tinted, inherits a base color from all the surrounding pixels of the alpha'd areas (since with a .png i cant set a white background and have an alpha channel at the same time) and the tint color (_ColorWRAP) is multiplied on top of that resulting in some bad color blending.
to simplify:
I need a way to specify a white backing on transparent areas that the color can be multiplied on top of
Sorry I can't help you with your issue specifically.
So I think what you're describing is the awful way some apps (like photoshop) save .PNG files where if alpha is 0, RGB is discarded for the sake of compression. Unfortunately this is terrible for rendering and unfixable once the color data is gone.
I'm having trouble following your code but if you wanted to replace the bad RGB values at A=0 with white, try this:
Alternately, scale and clamp alpha to only swap values 0 to 1/256 with white. All other RGB is intact.
There are also ways to save .PNGs with proper transparency, there's a plugin called SuperPNG for shoop that does it right. Maybe there's a way for you to request the image differently with WWW?
I could work with www differently and request the raw bytes however i'd like to avoid that so hopefully this should do the trick
Edit: both methods worked great, thanks again!
What would be the best way to use the separate RGB channels of a mask texture to tint individual areas of a mesh?
I've managed to get the alpha channel working fine, but i'm not familiar with the process for getting individual color channel information. I thought it would be a matter of breaking it down like "Mask.R Mask.G Mask.B" but that doesn't seem to be the case. any ideas?
What can we say, this release has been a long-time coming! It is by far the most substantial Skyshop release to date. Building upon Skyshop's leading image quality in Unity, localized reflections and a good cubemap manager are paramount to achieving high scene fidelity within dynamic indoor and outdoor real-time projects. Skyshop now brings you the features and tool set to achieve this superb scene fidelity in all of your Unity projects.
1.07 introduces...
- Sky Blending/Interpolation
- Box Projected Cube Mapping
- Spherical Harmonics Diffuse IBL
- New Sky & Sky Manager System
- Cubemap Probe System
- ...lest we forget, Shader Forge Integration! You can now tie in Skyshop's high quality image-based lighting with Unity's most popular node-based shader editor.
Download Skyshop 1.07: http://u3d.as/4JxSkyshop 1.07 | Quick Reference: http://goo.gl/yAyllD
Skyshop 1.07 | Video Tutorials: http://goo.gl/C3lS0b
I'm currently using both, plus some other post effects (AA, SSAO, Color correction, lens dirtiness, vignetting, etc).
Please notice the artifacts/heavy blurring on the character on the right side in both deferred and forward renderers.
I'm in DX11, Linear space on PC using the latest released version of all effects and shaders.
I'm new to skyshop & unity.
noob Question : How to use sky blend?
I watched tutorial video on vimeo.
but I cant understand about blending.
This is an OpenGL/D3D9 issue with cubemap texture filtering. D3D11 can filter cubemap faces across corners so low res cubes look nice and uniformly blurry. D3D9, OpenGL, and GLES can only filter per face so you get harsh corners on blurry cubes. And the bigger the texels at the corners are, the worse the seams will appear.
Not much can be done about this at low cubemap mips, even with clever blurring of edge texels. If you have a 4x4 mip face to work with, there's not much room to fudge.
Hi! Probably you already know this, but the technique in here work great: http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ . I am using that method in my own GLSL shaders (outside of Unity, for a renderer I am doing in OpenGL 3.0) and it works pretty well.
Example:
(high roughness = small mipmap. This must be sampling from the 32x32 and 16x16 ones).
The OpenGL ARB_seamless_cube_map extension works fine also, of course, but it's too modern for my purposes.
I know this is hardly the place to point out this, but just in case it helps
Also is there a way to bring metallic/roughness setup instead of spec/gloss in unity 4x? Any shader? I know they have this in unity 5.
Also
I don't really understand This shader. I mean when I'm feeding in the specular colors as a spec map and I'm also feeding in the specular sharpness as a gloss map then whats the point of having additional SPEC SHARPNESS and SPEC COLOR parameters? Correct me if I'm wrong.
Regards
Next you'l want to plug in your specular cube map since reflectivity and specularity are tied together, so without that you wont be getting the proper effect.
The additional solid color and sharpness sliders are there for your convenience, in case you want to quickly play with values before going back to photoshop to alter textures. Feel free to keep them cranked at 1.0 and white.
Marmoset shaders don't have a metalness PBR workflow currently (metallic/roughness). However it closely resembles the specular PBR workflow (specular/gloss), with the exception of a different fresnel model and no specular energy conservation (high specular causing dim albedo). Here is a lengthy tutorial on how the two work flows are two sides of the same coin: http://www.marmoset.co/toolbag/learn/pbr-conversion