[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/3/ - 3DCG


View post   

File: 295 KB, 1145x1441, 133547354357.jpg [View same] [iqdb] [saucenao] [google]
783801 No.783801 [Reply] [Original]

in blender how would one go about creating a botw-like cell shader that actually dynamically reacts to environment lighting and other light sources? I'm referring to hue since no matter if using colored spotlights or hdri skydome's, the only information the models show is just the basic light without any hues. Tested with 4-5 different botw-like shaders and a few other toon shaders.

I'm sorry if the question is kinda contradictory to the toon shader in general I don't have much experience with it.
Pic below is unity

>> No.783803

>>783801
You need to get the lighting data somehow. In case of Unity, you have ShadeSH9(worldSpaceNormal) to get ambient and light probe data:
https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html
https://docs.unity3d.com/ScriptReference/Renderer-useLightProbes.html
Returns a float3. This is probably how Unity's standard shaders do it, too.
Not sure how I would do it in Blender though. You could implement it in the real-time way and then just overlay the raytraced color on top of it. Dunno.

>> No.783821

>>783803
hm yeah I've tried a lot of combinations but it just doesn't inject hue.
A few toon shaders do react to various colored light etc but the models then look too "3d rendered" instead of this particular style of flat, which makes the whole cell shader thing kinda obsolete.

Not sure, maybe they need to update the basic toon shader or someone created a custom one which works better, or maybe I just don't get it. Yeah Unity does it well pretty muchhttps://twitter.com/xdavidleon/status/885856980799303680

>> No.783822
File: 72 KB, 973x764, Capture.jpg [View same] [iqdb] [saucenao] [google]
783822

>>783821
You could use the toon shader's output as diffuse input for a raytraced shader. Have you tried that? pic related
This graph is unoptimized as fuck though. I don't use Blender, and couldn't find a built-in toon shader, so I had to go with two BSDFs to make it ASAP.

>> No.783856
File: 931 KB, 592x324, Icantintoshaders.webm [View same] [iqdb] [saucenao] [google]
783856

>>783801
I've been working on something like this for a while but couldn't figure it out how to make it not look like crap. Getting the hard cell shaded shadows are a pain in the ass if you're using a base texture for colour (just looks weird on the test spheres in the webm). I've thought about adding a second transparent mesh for catching light only and masking it over the base mesh but I gave up.

I feel your pain bro, it seems like it should be easy to do but its not...

>> No.783866
File: 32 KB, 499x499, duckduckpoo.jpg [View same] [iqdb] [saucenao] [google]
783866

Unfortunately you will likely have to write your own HLSL/GLSL shader to get the results you want. I wouldn't know much about utilizing Blenders nodes, but in UE4 the materials and toon shaders in-engine that people make are not adequate. The limitations are by the amount of outputs the software allows, and that means you will need to add connections from the actual engine/renderer code to feed data to custom nodes. Writing my own HLSL shaders was a challenge as coding is secondary to me but not too hard once you understand the fundamentals, I recommend Ben Cloward. The results look good and have minimal latency in-engine. I expect with Blender you will need to create your own custom scripts for something of professional quality.

>> No.784135
File: 123 KB, 1600x569, f07e7f3a0488bbc43ca63a12d2c9f172.jpg [View same] [iqdb] [saucenao] [google]
784135

>>783822
I see, but it won't react to dynamic ambient light that you switch in the scene/viewport right?

>>783856
I know dude, base textures in general need to have as little information/flat as possible for such shaders to work and a few scene/world configurations, but they usually only mix value and hue into a singular neutral light.
The example below >>783801 would be optimal if it were blender. The guy replicating GG shaders is also pretty close in doing those hue toon shaders but they are kinda specific and miss the Botw aesthetic

>> No.784165

>>784135
>I see, but it won't react to dynamic ambient light that you switch in the scene/viewport right?
You can tweak the shadows and lights' colors specifically. It's simple color modulation- you just have to offset/overlay on the hue. You can also have it find the average of the environment HDRI if you want it to change automatically.
Not really sure what you want at this point though. Do you want it like in your GG pic? Or do you just want colored lights to affect your shader?

>> No.784191
File: 1.63 MB, 627x523, cantintolighting.webm [View same] [iqdb] [saucenao] [google]
784191

>>784135
I'm sure if there is a huge demand for a BotW style shader, some Blender wizard will figure out how to do it properly. As for values being mixed into a singular light, this is where every single toon shader I've seen fall apart. Its all the same garbage with standard ColourRamps...

>> No.784503

here's how to do it in unity, just find someone to translate it to blender
https://connect.unity.com/p/zelda-inspired-toon-shading-in-shadergraph

>> No.784506

>>784191
64000 colors +256 colors shadow.

>> No.784585

>>784191
hm.. I'll try to post a screenshot when I'm back on pc. Your results seem a bit weird, how does yours look when there is no hue at all and with either a single point light or sun?

>> No.784591
File: 1.54 MB, 1129x1022, 0_frPAo8KqZ4ezUZz4.png [View same] [iqdb] [saucenao] [google]
784591

>>784165
>Do you want it like in your GG pic? Or do you just want colored lights to affect your shader?
I think I'm trying to squeeze a bit of both at this point, since from the ones I have one looks good but negates color and the other allows color&ambient but misses the style (dozens of micro adjustments)

Would it help if I link you the base shader? I've created a custom one that kinda does it but eventually breaks after further experimentation


>>784503
Yeah I'm interested in is specular highlights, I've read the section (thanks!) but desu it goes a bit beyond me to implement it effectively into blender.. If anyone has any ideas on that topic as well it would be much appreciated

>> No.784670
File: 738 KB, 1671x926, lightsetup.png [View same] [iqdb] [saucenao] [google]
784670

>>784585
I was going to do an elaborate breakdown and explain everything going on but I've decided to try a new method before going down this rabbit hole again. The TLDR is the current setup crushes the lights colours down using ramps and does some mixing over top of the atlas texture. Problem is that light outside of its colour range (stuff too far outside of pure RGB) get blurred lines where the light falls off. See the last example of tweaks being needed to clean up the blurred shadow from mixing ambient + spot lights. This method does work but it needs values manually adjusted to match the scene lighting and that kinda defeats the entire purpose of doing this (hence the reason the examples looks off with a changing background).
I'm currently looking into masking lit areas using a separated HSV with the value being cranked down for hard lines. I'll write an in-depth autismo level breakdown if its worth sharing.

>> No.784768

>>784670
let me know if this helps didn't have time to try it properly
https://www.reddit.com/r/blender/comments/bwvj8f/eevee_cel_shader_help_needed/
https://www.reddit.com/r/blenderhelp/comments/ftid73/make_toon_shader_get_affected_by_colored_lights/

the 2nd one is somewhat close to Op's request but the model is really basic

>> No.785114
File: 442 KB, 1920x1080, mix toon node shade.jpg [View same] [iqdb] [saucenao] [google]
785114

>>783801
create a toon mat as a light/shade ref. use it to expose a lit and shaded version of your material using a mix node. setting the mats to shadeless will get rid ambient black getting in the way but if you leave your lit mat alone you can preserve the specular and even add additional mix node branches for further color grades!

>> No.785185
File: 250 KB, 783x877, specshader.png [View same] [iqdb] [saucenao] [google]
785185

>>784768
Unfortunately these have the same issue where a base colour has to be used for the lighting. If you were carful on how you designed your model and used a different mat for every colour it would work but using a texture would make things so much better. A good takeaway from this is that they seem to be on the right track of using HSV so it kinda validates what I'm trying to do isn't a complete waste of time.

>>784591
I took a break from coloured lighting to look into this and it looks like they're using a spec and normal map on top of their cell shader. I can guarantee this can be slapped over the spaghetti nodes I'm working on for the complete effect.

>> No.785195

>>783801
I've worked on this problem before. The solution is not hard.
1. shade using a toon shader for the primary light
2. shade using additive pbr shader for secondary lights
3. post-process for scene tone

Unfortunately, I'm not sure blender is powerful enough to handle something like that, but maybe. You could define the primary light as directional light right in the shader graph and use eevee's shader2rgb to do your other mixing, maybe.

>> No.785359
File: 441 KB, 1188x641, 13574574656578.png [View same] [iqdb] [saucenao] [google]
785359

I'm a noob at this, how do I properly connect the texture of my model (if possible also the shader attached to it but it might be redundant) to the node shader structure on the right?

I've tried a few approaches but it just fully colors the model like in the example above

>> No.785385
File: 243 KB, 440x453, 133563565536.gif [View same] [iqdb] [saucenao] [google]
785385

>>785185
>I took a break from coloured lighting to look into this and it looks like they're using a spec and normal map on top of their cell shader.
pardon my ignorance friend but is there no simpler approach to this like in other softwares; turn specular on/off? I enjoy blender but sometimes it can seem too deep especially for people who'd like to get into it..

>> No.785394

>>783801
Why are people here so obsessed with the look of this ugly ass game? You trying to emulate that for your coomer animations?

>> No.785420

>>785385
of course you can turn specular off, just set the specular value to 0. is that so unintuitive?

>> No.785427
File: 139 KB, 1208x604, botwspecpass.png [View same] [iqdb] [saucenao] [google]
785427

>>785385
Spec can be turned on and off like >>785420 said with a simple slider but BotW uses spec way where its integrated into the shader a bit further down the material pipeline. The TLDR is that the shinny shapes (like the zig-zag shine in his hair) are controlled with a mask/spec texture and a normal map after all the other shading is done.

>> No.785600

>>785394
yikes

>> No.785604
File: 412 KB, 960x960, stfu-zoomer.png [View same] [iqdb] [saucenao] [google]
785604

>>785600
spotted the zoomer shitstain.

>> No.785606

>>785427
>but BotW uses spec way where its integrated into the shader a bit further down the material pipeline
Yeah this one. I remember seeing a Fire Emblem model which had it done beautifully.

Is this yours btw? Mind showing how it looks on a model

>> No.785608

>>785604
>imagine being butthurt in a random 3d thread
try /poop faglet

>> No.785731
File: 418 KB, 1035x674, shinenrm.png [View same] [iqdb] [saucenao] [google]
785731

>>785606
Nope, not mine. These are textures taken from BotW. I figured if my end goal is to make something that resembles their overall aesthetic, I might as well take it apart to see how they do it and build off from there. It looks really rough on the model at the moment as I'm still figuring out how to integrate it properly after all the other things going on.
Maybe one day ill make my own model as a showpiece but for now, ugly balls and ripped models are the way to go.

>> No.786726

>>783801
Were can I find that ground Unity texture? :p
I've tried googling but couldn't find anything.. :c

>> No.786867
File: 372 KB, 612x629, shadow v1.png [View same] [iqdb] [saucenao] [google]
786867

>>783801

>> No.788844
File: 96 KB, 1385x614, Capture.png [View same] [iqdb] [saucenao] [google]
788844

>>785359
The easiest way would be to add a mix node near the end by the material output that combines the texture and the reset of the node group.

>> No.788863

Not OP, but basically nobodies managed to replicate it well is the impression I'm getting.

>> No.790453
File: 1.35 MB, 521x456, linklight.webm [View same] [iqdb] [saucenao] [google]
790453

>>788863
As of now, there is nothing good enough to fit OPs description without some kind of ugly flaw. I'm getting close but materials/math are far outside of my area of specialty. This looks to be the best this thread has to offer so far.

>> No.790605
File: 227 KB, 458x357, 59d80c8e8e4a2b7d6b0f20411e882f96.png [View same] [iqdb] [saucenao] [google]
790605

>>790453
is it one of those things only Nintendo can do/have access to or very hard to replicate but absolutely possible

>> No.790629

>>790605
Its possible to do for sure but hard to replicate because of the nature of it being achieved. The effect made in >>790453 is doing material trickery in EEVEE (one of the renderers included in Blender) while the one Nintendo have access to is probably a hard coded GLSL solution. There are other rendering environments for Blender (like BEER) that support writing shader code but making a solution with nodes that run natively without plugins or building your own version would be nice. There are tons of examples of people making their own GLSL shaders that pull off the BotW look really well but the convenience of it being in Blender's "artist friendly" node setup is appealing.

>> No.790696

>>783801
Forget
BOTW looks terrible anyway

>> No.790964

>>790696
shii I does it's too warm and yellow orangey

>> No.791183

>>790964
hmmm

>> No.791196

>>785394
Agreed, the game looks like actual garbage shit stain, but i suppose it was made that way on purpose for low iq degenerate coomers

>> No.791406

>>791196
yes

>> No.791502

>>785394
I think people might be glossing over that because they think the game is fun.

>>783801
It'd be easier to make a better toon shader, why do you want this one so badly? Does it HAVE to be this one, OP?

>> No.791533

>>785394
I won't deny the look of the game's character models but they had to be decent because the environments are fuck-ugly.