Home 3D Art Showcase & Critiques

Gir's Toolbag 3 shaders, scripts n stuff!

13
ngon master
Offline / Send Message
almighty_gir ngon master

https://gumroad.com/l/iQYA

My channel display shader for Marmoset Toolbag3 is up on Gumroad for free! This shader is meant to mimic the Marmoset Viewer channel display feature, allowing you to post detailed breakdowns of your materials in high resolution.

Sorry if this is in the wrong place mods, i know there's a user content area but none of the subforums really apply.

One note i would make:
Local Reflections will show up as they are a screenspace effect, so if you're getting an almost fresnel like effect, make sure to disable that.
Currently using Skin or Microfibre diffuse settings will cause some "bleed" into gloss/reflectivity. I'm working on removing that, but it won't be easy as i don't have access to certain things.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


https://gumroad.com/products/KEmbw

This shader is designed to let you render your models with a cell shaded aesthetic!

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


https://gumroad.com/products/cyXi

Diffuse roughness!

This shader is designed to extend Toolbag 3's base diffusion model to allow diffuse roughness. It includes two models:

Disney's diffuse model by Brent Burley

(Oren-Nayar) diffuse BRDF by Shree Nayar and Michael Oren


You can use a custom roughness input for the diffuse, or use the checkbox to use the material's base roughness module (it will automatically invert gloss).


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Simple script for Marmoset Toolbag 3: Get it here!

Allows you to export Cameras, Lights (or both) from Toolbag into a data file, and then import them into another scene! And it's completely free!

Plugin will work with Toolbag 3.07 and newer, it might work with earlier versions but that cannot be guaranteed.

How to use:

  • Unpack the zip file into '\Marmoset\Toolbag 3\data\plugin'.
  • In toolbag, select 'Edit > Plugins > Gir_Utilities > SceneComponentIO'.
  • Select your import or export type from Both, Camera, or Lights, and either export selected, export all, or import!

Current limitations:

  • Folder/Groups not supported. You can still export the cameras and lights, but the folders will not be available on import. This access is not available in Toolbag yet, when it is, i'll add it.
  • Keyframe data for objects is lost on export, when imported they will be in whatever location they were at when exported. Again this is a limitation of the software, if this functionality is ever added, i'll update the plugin.

