Advanced Cel Shader Pack

Poor blueprinting on my part? :slight_smile: They’re to do with not finding a minimum number of lights. I’ve fixed it but at some point the change was inadvertently rolled back. They’re nothing to do with not seeing any light output.

Ah! Dumb mistake. It just…wasn’t bright enough.

I think I can use the light responsivement and sun scale multiplier to get everything affected approximately the same by lighting, whether they’re cel or non-cel materials.

Lights that are dynamically spawned into the scene don’t seem to affect cel-shaded characters…is this possible? Important for VFX.

One more thing, though…I still do have that weird question…how is this barrel casting a shadow? = D

Yep, that’s the correct usage of the light responsiveness parameter. You can probably even use it to make candelas or lumens work (as that’s what I was going to change internally).

To get spawned lights, you have two options: 1. find all of the cel shader components (or at least the relevant ones) and invalidate their lighting using the invalidation function (this will cause the list of lights to rebuild over several frames), or start with the lights present but set to zero and increase them as needed.

If these are lights that are normally off and can turn on, do the latter. If they’re something like weapon flashes, do this too. If they’re say car headlights from a newly spawned vehicle or lights attached to a newly spawned enemy, invalidate the lighting instead.

Apologies for the big delay, I’ve been working hard on a lot of stuff.

A new update to the paid Advanced Cel Shader Lighting module coming out shortly. I’ll be frank, I’ve been working on this for so long that I don’t remember what’s changed, so let’s call it a total overhaul plus new demo content. Look for it in the next couple of days.

Mobile shading in the Lite version is due for another look as there have been a couple of issues reported on newer engine versions, so that’s up next.

Looking forward to it!

I’m still having the “objects with multiple materials” not working correctly (the first one is always black), so I’m hoping this fixes it. :slight_smile:

So, objects with multiple materials still don’t seem to work out of the gate…but eh, I have ways around it.

Caution to everyone: you must switch all your sources from unitless to candelas or everything will be way out of whack!

Can I ask what some of the general improvements are in this new update?

That’s a bug, I immediately released a fix but Epic processed the wrong update and I had to re-release it the next day and we’re waiting on them to process that one as well. If you need to fix it in the meantime open the cel shader component and hook the index up to the name pin on the Create Dynamic Material nodes. The issue is simply that the materials are over-writing each other.

The change from unitless to candelas is to stay in line with Epic, unfortunately they still haven’t exposed the light unit to blueprints. I guess I should make up a pull request and get that badge.

I suppose I should list the changes now you’ve jogged my memory:

  • Added LUT shading texture support. Create your own hard/soft/zany lighting gradient. See the demo character for examples.
  • Added support for a fourth light for complete blending coverage.
  • Shading model math updates.
  • Added new demo content

Hi @ , I’m using the free version of your shader, thanks! I noticed there is an update available.

I made some changes to the master material, if I update what would I lose? Just, Master material or also the instances?

Can we know what has changed?

Cheers!

In general if you update you’ll lose all custom changes you’ve made to default asset files.

If you have to update: rename the cel shader folder in your project first and fix the redirectors before inserting the update, then at least you can bring your changes into the new version.

As for what changed, there hasn’t been an update. It might just be the UE version increment. You’re safe to ignore it.

There is a small update coming to the Advanced Cel Shader Lite - version 3.

Featuring a second outline layer (that we’re calling an in-line) and per-object line colouration using a look-up table and the object’s stencil value. Check the last room in the demo level for an example and a brief explanation of how to use it. Coming very soon.

Hello…again. ^^

I have a very dark interior cave environment, and I wanted to assign a different material at run-time, and/or change parameters on a dynamic material. However, it appears that doing either of these kind of kills the cel shading, and while I tried to invalidate lights, I can’t get it working again. Is there any way to achieve this?

You should be able to do that. Can you post or email me screenshots of how you’re doing it? Is your initial setup working OK?

