Home Creators Posts Import Register Favorites Logout

Downloads

Content

Complete User Guide

For XPS 11.8.9 (HLSL ps_3_0 / vs_3_0)

This guide explains everything you need to know to use and customise the shader. It covers the four real-time sliders, all static colour and numeric settings inside the .fx file, and a quick rundown of how the shader achieves its anime / stylised look. If you’re new to editing .fx files or just want to get the best results, read on!

1. What this shader does

Style – Mimics the cel-shaded / toon look of games such as Genshin Impact

Real-time control – Four sliders in XPS (UserParameter 1→4) let you adjust outline thickness, shadow brightness, shadow tint, and lighting softness on the fly.

Static tweaks – Eleven constants in the file let you change shadow colours, toon thresholds, specular strength, rim light sharpness, and more.

2. Real-Time Parameters (XPS Sliders)

These appear as UserParameter1 → UserParameter4 inside XPS. Drag them while the model is loaded to see the changes instantly.

ParameterName in guideWhat it doesRange

(slider)Recommended values

UserParameter1 Outline Thickness - Controls how thick the outline is. 0.0 removes it completely. 1.0 is the default. 2.0 gives a very thick, comic-book style outline.0.0 – 2.00.8 – 1.2 for most models

UserParameter2 Shadow BrightnessBlends between the dark shadow colour and the light shadow colour. 0.0 uses ShadowColorDark, 1.0 uses ShadowColorLight. In between gives a mixture.0.0 – 1.00.3 – 0.7 for natural look

UserParameter3Shadow Tint by Light 3Tints the shadow colour with Light 3 (XPS ambient/fill light). 0.0 keeps the shadow its own colour. 1.0 makes the shadow match Light 3 completely, which is great for coloured ambient lighting.0.0 – 1.00.0 (off) or 0.3 – 0.6 for subtle tint

UserParameter4 Softness / Wrapped Lighting0.0 gives hard, banded cel shading (Genshin style). 0.5 softens the edges. 1.0 gives wrapped, painterly lighting, where even shadowed areas get a bit of light.0.0 – 1.00.0 for sharp toon, 0.4 for soft

3. Static Settings (Edit inside the .fx file)

Open the shader with any text editor (Notepad, VSCode, etc.). These constants are at the top, just after the comment block. Change the numbers, save the file, then reload the shader in XPS.

3.1 Shadow Colours

These set the pure dark and pure light shadow colours. They are blended by UserParameter2.

static const float3 ShadowColorDark = float3(0.35, 0.25, 0.20); // warm brown static const float3 ShadowColorLight = float3(0.95, 0.85, 0.75); // light beige

float3(R, G, B) – values between 0.0 and 1.0.

Example cold dark shadow: float3(0.25, 0.20, 0.35) (purple tint).

Example neutral shadow: float3(0.25, 0.25, 0.25).

3.2 Toon Ramp Thresholds & Hardness

The shader creates three bands of shading: shadow, midtone, and light. These values control where the cuts happen and how sharp they are.

static const float TOON_THRESHOLD_1 = 0.38; // shadow → midtone static const float TOON_THRESHOLD_2 = 0.62; // midtone → light static const float TOON_HARDNESS = 0.02; // sharpness at UserParameter4 = 0

TOON_THRESHOLD_1 – Lower = more of the model is in deep shadow (e.g., 0.25 gives a moody look). Higher = less shadow. Range: 0.20 – 0.50.

TOON_THRESHOLD_2 – Controls how much of the model stays in the bright light band. Higher = more area stays fully lit. Range: 0.50 – 0.80.

TOON_HARDNESS – How sharp the transition between bands is when softness (UserParameter4) is 0.0. 0.01 is nearly pixel-perfect (Genshin style). 0.06 gives a slightly fuzzy edge.

3.3 Specular (Skin Shine)

This is a continuous, smooth specular – no harsh white dot. It mimics the natural shine on skin or glossy materials.

static const float SPEC_POWER = 28.0; // concentration of the shine static const float SPEC_INTENSITY = 0.30; // overall brightness of the shine

SPEC_POWER – 20 gives a broad, soft highlight. 60 is a tighter spot (Genshin). 120 is a tiny, very sharp point.

SPEC_INTENSITY – 0.0 turns it off. 0.3 is a nice subtle glow. 0.8 makes the specular very strong. It is multiplied by Light1Intensity and only appears in the bright areas.

3.4 Rim Light

A soft halo around the edges of the model, illuminated by Light 3. It adds depth and helps the character pop.

hlsl

static const float RimPower = 2.5;

Lower values like 1.5 give a wide, soft rim.

Higher values like 4.0 or 6.0 make the rim very narrow and crisp.

The brightness is partly controlled by Light3Intensity in XPS, but the hard-coded multiplier (0.4) keeps it from being overwhelming.

3.5 Outline Base Thickness

