1. Welcome to VRCat! Please note that this message board is not related to VRChat in any official manner. It is run entirely by the community, and moderated by the community. Any content present has not been reviewed by VRChat moderators or staff. Your use of these forums implies understanding of this message. Thanks!
    Dismiss Notice

Avatars Xiexe's Toon Shader (v1.5 | Updated 11/1/2018) - XSToon - The Big Boi Update

Discussion in 'Tutorials and Tools' started by Xiexe, Jun 9, 2018.

  1. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    Hiya!

    I've been working hard over the course of the past 7 months or so to bring the best custom lighting/toon shader experience possible to VRChat.

    I'll give a brief rundown of what this shader can do, and what it looks like!

    Update : If you have issues where the shader does not look correct, or ignores switching lighting modes, reset your material. This is caused by the shader trying to inherit properties of your previous, it usually shouldn't be an issue, but sometimes it'll happen.

    Features:
    • Customizable Stylized Rimlight and Specular Reflections
    • Dynamic Stylized Shadow receiving and self shadowing under real-time light.
    • Proper transparency support, along with options to "fake" transparency so that shadows can still be received.
    • Custom Shadow Ramp support - Vertical or Horizontal both work. MMD users with vertical ramps rejoice.
    • Gets a proper light direction from Baked lighting.
    • Advanced options for customizable stencil buffer shenanigans.
    Image of the material settings as they stand.
    [​IMG]

    Here's an image of all of the material settings expanded to full. This means advanced mode, reflections, and emissions all turned on.
    [​IMG]

    As you can see, the shader is very flexible if you want it to be, and allows you to customize pretty much everything, if desired.

    I'll post an example and a bit of info on everything below, in the same order as listed above.
    NOTE: Features that are added in updates will be listed below this list, next to the changelog.

    Rimlight/Specular Reflections:
    Gif of them in realtime.


    Simple Scratch Pattern
    [​IMG]

    Weaved Pattern
    [​IMG]

    The rimlight and specular reflections are stylized and fully customizable. You can choose to have a sharp or smooth rimlight, change the width, etc. The reflections pattern can be changed, alongside the tiling and the smoothness of the material, and intensity of the reflections.

    Dynamic Shadow Receiving:
    This is a real-time light only feature, basically if there is a light source that casts shadows, and an object between you an that light source, you will receiving those shadows, but stylized.


    Transparency:
    There are a few options for transparency using my shader.
    Standard Fade and Transparent, which is used as you would usually expect from transparent objects.

    However, there is a drawback to standard transparency in that it cannot receive real time shadowing as discussed above.

    I've included a few options to help combat this, but they are by no means perfect. They include the following:

    Dithered Transparency : This is essentially a cutout shader, but it uses math to cut out a bunch of pixels, basically think of this as cutting out a grid in different patterns, either on or off. Here's an example of how that looks.

    Shadowed versions of Fade and Transparent are also options, however this was achieved by moving the render queue to AlphaTest+50. Long story short, this basically means that anything that is transparent wont be rendered behind things using this option, though it should not be a big deal for smaller things.

    Custom Shadow Ramps:

    I want to say most people know what this is by now, basically its a gradient, with hard or smooth steps, or both, that controls how your shadows will look.

    Proper Light Direction from Baked Lighting:
    That's right, you'll have real shadows based on where light is coming from in baked lighting. No fake light direction. No funny business.

    Customizable Stencil Buffer Stuff:
    This shader pack also comes with an advanced mode and another shader packaged with it to work with that advanced mode. It will allow you to do things with stencil buffers, and adjust things like Zwrite and Ztest.
    Things that can be done would include "portals" such in that you could have a quad in your hand, that would "reveal" your character while in front of it, but otherwise you'd be invisible. The readme has a tutorial on how to set this up really easily.


    Features added with updates:
    - Metallic Support:
    This allows you to assign metallic parts of a material, either with sliders, or with textures. This works exactly like any PBR shader would. Black and white images in roughness and metallic maps to determine how rough or smooth and how metallic an object is. Or, optionally, sliders for those who don't want to make the texture maps.
    - Matcap:
    Matcapping is a technique commonly used to fake lighting. It takes a 2D texture, usually a render of a sphere, and warps it around the model in such a way that it makes the model look as though it was lit exactly how the sphere was.

    - Stylized Reflections:

    Stylized Reflections are a reflection mode in which you have sharp, toon like reflections.
    There are two modes for this, Dot and Anistropic. Dot will be a dot that will get squashed and stretched based on the normals of the model.
    Anistropic will try to always be a horizontal line across the mode, which is great for hair reflections!

    - Colored Shadow Ramp Support:
    This makes your shadows inherit the color of the ramp. You can also choose to instead use the environment color for them.

    Here's some examples of the shader in action!
    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]
    And I think that's it! Enjoy the shader!

    Changelog:

    Changelogs have been moves to github - 1.5 has a big one.

    Download V1.5: https://github.com/Xiexe/Xiexes-Unity-Shaders/releases/

    NOTE: If you use a shadow ramp that is any lighter that the ones I've included, you will want to disable shadows on your mesh. Anything lighter than what I've included in the dark part of the ramp will break the blending between realtime shadows and the ramp shadows. I am currently working on a method to solve this, for now I would just stick to ramps that don't go above .5 in the dark part.

    Special thanks to all of the people who have helped me in the past months to test and work out bugs.
    Mainly being Mimi, TCL, Error.mdl, NepsyNeptune, Zarniwoop, ACIIL, Fyzer, Novax, Shadix, TheGreatDog, Morra812, Mochie, ScruffyRules, Euan, Toocanzs, Navac, Awrini, Tyrenas, and Rapha! You guys rock!

    UPDATE: If you would like to keep track of the development and my priorities as a developer on this project, I've created a Trello board, found here : https://trello.com/b/vVk6w1cj/xstoon-development

    If you like my work and would like to stay updated or would like to report any bugs you find, you can join me and others over at my Discord server!
    [​IMG]

    Patreon for those who would like to support me in my endeavors.
    [​IMG]
     
    #1 Xiexe, Jun 9, 2018
    Last edited: Nov 2, 2018
    BlueLament, Coziest, Apple and 9 others like this.
  2. rabbitything

    rabbitything New Member

    Joined:
    Jun 13, 2018
    Messages:
    4
    Likes Received:
    2
    VRChat:
    rabbitything
    This shader is great!

    being able to actually change the shadow ramp to something other than a basic 2 tone line is wonderful

    and spec maps on a stylized shader?
    holy crap thank you!


    the only issue is i cant get the stencil to work

    i followed your quick tutorial to the key and when i get to the part that says set Stencil Comparison to "Equal"

    all it does is make the object completely disappear from my model even when the other stencil is in front of it which should make it visible


    This is my plane that should reveal the outer cube
    upload_2018-6-13_7-23-14.png


    And this is the outer cube

    upload_2018-6-13_7-26-35.png

    i feel like i'm doing something super wrong, but i'm not changing any setting whatsoever other than what you typed up.




    oh and side note, ive gotten this to work with a custom stencil shader before, but was really excited to do it with this new one :)

    upload_2018-6-13_7-40-24.png
     
    #2 rabbitything, Jun 13, 2018
    Last edited: Jun 13, 2018
  3. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe

    Looking at those screenshots it looks like you typed the Stencil ID in the comparison box on accident in the stenciler material!

    If you just swap that to the above value box it should work!

    I may have typoed in the readme to put the ID in that box, if I did it will be fixed soon, and also in the next update ill be making the stencil options a bit more clear to understand.

    And thank you for the compliment, really appreciate it! I've got some more stuff planned for the shader coming soon™!

    EDIT: I'm dumb. Thats not a number box. Okay, I will look into this, looks like I goofed something.
     
  4. rabbitything

    rabbitything New Member

    Joined:
    Jun 13, 2018
    Messages:
    4
    Likes Received:
    2
    VRChat:
    rabbitything
    thanks for the help, i still have no idea what im doing wrong, as switching the number all over the place and every combo just makes the thing invisible. D:

    I'll just be patient and wait for the next update!
     
  5. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    Yeah, I'm not actually entirely sure what's happening. I verified this was working before releasing, and now it's not. I'm definitely a bit taken a-back. Ah well, I'll figure it out!
     
  6. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    I think I've fixed the issue and will be updating shortly.

    EDIT:
    Link should be updated!
     
    #6 Xiexe, Jun 13, 2018
    Last edited: Jun 13, 2018
    rabbitything likes this.
  7. rabbitything

    rabbitything New Member

    Joined:
    Jun 13, 2018
    Messages:
    4
    Likes Received:
    2
    VRChat:
    rabbitything
    yes wonderful!


    i started actually questioning my ability at comprehension hahah

    thanks friendo, i think i'll switch to your shader as my main one.
    :)
     
    Xiexe likes this.
  8. ɴᴇᴘsʏɴᴇᴘᴛᴜɴᴇ

    Joined:
    Jun 17, 2018
    Messages:
    4
    Likes Received:
    7
    VRChat:
    ɴᴇᴘsʏɴᴇᴘᴛᴜɴᴇ
    10/10 amazing shader :3 (used on all future avatars :p)
     
    Xiexe likes this.
  9. Sakuukuli

    Sakuukuli New Member

    Joined:
    Feb 23, 2018
    Messages:
    5
    Likes Received:
    1
    VRChat:
    Sakuukuli
    Looks amazing, but I wonder what kind of effect such a complex shader is going to have on performance.

    It would also be nice to see screenshots of how the shader is supposed to look in game, like in The Great Pug, Avatar Testing etc. I used a forked shader from Cubed's shader that was supposed to have custom lightramps, but it didn't work in game and in Avatar Testing there was a weird green tint on my avatar.
     
  10. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    Hi! Performance has been heavily tested and has been a huge concern for me from the start, as when releasing something to the public, I obviously don't want to go and release something that is heavy on performance.

    That being said, throughout my development I've continuously benchmarked against Cubed's - the results have always been my shader comes out with a 2-5% speed increase over Cubed's - That's within the margin of error though to say that they're probably about the same.

    You'd be running into performance issues from the amount of people in the world long before the shader would be causing any frame drops, so no worries there! (For reference I was benchmarking with 2000 unity-chans in the scene, each with I think 15ish materials)


    As for Avatar testing's lighting - Thats due to reflections. The reflection probe in Avatar testing is heavily green because of the grass.
    So anything that you turn reflections on with on my shader will get that green tint - otherwise it ignores reflections when doing the lighting model.

    Coming soonish will be a stylized reflections mode that wont actually take into account reflection probes but will add reflected light similar to how BoTW does it, so you'll be able to have pseudo reflections without worrying about probes affecting your coloring.

    As for the ramps, it works in all maps as far as I've seen and tested. The only maps you might look bad in are maps with bad lighting.

    I.E. completely black ambient light and no light probes with realtime lights will make you look black in shadows and lit up in non shadow. This is because my shader is heavily PBR based, and follows that lighting model fairly closely in a lot of aspects, including how ambient light and stuff like that gets calculated.
     
    Sakuukuli likes this.
  11. Sakuukuli

    Sakuukuli New Member

    Joined:
    Feb 23, 2018
    Messages:
    5
    Likes Received:
    1
    VRChat:
    Sakuukuli
    Thanks for the detailed answer and for putting so much work into this, I will definitely try it on all my avatars from now on.
     
    Xiexe likes this.
  12. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    Of course! I honestly just love the idea that people are out there using what I've created, so when someone is curious about things about it, I'm more than happy to answer!

    Thank you for trying it out! It means a lot :D
     
    Sakuukuli likes this.
  13. Wintermute

    Wintermute New Member

    Joined:
    Jan 2, 2018
    Messages:
    2
    Likes Received:
    2
    VRChat:
    Wintermute
    This shader looks absolutely phenomenal. I use it on all my models now and I've been recommending it to all of my friends. Thank you so much for your effort in making this and providing it publicly.
     
    Sakuukuli and Xiexe like this.
  14. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    Thanks for the kind words, really means a lot to me, I'm glad you like the shader!
     
    Mimi and Sakuukuli like this.
  15. Mimi

    Mimi Member

    Joined:
    Nov 18, 2017
    Messages:
    39
    Likes Received:
    24
    the new update is great! :p
     
    Xiexe likes this.
  16. rabbitything

    rabbitything New Member

    Joined:
    Jun 13, 2018
    Messages:
    4
    Likes Received:
    2
    VRChat:
    rabbitything
    Thank you for the new update, fixed that super dark shadows thing in some worlds :)
     
    Xiexe likes this.
  17. Lhun

    Lhun Member

    Joined:
    Jan 21, 2018
    Messages:
    112
    Likes Received:
    49
    VRChat:
    Lhun
    is it true that the latest release of your shader is whitelisted for the upcoming social system?
     
  18. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    It was - they have since removed the whitelist and are using generic fallbacks for all shaders, and will fall back to a "toon" shader if they detect a shader as toon.
     
  19. Mysteryem

    Mysteryem New Member

    Joined:
    Sep 30, 2018
    Messages:
    2
    Likes Received:
    0
    The specular map is a little confusing since to get the brightest specular highlights on part of the mesh, that area of the map should be 50% grey. Both completely white and completely black on the map gives no highlight at all.

    Do you have any plans to reduce the strength of non-glancing reflections for smooth non-metallic reflections? I want to get a reflective plastic look, but it looks too metallic without the effect in my opinion.
    upload_2018-9-30_23-24-29.png
     
  20. Xiexe

    Xiexe Member

    Joined:
    May 1, 2018
    Messages:
    16
    Likes Received:
    29
    VRChat:
    Xiexe
    The specular and the PBR reflection stuff is totally separate from each other - If you could give me a little more info on this I may be able to help a bit better.