In general you shouldn’t need to invalidates the lights much, although it may help if you’re spawning new lights to then notify anything with a cel-shader component. I’ll have to check it to jog my memory but if I recall correctly it updates the light list frequently. The only thing I’d take note of is that you may want to spawn the lights with no illumination a few seconds early, then turn them on as needed so that there’s no delay in enabling them.

The material side of things is just a material, however you may need to re-initialize the cel shading component for that actor if you’re swapping entire materials, as the reference to the dynamic material will no longer be valid. Just run the method CelShaderComponent->Constructor() after you change out the material. And let me know how you get on with that as I’ve just thought of a possible optimisation: if it doesn’t do it already, consider clearing the Materials array as the first step in the constructor.

Ah, I need to do “Construction” again, you’re right. Thank you! (It does sound like this approach would be very slow for per-frame modifications to the material, though…I was considering doing a raycast to see if the “whole character” was in shadow from the sun and darken the material, for a kind of “hacked shadow receiving”…)

I am having a weird issue where point lights seem to be uniformly illuminating the entire character, regardless of direction of light…(I don’t think this has anything to do with hot-swapping materials, though). Have you run into this before? (See GIF, light responsiveness is pretty high to just illustrate the problem)

See: https://www.dropbox.com/s/7eomw3k57c…Sides.gif?dl=0

Check your material values. I forget the name of it, but one parameter should increase the back-fill effect of a light. Alternately, make sure your normals are all good. It won’t be light-responsiveness, it could possibly be the specular value. It’s phong specular, not UE specular, so it isn’t anything to do with “shininess”.

It’s looking good otherwise though!

Hmm…it doesn’t seem to be specular. I opened up the Sample Project and this effect seems to exist there, too…there’s a brighter side close to the light, but the barrel is uniformly colored red from a nearby red point light. I tried messing with everything but I couldn’t get it to go away. Can you let me know what parameters I could change to eliminate the uniform coloring?

I’ll take a look as there’s an intentional backlight but you should have control over it.

Do you have a directional light present at all in the scene? Have you tried turning down the sun scaling value in the material?

I do, but messing with the sun scaling value (and even deleting the directional light) seemed to have no useful effect.

Any luck finding the appropriate parameters?

Actually, I was wondering if you’d updated the shader from the launcher recently. I just realised that you’ve taken a screenshot of an old asset.

However, I’m also seeing the same thing so I think it’s an unintentional side effect of adding more supported lights. I’ll fix it and upload an update soon, but it’ll be for 4.22 only.

Edit again: I completely forgot what else I added to the shader. Check the Cel Shading Ramp LUT. That’s what’s causing all the extra light. Try importing your own so you can see how it works - it’s effectively a dark-to-light shading gradient.

(I haven’t upgraded because I made some custom modifications! And it was working great minus this one issue. I can update and re-modify if need be, however.)

Modifying the LUT with pure black on the left side does seem to fix the problem if the light intensity is just right, but the problem is that if the light is too bright, the light envelops the entire barrel, including backfaces, no matter what the light responsiveness/other parameters are. I might be able to get around this with clever values, but none of the light should be touching the backface of the barrel no matter how bright it is. See this GIF as I increase the light intensity from 10.0 to 100.0: https://www.dropbox.com/s/qktzezkv5s…rease.gif?dl=0

If I make the LUT mostly black to account for brighter lights not hitting backfaces, then I get this sort of effect for dimmer lights, which is silly: https://www.dropbox.com/s/hv5zqoaagl…ooLow.PNG?dl=0

I feel like the solution here is some kind of clamp in the CelLightingDirectional/PhongLighting function, on the normals, but I don’t know enough about the math in there to do it.

More edit: after some deep diving, it appears that this part of the CelShadeRampSampler is causing the issue: https://www.dropbox.com/s/kwtmkhssst…mpler.PNG?dl=0

The output dot product is being shifted here from a -1 to 1 range to a 0 to 1 range for all values, making nothing “clampable”. I’m gonna bypass that and see what happens…

Edit again: That…worked? I think!