Guilty Gear Xrd shader test

Just posting a shader based on Guilty Gear Xrd. This is my first Unity shader and I haven’t cleaned up the code at all. The shader was fairly easy to create. The links at the footer cover it in more detail. Basicly you just check if the surface normal is facing the light. If it is, use the light color (main texture) otherwise use the shadow color (main texture * tint texture). The outline is just a basic expanded mesh with inverted normals.The vertex colors of the outline mesh are a darker version of the character e.g coat = dark orange. The most important thing is probably getting the normals right. In this case I just used Blender and transferred the normals from simplified meshes. It handles inner lines using a special layout as mentioned in the documents. Each character also has its own directional light source. This light source is animated during special attacks. One interesting thing is that the specular area can be light or dark depending on the specular size texture channel. I also added the vertex color to make areas darker (adjusts the light normal threshold / ambient occlusion). This is required for things like folds in clothing or muscles as the normals have been simplified (smoother surfaces). Blender has an option to make a meshes vertex colors dirty e.g blacken the areas between gaps. I found manually painting the vertex colors had better results. I still need to change the outline thickness using another vertex color channel. This is required for closeups of the face or for spikey hair. It’s easy to add but I’d need to manually paint the vertex colors. The background in this example is just the normal Unity toon shader (works well with textures). I added an antialias to the camera because the edges between the light and dark areas are rough. The animations are also set to around 12 fps to have more of a hand drawn feeling. I also wasn’t able to import scaling for the animations.

Because I don’t support line thickness in the vertex colors yet I just created a material with zero line thickness for any areas with issues e.g inner coat or face. To simplify the normals I found it easier to just create a duplicate of the mesh and use the smooth sculpting tool. I only added ambient occlusion vertex colors to the pants (material folds). The package contains a test scene with just the characters body (no weapon or head). If this has to be taken down due to copyright issues it should be easy enough to find the model elsewhere (but it will need custom normals and vertex colors).

It might also be possible to remove some textures and just use a pallet index in the vertex color. Ideally, I’d like to use a another character as an example but I don’t really have the time for it.

2901765–213646–Guilty Gear Xrd shader test.unitypackage (1.49 MB)
2901765–213647–GearXStage.shader (10 KB)

20 Likes

Wow how anyone comment on this beauty/sexy shader, congratulations High_noon. Please send me your email, sometimes i need a special shader and you ll be the first option to give me a budget.

Thanks r3ndesigner, I don’t normally give out my email but you can send me a private message on this forum and it will send a notification to my email.

I recently had a question about create a new character / textures using this shading style. My main goal with this shader was to get a Guilty Gear character shaded in Unity. The following comments are based on the May character.

Notes:

  • UV coords are mainly important for vertex colors e.g space between them isn’t used. The exceptions to this are the detail textures (e.g logo image), inner lines and shadow map texture.
  • The shadow map texture is optional (can be replaced with vertex colors)
  • The Color texture is used for the base color and is multiplied by the SSS texture to get dark areas.
  • The combined texture uses the following color channels: Green: shadow map, Red: specular intensity, Blue: specular size, Alpha: interior lines.
  • The vertex color channels are used for outline thickness and shadows
  • Interior lines use a special UV layout for smooth edges

In the example below I changed the base color to red and kept the SSS texture the same. You could just use a shadow color texture but then you would need to update both.

An important point is that areas tend to share the same settings e.g all verts in the pants have the same base color, SSS color, base shadow, specular intensity and specular size. So it should be ok to just replace it with one material, ignore the UV (could all be set to 0,0) and don’t use any textures. If any of the values differ then it’s a new material e.g cloth, shiny cloth.

Ideally, you would want to use the same shader in your model editor. For the following steps I’ll assume I don’t have the shader setup in Blender.

So, to setup a new character in Blender I would try the following.

  • Create the model and simplify the normals e.g face, cloth.
  • Assign a material to each color group e.g orange cloth, skin.
  • Paint the vertex colors for shadows and line thickness (would probably use two grey scale meshes then merge them into color channels)
  • Any inner lines would just be setup using geometry
  • Ignore UV channels (all set to 0,0). Or UV channels could be used to store other data e.g U channel => line thickness?

Then in unity

  • Use a new toon shader per material. Each material has a base color, SSS color, base shadow strength, specular intensity and specular size.

