Are they static meshes? Perhaps you have to rebuild the lighting?
Yes and I’ve tried to rebuild the lighting multiple times. Using a Lightning Model rather than a World Normal seems much better since the light seems to be hitting from the right angle and cast shadows where they should be. The only thing I need to fix now is the weird artifacts in the shadows(the darker areas within the shadows).
You can see it in the shadow behind the rocks as well as the brushes. Do you know how to fix this ElliotB?
Sorry for the double post. I managed to fix it by using a cel texture that was 50/50 rather than 5/95 or 10/90.
I’m pretty much satisfied with the shader right now. But using textures that have more than 2 bands doesn’t seem to work that well, leaving very thin cels regardless of how thick the cels are in the texture. This limits the flexibility of the shader which makes me want to try and fix the World Normal version since it applies textures with multiple bands much better. I still have problems getting it to read the light properly. It still casts weird shadows like shown here:
No matter how many times I try to rebuild the lighting it stays the same. It looks like it’s a problem with the World Normal itself and not the shader since applying it without any bands shows that the shadows are cast incorrectly. Like shown in one of my previous post with this picture:
This is a very handy thread! I just started porting my old UE3 cel shader to UE4 and this has helped a lot. I’ve done things a bit differently as dotting the SceneColor with WorldNormals didn’t give the effect I was looking for but it’s the same basic approach.
Here’s what I’ve got so far:
Great work guys!
Wow, thanks for sharing! I managed to recreate what you did with good results:) But how did you remove the gradient from the shadows? I get the cels but the shadow is still gradient:
Here’s the cel texture I’m using:
I tried using cel textures with shorter shadows, but it hit a point where it started to show strange artifacts in the shadows and it still hadn’t reached where the gradient appeared.
The shadows seems to be cel shaded too for some reason. Looking at your picture I can see that your shadow looks fine. Here’s how mine looks:
I’ve tried rebuilding the lighting, but it just makes the edges of the cels crisper.
Thanks again for sharing your shader and I hope you can help me with these problems:)
Edit: Discared the last part about the shadows on the ground. It was as a result of me having turned on Cascaded shadow maps. I still need to figure out how to increase the range of the dynamic shadows. Still have the problem with the gradient on the shadows though.
have you tried it with the dynamic day night system yet?..this fixed my lighting issues with the celshader…just search for the d/l of the blueprints in the forums…then lock it to a set time of day if you dont want it to cycle…
Ah ok. I have a hard time finding it, could you send me a link?
Edit: Is this what you’re talking about?
yeah thats it…worked really well for me just using the standard sobel material i got from the forums…particles wont work though unless they are masked due to the sobel post process
just make sure you follow all his directions with it and switch the lighting source to the new sky
Ok. I’m having problems with it though. The in editor looks different than in-game and the shadows is behaving strange too.
Here’s a few screens:
I also made a Youtube video shoving off how strange the shadows are. It’s like there’s a cel shade shadow and a normal shadow at the same time in different places.
Edit: It seems to be a problem with the Day/Night cycle itself since removing the cel shader has the same effect with in-game looking different from the editor. I’ll try to find out what’s going wrong.
Have you set the CelTexture’s filtering to Nearest? Right click on the texture in the content browser and click on Properties Matrix (I think that’s right? I’m not at the computer right now but it’s something like that) and change the filtering to Nearest.
By default it uses the texture group’s filtering setting which usually is either Bi-Linear or Tri-Linear, which means basically means if the texture is sampled between the dark pixel and the light pixel it will blend between them, this causes the gradients. Setting it to Nearest force it to sample the nearest actual pixel of the texture instead. Hope this helps!
Okay, looks like the most recent posts got deleted by the database crash earlier today. I’ll repost what I said earlier then:
What I’m looking for is making it so the shadows become one solid color like in your pictures DevilboxGames, rather than still having the gradient inside them like I do. Here’s some pictures to better explain what I mean:
I don’t want to remove the gradient completely, but turn it down somehow to make the cel/band borders more solid. The new Zelda does something similar, you can still see a small gradient in the shadows.
Ok after looking at the images you posted of your material network again I’ve figured out what the problem is and recreated it:
Then I fixed it:
I didn’t have any of the Emissive, Specular or Sky related stuff in my material and that’s what was causing the problem. Basically you were performing the CelShading, then adding the lighting from Emissive/Specular and Emissive Sky to that, so they weren’t being used as part of the CelShading but instead adding an element of smooth shading to the final composite. Instead you should have been adding them to the calculated lighting value before it samples the Cel texture. Basically you were doing this:
But you should have been doing something like this:
With that the lighting from Emissive/Specular and Emissive Sky will contribute to the Cel Bands instead of adding a gradient to the shading, then if you want a subtle gradient like in the new Zelda you can have full control over it using the Cel Texture. The only issue is that it won’t retain the colour of the Emissive Specular and Emissive Sky, so what you may want to do is hook up a sequence of nodes to extract the Hue & Saturation from them and then reapply it after the CelShading is done.
EDIT: Then again after doing some tests I haven’t noticed much particular effect from the Emissive/Specular and Emissive Sky sections. The engine currently only fakes dynamic emissive lighting with bloom, which is applied after the Cel Shading material is run anyway.
Thanks! This really helped! But how do I extract the Hue & Saturation from the Emissive Specular and Emissive sky? I see that the sky works in your screenshots, have you already made a workaround? Do I need to hook up something to the Depth Buffer to extract the Hue & Saturation? If so I don’t know how to do that:/ Could you help me fix this too?
I really appreciate your help so far:) Thanks again.
Btw: Here’s a screenshot of the results of my shader:
Here’s the cel texture I’m using:
Ah I had just been applying the cel-shading to the character, the sky and the rest of the world were being rendered normally (passing PostProcessInput0 to the emissive out if custom depth isn’t used). I’ve been messing with Hue/Saturation but haven’t got it working yet, here’s a good resource on how to convert RGB to Hue/Saturation/Lightness: Math behind colorspace conversions, RGB-HSL – Niwa It’s now UE4 related, just an easy to follow overview of the maths involved.
Ah, thanks:) I managed to figure out a way to keep both the emissive specular and emissive sky and turn them down. I used my old version of the shader where the emissives is applied after the cel shade. Before they are applied to the cel shade, they are multiplied with a constant1vector with a value of 0.175. I can remove the emissive completely by setting the value to 0, achieving the same results as the previous shader.
Here are a few screenshots:
The sky is a bit dark, but I think that can easily be fixed by making the skydome slightly brighter than normal.
Good to see you worked it out Headstub!
Hi!
I have try to make my Cell Shading bug I don’t know why, this is a fail.
I have a black sky.
http://image…com//2014/29/1405699781-rendu.png
This is like I have no light in my level.
I give you my Material. Someone have the solution?
http://image…com//2014/29/1405699786-shader.png
Thanks a lot
@
The update to 4.3 breaks this cel shade material. I’m still trying to figure out why; I suspect it has to do with the new Ambient Occlusion systems, since the cel shade material as designed ITT relies on Material AO to feed the skybox back in.
Hi!
I’m not sure about that, because I have try with the :
4.3.0
4.2.1
4.1.2
And I have the same problem. I give you my Material, maybe you will see the problem
I will take a look to the AO system.
Thanks for your help RhythmScript!
If you solve the problem don’t hesitate to contact me ^^
Thanks,
This is a little update to said in my game I have this
I have change some differents things like SceneTexture, add some new features, but I have a black sky and the lighting is verry strange .
Thanks for the people who will try to help me.