Replies

  • Koromo
    Offline / Send Message
    Koromo polycounter lvl 4
    Thanks, very useful!!

    Goodbye to photoshop and  the typical line separation between different textures or uploading viewer textures at 2k in most cases.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Koromo said:
    Thanks, very useful!!

    Goodbye to photoshop and  the typical line separation between different textures or uploading viewer textures at 2k in most cases.
    To be clear, this doesn't create the above image as-is. you will need to render each channel and then put them together in whatever fancy way you choose. This shader just gives you access to the channels themselves in the viewport.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Super useful. Would be nice to have a "fullbright Tangent space normalmap" pass too - not necessarily for neat presentation shots (which look better with the smooth, overall screen space), but more as a mean to review the quality of a baked nmap in itself.

    (It would be especially useful since as of now, TB3 has a long standing bug  making it forget the original path to loaded textures when bringing up the file browser window - meaning that manually browsing for a new texture to load into a given slot can be a pain).
  • lotet
    Offline / Send Message
    lotet hero character
    OH YES thank you!

    EDIT: Just tried it out, works like a charm. if you take feature requests, It would be really nice if we could have wireframe options directly in the shader as well.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    pior said:
    Super useful. Would be nice to have a "fullbright Tangent space normalmap" pass too - not necessarily for neat presentation shots (which look better with the smooth, overall screen space), but more as a mean to review the quality of a baked nmap in itself.

    (It would be especially useful since as of now, TB3 has a long standing bug  making it forget the original path to loaded textures when bringing up the file browser window - meaning that manually browsing for a new texture to load into a given slot can be a pain).
    There's no real way to do a fullbright Tangent space pass, unfortunately. By the time this shader has access to the surface normals, they've already been converted to world space. The only thing i can think to do instead, i guess, is to add an entry to the shader for emissive, so you can load the tangent space into there instead, that way it would be sampled as a texture rather than being converted to world space.

    lotet said:
    OH YES thank you!

    EDIT: Just tried it out, works like a charm. if you take feature requests, It would be really nice if we could have wireframe options directly in the shader as well.
    I'm not against feature requests at all, but i'm not sure if this is even possible. The way toolbag renders wireframes is separate from the material pass. I might look into a way to control that through python scripting though.... There might be a way to do batch renders through python, including wireframes.
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    Just sample the existing tNormal. 



    <div>#include '../state.frag'</div><div><br></div><div>void	normalDisplay( inout FragmentState s )</div><div>{</div><div></div><div><br></div><div>&nbsp; &nbsp; vec4 nsamp = texture2D( tNormalMap, s.vertexTexCoord );</div><div><br></div><div>&nbsp; &nbsp; s.emissiveLight = vec3( nsamp.rgb );</div><div><br></div><div>}</div><div><br></div><div>#ifdef Emissive</div><div>#undef Emissive</div><div>#endif</div><div>#define Emissive	normalDisplay</div>
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Cool, i'll add that shortly. didn't know i could sample textures from other parts of the material like this.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Thanks @radiancef0rge, again i wasn't aware that i could sample textures from elsewhere in the material, this opens up a couple of other opportunities that i'd like to explore.

    @pior is this what you wanted?

    https://www.youtube.com/watch?v=_GJX5mVQgwk
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Definitely ! Might be a bit bright though, as if a gamma/linear conversion was being applied (not sure, might just be the video)
  • EarthQuake
    Hey Lee, I had a go with this and have some notes:

    UI: This is sort of hard to use because there isn't much reference to the user for what 0,1,2, etc mean. I talked to Jeff about adding a dropdown but that isn't possible atm with the shader system. I'm not sure if there is an alternative way you could present this that would be a little easier to read.

    Input grabbing: This seems to work well for the common material types but doesn't grab less common inputs like height, sub-dermis, translucency, ao, transparency, emissive, etc. This isn't a deal breaker but it would be cool if the shader was able to access all the inputs.

    When used with refraction, the shader failed to pull in the normal channel.

    It would be cool to have an object space/vs tangent space toggle.

    My diffuse map seems to be coming through in the normal map mode, probably related what you were discussing above.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    @pior it's likely because normal maps are sampled in linear space, i can change it to gamma easily enough, just wanted to confirm this was what you wanted.

    @EarthQuake, thanks for taking the time to test and give feedback man, i appreciate it!

    UI: without dropdowns there's not much i can do, i did play with the idea of having multiple checkboxes, but the problem with those is that there's not a "clean" way of making it so that if you turn one thing on, you turn the others off. It's possible to do it with checkboxes (would you mind if i sent you a version to test?), but the code itself will just be... messy. That said, if the end result is that it's easier for users, then that's fine by me.

    I don't mind adding additional inputs, BUT, there's currently no way to dynamically update the UI to reflect things that are/aren't enabled in the material currently. So if someone were to enable height but the surface mode is set to normal, they would get a black output and it doesn't make sense for it to even be there.

    Does the refraction problem persist across the entire surface? or only where the alpha map isn't white?

    The toggle i added for Pior should do basically the same thing, if you enable it and your map is an object space map, that is the one that will be displayed.

    The diffuse coming through is an issue with anything but lambertian mode. I'll be making a fix for this later today =]
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Regarding the numbered input : personally I quite like the slider control because it makes it so fast to cycle through modes for review. Maybe it's just a matter of adding an explicit comment block in the UI, clearly stating what each mode does ?

    Like this (don't mind the names and order, that's just an example) :



    That's just a suggestion though - I haven't used it for long enough to really be able to tell what is useful and what is superfluous in the long run.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    I wish i had the freedom to add stuff like that. But unfortunately the custom shader system is lacking (my fault, i never got to finish it before leaving Marmoset) on the UI side of things.

    This is a possible current iteration:


    The downside here, is that things have to be activated sequentially. So if you have Normals displayed, but then display Albedo and Reflectivity, you'd need to disable Albedo and Reflectivity to enable Normals again.

    The upside is that things are much more clearly labeled.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master

    https://gumroad.com/products/iQYA

    - ToolbagCustomChannelDisplay_V1.01 -

    • Changed the way normals render, so that they more effectively display your normals!
    • Added tickbox so you can display your normal texture map as-is, if you choose to.
    • Managed to get rid of "ghosting" from Albedo into other channels when using skin or microfibre diffusion profiles.
    • Minimized effect of refraction shader on displayed channels.
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    Would the TS view benefit from being converted to srgb for viewing purposes? 
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Would the TS view benefit from being converted to srgb for viewing purposes? 
    Done in the latest release :)
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master

    - ToolbagCustomChannelDisplay_V1.02 -
    • Fixed an issue that was causing world space normals to render too dark.
    • Changed the way gloss is displayed, so that if you're using roughness, it displays as roughness.
    • Added a feature requested by Pior Oberson, to allow you to display roughness in sRGB if desired, this will give a closer output to what you see in photoshop when authoring a gloss map there.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    https://gumroad.com/products/iQYA

     - ToolbagCustomChannelDisplay_V1.03 -
    • Changed the channel selection from a slider, to a drop-down menu.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Custom cell shaded shader is now available, for free!

    Thanks to @Swizzle for the demo scene.


    https://gfycat.com/DecimalSmallBergerpicard < high res gfycat.
    https://gumroad.com/products/KEmbw
  • rohMizuno
    cool stuff!
    I think the ability to tweak the specular opacity would be a good addition.
  • witos
    Offline / Send Message
    witos polycounter lvl 5
    Hi! Awesome usefull tool,  thanks for it! Is it real to bind any hotkey for change channels? via Substance Painter, etc?
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    witos said:
    Hi! Awesome usefull tool,  thanks for it! Is it real to bind any hotkey for change channels? via Substance Painter, etc?
    This is largely impossible, as you can't bind hotkeys to shader values in Toolbag.

    However, at some point when i get the time, i'd like to write a little python script that batches out screenshots for you.

  • nostrilking
    Just tried out the Cell Shader! It's great! A few feature requests:

    - Separate line thickness/color controls for internal lines vs. silhouette lines
    - Control over the "threshold" to determine where to draw the internal lines based on normal strength. 
    - Option for line color to be derived from underlying/nearby pixel colors with a darkening factor (so you could "automatically" have colored lines based on the diffuse colors, but then darken them a variable amount).
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Just tried out the Cell Shader! It's great! A few feature requests:

    - Separate line thickness/color controls for internal lines vs. silhouette lines
    - Control over the "threshold" to determine where to draw the internal lines based on normal strength. 
    - Option for line color to be derived from underlying/nearby pixel colors with a darkening factor (so you could "automatically" have colored lines based on the diffuse colors, but then darken them a variable amount).
    Thanks for the feedback, just to clarify:
    Could you provide an example of what you define internal and silhouette lines to be? Your description makes me believe you're not referring to the outline controls.
    Similar to the above, i'm confused on this one. The "bias" slider should be all you need for this, as it pushes the lines further or closer to the light source.
    Having the lines darken the color instead of multiplying down is cool, i can add that.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    Gir: Thanks so much for hooking us up with this shader!  

    More control over the outline parameters would be my main request as well.  I see that you have "Use Vertex Normals as an option for the overall effect.  It would be cool if you had "use Vertex Normals" as an option for JUST the outline effect as well.  This way, if you want to really just go heavy on the outline of the sillohette you could do that.  
    I especially like how easy it is to control the banding and lightness of the shadows.  I really love how you did that!

    The other feature request which would really just be the iceing...  if you implemented some  of the cool stuff that the dota shader does.  Namely the Diffuse warp feature where you can tint shadows based on a simple texture ramp, and the rim lighting where you can plug in a mask to control exactly where it effects the character based on uvs.  

    Anyway, I can't say enough how pleased I am to see these custom shaders coming online.  Great work man!
  • Sunray
    Offline / Send Message
    Sunray polycounter lvl 7
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Cell Shader update!

    ----V1.01----

    Have added a highlight map input, for you to better control the brightness of any highlights.
    Have added a highlight control slider for fine tuning the highlight intensity.
    Have separated the mesh and outline normals, you can now choose which ones will drive the shading and outlines independantly.
    Have added a "lighting style" option. The default is set to multiply down linearly, and there is a new option for the shader to add contrast as it darkens, giving you nice vibrancy.

    Due to the addition of the highlight map input, i've removed the hooks into Toolbag's default reflectivity module. You can put your existing specular OR metallic maps into the highlight map input, i convert them to grayscale in the shader anyway. This was largely because the default module didn't play nice with the shader's ambient light setting. You can still control the size of the highlight using toolbag's gloss module.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    Great update man!  I noticed that the shader sorta "picks" a light based on the last one you turned on or messed with in general.  Which is ok, but would be easier if you could select specifically from a drop down which light you want to use.  But one problem I ran into is that if you have a scene setup with multiple characters for example and you want different light interactions, you can only choose one universal light to effect everything.  It would be cool if you could choose say light A for character 1, and light B for character 2.  I'm not sure how hard this is to do in code, but for more complicated setups this would be huge.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    That is... an interesting issue. I'll have to look into what's causing that. It shouldn't be doing that.

    Thanks for the heads up!
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator


    Some results from messing around with my scene and compositing in the characters individually do to the lighting issue I mentioned earlier.  Yea, if only we could get a nice rim added it would have everything I need I think, minus a little more polish here and there with shader options.  Very cool to use as is tho!
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Okay just tested it a bit on my end.

    All lights in the scene will affect all objects, BUT they're much more sensitive to distance/attenuation now. It's almost a binary switch, it's either in range or it isn't, there's no real "soft" transition into light range.

    I'm 99.9% certain that i can't do selective lighting like that. It would require Toolbag to have some form of light layering system similar to Unity, which it doesn't have.

    What did i miss from your previous list of requests? ramp input for shadows, and a mask input for the outline?
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    yup those two are my big hitters.  That sounds awesome tho, super excited about this!

  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Could you maybe do a paintover on that last (awesome!) image, to show what kind of rimlight you're after?
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    thanks man!  So the rim I'm going for is like you see with this guy on my artstation...  https://www.artstation.com/artwork/XvBnw       So I basically found a way to hack the Dota Shader to get what I was after, but its far from ideal, and I was hoping for a better solution, (Your shader!).  At the bottom of those images there is a pretty thorough description of what I am doing, but ideally a rim with a mask input so you can control areas it effects to fake some super strong back lighting.  The images on my artstation pretty much highlight exactly what I was after, but the shader falls short both with easy of making the outline effect and the gritty cell shaded effect I can get with your shader currently.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Cell Shader Update!
    ----V1.02----

    Have added a ramp input and shading style, so you can have direct control over how your model is shaded as you choose.
    Have added a mask to control where the outline appears, if you wish to use it.
    Have added rimlight controls! You can now add a rimlight to your model, and you can choose to have it based on view direction, or based on input vectors of your choice to add that extra style to your work.
    Have added a rimlight mask.
    Have added rimlight color controls.
    Have added a checkbox to allow rimlights to be affected by the global shadow map.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    damn dude, looking forward to checking this out!

  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    damn dude, looking forward to checking this out!

    Image result for show me what you got
  • Joopson
    Offline / Send Message
    Joopson quad damage
    How exactly does the ramp input work? Opened up the shader to check it out, but it wasn't clear.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Joopson said:
    How exactly does the ramp input work? Opened up the shader to check it out, but it wasn't clear.
    It's based on incident angle to light. Essentially, NdotL + bias drives it. You have to set "shadow style" from multiply to ramp, for it to become active.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator


    Man...  This shader is sweet!  

    Check the "Rim Map" texture input.  Its not working on my end at least.  When I plug in my mask it does nothing.  I had to photoshop/mask out the rim in the interior areas.  But what you see here is what I was after as far as the rim.  I jacked up the settings on the rim way past what the slider allows.  No big deal, but my setting for Tightness was 33, and my setting for strength was 22.  

    The mask slot works perfectly on the outline effect, very nice!

    The added Highlight Map style to plug in "ramp" is awesome.  Tons of possibilities there!  I just used Multiply here though, but I did mess with it and got cool results as well.  I think the ramp with texture would be the key to getting the most control out of this shader, it just takes a lot of back and fourth to get what you want.

    On the note of "lighting style" and "enable highlight".  I was able to figure it out, but you have written "Highlight Map" twice so that may confuse some people.  Also the "Rimlight Map" should read "Rimlight Mask".

    Those directional controls on the Rimlight are killer!  I love that you added that feature!

    Great work, I hope I was able to help!


  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Hey Brad,

    Thanks for all this feedback. You're correct i'd not hooked up a variable correctly and so the rim map wasn't working. And thanks for letting me know about the misnamed maps in the UI.

    I'll have an update out later this evening to fix all of that stuff, so hopefully no more photoshop for you!
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    haha!  Awesome man, thanks!  I'm super excited to start a new project using your shader
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Cell Shader Update!
    ----V1.03----

    Bug fixes ahoy!
    Fixed an issue where ramp texture and highlight texture had the same name.
    Fixed an issue where rimlight map wasn't working.
  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    Just got the email about the update and tried it out.  All works as expected.  Very Cool!
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    ALL THE SHADERS!!!



    Diffuse roughness!

    This shader is designed to extend Toolbag 3's base diffusion model to allow diffuse roughness. It includes two models:

    Disney's diffuse model by Brent Burley

    (Oren-Nayar) diffuse BRDF by Shree Nayar and Michael Oren


    You can use a custom roughness input for the diffuse, or use the checkbox to use the material's base roughness module (it will automatically invert gloss).


    https://gumroad.com/products/cyXi


  • BradMyers82
    Offline / Send Message
    BradMyers82 interpolator
    Hey man, Just updated my artstation with an image made with your shader and gave you a drop for it (another screen grab of my fighter guy).  I really hope you can get some more exposure with your shader work here, (Polycount News Section perhaps) as its not super easy to find at this point if googling around for marmoset custom shaders.  Anyway, thanks again for the great work!
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Aw man you're too kind. Thanks for the plug! Let me know if you have any more feature requests, or even if you have ideas for other shaders that might be useful.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Coming soon (TM).
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    So the above prrof of concept is on a per-material basis, which would be cool, but also has the limitation that as you can see, a smooth surface like a sphere would still be smooth.

    Below is me hacking it as a post process (replacing film grain). If someone could convince Marmoset to add a custom post process shader input... *cough* @EarthQuake *cough*, that would be awesome.


  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
13
Sign In or Register to comment.