Extra
After the character is set up the materials could be merged e.g use a vertex color channel for the material index and a small data lookup image e.g 64x8 texture. Could render character in one drawcall.

Final notes

  • Don’t need any textures (should run fast on mobile)
  • Easy to setup (no UVs, can modify settings in game)
  • Can create color themes / pallets
  • Can still use detail textures / shadow textures if required (could add UV coords just for areas that require detail textures)
  • I haven’t checked how the other Xrd characters are handled, if they required gradients then this method probably wouldn’t work.
  • Could create a script to automatically convert Xrd models to this new shader format.
1 Like

Great idea.

Just had an odd case where someone was selling this shader in the asset store for $30. They basically just deleted some of the commented out code.

I’m not really familiar with licences so I thought I’d just give some examples.

The following are ok:

  • Selling a game using the shader (but I suggest you improve it first).
  • Selling a model asset that uses the shader (with the focus being on the model).
  • Selling a shader library e.g. different toon shaders. But mention that this shader is free and can be downloaded from here.

I shouldn’t have to say it but I don’t want anyone selling the shader like in the link above. I mainly don’t want anyone getting ripped off by paying for a shader they can get for free.

To be honest this shader is fairly basic (it was my first Unity shader and I made it over a weekend). It could also use performance improvements and it has some bugs. If someone wants to sell a Guilty Gear shader it’s easy enough to make from scratch (I recommend using a vertex/fragment shader and fixing the specular / dark areas). Personally I think it should be free as the Guilty Gear team was cool enough to give a detailed explanation of the shading methods.

6 Likes

really cool shader big thx for it, i have a question with what tool can i create the sss Texture and the ILM texture from the orginal Texture?

The sss texture is fairly easy to make. In gimp you can just add a layer over the base layer and set it to multiply. Generally red / pink colors are used for skin and purple / blue colors for cloth and metal. It might be easier to just paint the colors you want and modify the shader to not use the multiply for the dark areas.
For the ILM texture it would probably be easier to create a shader for your modelling program. I was testing it in Blender a while back.

As Blender doesn’t seem to paint color channels I’d probably split it into a black and white texture per channel . Then add a script to combine them on export. I’ve also found it difficult to paint the vertex colors so I’d probably just use a texture and transfer the data to the vertex colors on export as well.

Overall I find the process a bit involved for making new characters. A lot of the processes are setup so the characters look good on close ups. I thought I’d try a similar process with a low res character and avoid close ups. This means I can use a standard uv layout instead of the complex inner lines setup. I also don’t need to modify the normals because it’s already low res. The ambient occlusion is used to give detail.

In the following example I used a 993 verts, 1,179 tris character and the texture size is 128x256. The middle back character is using a per-vertex lighting shader from Cg Programming/Unity/Specular Highlights - Wikibooks, open books for an open world. The right back character is using a phong shader from Cg Programming/Unity/Smooth Specular Highlights - Wikibooks, open books for an open world.
The front left character is using the default shader. The front middle character is using a modified version of the phong shader with a ambient occlusion texture. The front right character is using a modified version of the phong shader with some toon updates.

The colors aren’t correct (just darkens the light color instead of mixing it). For testing I’ve just taking the original image to generate four new images. The base color, a specular map, an ambient occlusion map and a temp texture for the dark outlines.

1 Like

Thx for your answer i will looking with gimp,blender can i at the moment not use for the playermodel at the moment ( blender destroy on import my facerig (bones) ) so i will wait on a update of my 3d modeler.But the shader looks so cool very big thx for it and that it free.

is it possibel to turn the lightning textures and settings off in the shader? i have a model with many weapons and armors but for all create a sss and a ilm texture is very mutch so here 2 screens of it and a problem for me.

Here look it cool and right :

but on this look it scray, i use on the material no sss or ilm texture for testing.

1 Like

Awesome character, it kind of reminds me of kingdom hearts art style. This shader doesn’t really work well with multiple light sources. For this type of shading with detailed textures I’d recommend trying the shaders included with Unity-chan Unity Asset Store - The Best Assets for Game Making. I found that I had to darken the color ramps in the Unity-chan example to get more noticeable light / dark areas.

1 Like

thx for it i have buy this char from here : Unity Asset Store - The Best Assets for Game Making , i have test the Unity - Chan shader but i think your shader looks better as the unity chan shader.Your Shader looks more cartoon as the unity - Chan shader,here a other test with the unity chan shader :