hlsl

static const float OUTLINE_BASE = 0.018;

This is multiplied by UserParameter1. Increase it if you want the overall outline to be fatter even at slider 1.0. Decrease it for a finer base line.

4. Quick Presets (copy-paste into your .fx)

Genshin Impact style

hlsl

static const float3 ShadowColorDark = float3(0.30, 0.22, 0.35); // cold purple shadow static const float3 ShadowColorLight = float3(0.90, 0.85, 0.80); // warm bright static const float TOON_THRESHOLD_1 = 0.35; static const float TOON_THRESHOLD_2 = 0.60; static const float TOON_HARDNESS = 0.01; static const float SPEC_POWER = 60.0; static const float SPEC_INTENSITY = 0.25; static const float RimPower = 2.5; static const float OUTLINE_BASE = 0.018;

Anime style (softer, warm shadow)

hlsl

static const float3 ShadowColorDark = float3(0.40, 0.28, 0.22); // warm brown static const float3 ShadowColorLight = float3(0.95, 0.88, 0.78); // peach static const float TOON_THRESHOLD_1 = 0.40; static const float TOON_THRESHOLD_2 = 0.65; static const float TOON_HARDNESS = 0.05; static const float SPEC_POWER = 20.0; static const float SPEC_INTENSITY = 0.35; static const float RimPower = 2.5; static const float OUTLINE_BASE = 0.018;

5. How the shader works (technical overview)

Vertex Shaders

Two vertex shaders are used:

BasicVS – transforms the model normally, passes world-space normal and position to the pixel shader.

OutlineVS – pushes each vertex outward along its normal by OUTLINE_BASE * UserParameter1. The outline pass is rendered with clockwise (CW) culling so you only see the backfaces, creating the outline shell.

Bone animation is supported (up to 4 bones per vertex). The transformation is built without any if statements, just straight addition of weighted matrices.

Pixel Shader (CellMapPS_Genshin)

Albedo – Textured colour multiplied by vertex colour.

Lighting – XPS provides up to three directional lights.

Lights 1 & 2 contribute diffuse shading using N·L (normal dot light direction).

The ShadowDepth parameters mix between fully lit (anime flat) and physically correct N·L.

Shadow colour – UserParameter2 blends ShadowColorDark and ShadowColorLight. UserParameter3 then mixes that result with Light3Color.

Toon ramp – A wrapped diffuse term is calculated: (N·L + wrap) / (1+wrap), where wrap comes from UserParameter4. This term is then mapped to three fixed bands (shadow, midtone, light) using two smoothstep calls. The result is multiplied by the actual light colour and intensity.

Specular – A Blinn‑Phong highlight is added only in the fully lit band (factor2). It’s continuous, not stepped, so it looks natural.

Rim light – A fresnel‑like edge glow is driven by Light3 colour and intensity.

Everything is clamped to 0.0–1.0 at the end, and the output keeps the original texture alpha.

Outline Pixel Shader (OutlinePS)

It just returns a solid black colour (or whatever you set LineColor to), but discards fragments where the diffuse texture alpha is below 0.2. This prevents outlines on transparent parts like hair strands or ribbons.

6. Tips for best results

Light setup in XPS – Use Light 1 as the main key light, Light 2 as a weaker fill (or turn off), and Light 3 as a rim/fill colour. The shader reads their direction, colour, and intensity.

ShadowDepth sliders – In XPS, set Light1ShadowDepth to 1.0 for realistic N·L falloff, or 0.0 for completely flat anime shading on that light.

Editing .fx safely – Always keep a backup of the original file. After saving changes, right-click the model in XPS and choose Reload Shader.

Material-specific tweaks – If you have a model with separate materials (body, face, hair), you can copy the shader and create slight variations (e.g., softer specular for hair, different shadow colour for clothes).

7. Troubleshooting

No outline appears – Make sure your model’s textures have proper alpha (opaque areas white, transparent areas black). Also check UserParameter1 is not at 0.0.

Shader won’t load / errors – XPS 11.8.9 requires ps_3_0 and vs_3_0. The shader already uses these. If you get a compile error, check that you haven’t accidentally deleted a semicolon or bracket while editing.

Too dark / too bright – Adjust the light intensities in XPS, or tweak TOON_THRESHOLD_1 and TOON_THRESHOLD_2. Raising TOON_THRESHOLD_1 pushes more of the model into the midtone.

Specular looks wrong – SPEC_INTENSITY is often the culprit. Start with 0.2 and slowly increase.

8. Credits & Sharing

You are free to share and modify this shader. If you use it in screenshots or videos, a mention of the “Outline Shader "Colored Shadows" Beta version for XPS” is always appreciated!

Now go make your characters shine – whether you’re chasing the crisp cel shading of Teyvat or the soft warmth of an anime visual novel. Happy rendering!

Files

Comments

No comments found for this post.