give it a chance that you can bring the multiple light source to your shader? Sry i am not god on shader prog.

I just tried a modified version of the low res toon shader. It might work better for textured characters than the Guilty Gear Shader. It should be easier to add support for multiple light sources (I’ll probably update it tomorrow).

The character on the left doesn’t use a SSS texture (affects shadow color) and it doesn’t use a AO texture (affects shadow area e.g. wool material, less shadows on face, more shadows on pants). The right character uses SSS and AO textures.

This shader doesn’t include an outline. I prefer to add the mesh in blender now as shown below

The main benefit is that it’s easy to remove unwanted lines e.g. eyes, mouth, nose. The outline mesh also uses the same UV’s so I just use a darker texture for the outline color.

I also like to do the following:
Avoid unconnected edges in meshes e.g. a cube with flat faces looks bad.
Turn off receives shadows on the meshes.
I’ve found it looks a lot better with a SSS and AO texture.
Because this is a phong shader I’d try to avoid too many lights (once multiple lights are supported).
The post processing stack / antialiasing helps remove the rough pixel edges.

3177319–242184–ToonB.shader (4.66 KB)

2 Likes

Thx for it i have test it out it looks really good the ToonB.shader i will question a friend how he can create the SSS texture and Ao Texture later.l will post a a Picture then with update.

I was just trying multiple lights but it looks like it’s more difficult than I thought. Sorry, but I don’t think I’ll be able to add the feature. I also forgot to turn on motion blur and bloom in the post processing settings on the video. It looks much better with them enabled.

The SSS texture is fairly easy. I just use a pinkish color for skin, light purple/grey for white areas, blueish for hair and the rest is mainly purple as shown in the middle image below.

For the AO texture I just used an existing height map and lightened the face area (right image). A greyscale version of a normal map should also be ok. You might be able to get away with just using a grayscale color version of the diffuse texture.

Handling multiple lights is something I’ve been giving a lot of thought to for my own toon shader pipeline. I’m not sure how compatible multiple coloured lights would be with this type of character shader. The lights could be combined before selecting the dark/light textures but then there is no colour influence from the light. Using one main light for the texture selection and then adding extra lights after would give the colour influence for the extra lights, but will probably look wrong in places where the dark texture is.

In the below screenshot, the lighting on the characters and the lighting on the background seems to be separated (and reversed!). Extra light influence on the characters seems to mainly be done with bloom on bright fx. I think gradient toon shaders might be more amenable to multiple lights, perhaps giving something similar to the background elements of GGX. The green woodwork shows the type of effect I’d expect from multiple lights. The different type of barrel in the lower right kinda suggests there’s a flat shader in play too.

Guilty Gear XRD Image

I’m leaning towards having an indexed colour ramp pallet and aiming for a middle ground where the ramp could be 2 colours on one index or a gradient on another to support multiple styles. This would also allow somewhat automated conversion of models to a common colour pallet and changing of styles by changing the pallet.

If anyone wants me to consider their requirements as I work on my pipeline (which I plan to release on the asset store in a few months) feel free to PM me.

2 Likes

Thanks for the shader and inspiration, High_Noon!

Based on that, and the GDC lecture, I rebuilt the shader to better work with my project. I used the sample Guilty Gear model High_Noon posted, and the Unity Courtyard for testing:

It works with multiple lights, supports both forward and deferred (so you can use things like screen space reflections), and has individual controls for shadows, highlights, and light color contribution to albedo. You can also push the highlight value past 1, so you can get that glow on bright parts.

Still needs a lot of work to clean up stuff, and it doesn’t support outlines. And I still do need to try it with different types of meshes.

3 Likes

Okay, tested the shader with the free Unity-chan mesh:


Seems to work reasonably well. Some of the lighting in certain angles looks weird since there wasn’t any vertex normals adjustment done to this mesh. There wasn’t any separate SSS map used either, just the albedo. Also is missing the separate map for internal lines. And outlines, of course.

2 Likes

Thx for it i will test it out next week when iam back at home.So i have see in a other game it call aragami can see here :
https://www.youtube.com/watch?v=1LIyXJ-c1x0
is that a cellshader?

I found this thread to the aragmi shader but it will not work for me with unity 2017. : Game Platforms recent news | Game Developer

Thanks High_noon, I thought it would be impossible to implement this based on Motomura’s GDC talk.