Need Help With Blender Internal NPR

Edit 5/16: I would like to make this a thread for testing ‘soft toon’ style rendering. Any and all ideas welcome. Doesn’t matter what render engine you want to use. Got an idea? Let’s see it!! :eyebrowlift: BTW, can I change the title of a thread in progress?

I need some help setting up a material for Blender Internal renderer. I have become more interested in NPR techniques and was reading this web page:

Mr. Kurzmack describes his attempt to create an RSL material. I know next to nothing about Renderman but decided to try my hand at recreating the look using Cycles nodes. Here is my result:

And here is my simple node setup:

The key to achieving the look he describes seems to involve light dependent shading and view dependent shading. It seems that Cycles has the tools to replicate that look. However, BI could be faster and is supposed to be good for NPR. I’ve just never been good at working with BI. Recreating the light dependent part of this material in Blender Internal is [probably] not the issue I’m having. I don’t understand how to create the ‘specular’ rim component of this material which is based on fresnel facing. For one thing, it is not a true specular in that it follows the camera view, so to speak. It isn’t a compositing or Freestyle technique either, since the ‘rim’ specular catches the ambient scene lighting. See Mr. Kurzmack’s web page for details. I’m not trying to copy him point for point, though. I like what I’ve gotten so far in Cycles, but like I said, BI could be faster assuming it is possible…

Before I bother pursuing this venture further in Blender, I have to ask whether things like ‘half-lambert’ shaders are even possible in Blender outside of OSL, which I consider to be broken at this time due to crashes when rendering in the viewport while adjusting parameters in the materials. Not that I’m at all knowledgible in OSL, but I would need some incentive like this to learn it…

The more I look into papers like this one,

the more I am convinced that this is the art direction I want to take.

Those look like some great results, Charblaze. Care to elaborate on your setup?

As for the bug report on OSL crashing Blender with viewport rendering, isn’t this a known bug? I understand that things can take time to fix…

I just downloaded 2.67. I’ve been running a buildbot version from last week. I’ll try out the new release tonight. :slight_smile:

Thanks for the screenshot!! :smiley: I’ve gotten some work done on my own. I think I figured out the rim specular. I’ve been looking for a node, but it is a setting in the Lambert ramp that gives the outline: Set ‘Input’ to ‘Normal.’ I wasn’t so successful in figuring out the ‘half lambert,’ though, so your screenshot should come in handy. I’ll try to post more results tomorrow. I’ve been working with one finger on the F12 key. There are so many possible combinations it gets confusing. The lack of immediate feedback doesn’t help, and I think that’s been my difficulty with BI all along. But I can’t deny the speed difference compared to Cycles. I will definitely welcome any and all improvements to BI. (I find it helpful watching ‘Salesman Pete’ over and over and over…:spin:)

Charblaze, your node setup inspired me to rethink my approach. I’ve become so used to thinking in terms of ‘shaders’ that I didn’t realise what could be done with ‘color’ in the Blender Render materials. I would imagine that some of the long time users of Blender Render might find the opposite to be true, that thinking in terms of ‘shaders’ and ‘colors’ as distinct functions might be confusing, and resist the transition to Cycles. Both render engines are great in their own ways.

And now on to the good stuff. I saw what you, Charblaze, were doing in making the ‘half lambert,’ so I carefully read the relevant parts of the paper by Valve. I went through quite a few changes to get the node setup in my screenshots. I didn’t make any significant changes to the ‘specular’ component at this time, nor did I add anything like the ‘ambient cube’ that they mentioned. The parts that I added to your setup include the optional squaring of the ‘half lambert’ and a multiplication by 2 of the color ramp output. Valve says that they use the squaring in some games but not ‘Team Fortress 2.’ I suppose the power could be set to one and the color ramp adjusted accordingly. Then again, the ‘ambient cube’ might have an influence on color that I just haven’t seen yet. I’ve got a good base to start from either way.

Blender Render and Cycles nodes seek peaceful coexistence:

Output result of the view independent ‘half lambert’ and ‘diffuse warp function’…

Output of the view dependent ‘specular’ material…

Multiply the ‘warped diffuse half lambert’ by the texture and add in the ‘specular’…

Note: There is no backlighting on this character. I used one sun lamp, no environment, and no AO. The visible detail on the back of the figure is completely due to the material, which would otherwise be black in the shadows if using a standard Lambert or Toon shading.

I’m glad to hear that. I think that Valve’s paper would be pretty easy to follow by coders familiar with Blender’s internal renderer. About all I can do is give my perspective as an artist and program user. I would be pleased to work along with you in this proposal. I’m going to keep experimenting in this thread, and I hope that Charblaze will too.

Here’s some experiments with the Cookie Flexrig. Basically just appending the node group I created in previous Blender files (above) and plugging in the color sockets to the BI material. I used slightly modified lighting setup based on the existing lights on layer 10.

For Mr. Fred here, I essentially disabled the squaring of the ‘half lambert’ just like the method described by Valve for ‘Team Fortress 2.’ The net result is simply an easier to adjust color ramp.

Ms. Alice got the scaled, biased, and squared ‘half lambert.’ The net result I think is simply more compression in the color ramp than necessary from a user’s perspective.

I put together a simple scene with my two characters…


I’ve got a short lip sync test animation in mind based on these characters. I’ve been very slowly going through the Blender Cookie Animation Toolkit. Lot’s of good stuff in that DVD.

Yes, I agree. I’ve still been playing with the node setup. I have been working mostly in GLSL mode for immediate feedback. I would have had something to post today, but after working for some time with a test scene, Blender quit! Grrrr! There’s a chance my work is in a temp file, but it was late, so I quit too.

I had a material node with a diffuse fresnel subtracting another node material with specular rim. (Actually the same material with ‘diffuse’ and ‘specular’ checked alternately.) I liked the look I was getting, but when I added lamps with shadows, the effect disappears. I had reached a happy medium with that issue using two lamps and decided to get an ambient cube into the setup when Blender quit, and I realized I hadn’t saved in a while.

Any suggestions on a good way to set up an ambient cube effect?

Thanks, Charlblaze! I will try it out. I’ve been keeping track of B.E.E.R., and it looks good so far. I’ve also been spending time doing animation lately, so I haven’t taken the time to experiment with shaders much.

I’m looking forward to B.E.E.R. It should prove interesting to experiment with, should the proposal be accepted. In the mean time, however, my main desire is to work on character animation/acting. After that will come character design and rigging. The purpose of exploring Blender Internal has been because I need fast feedback for poses and animations, but I don’t want to sacrifice aesthetics to do so. As nice as Cycles is, I’m frankly tired of it. It is slow and noisy. I no longer care about ‘realism’, whatever that may be. Any project that attempts to be perfectly ‘real’ will ultimately look dated. Without story, style, and artistic expression, it can never be more than just a fancy tech demo of what was capable on a particular piece of software at a particular time.

That said, here’s my latest ‘soft toon’ style modification to the Blender Cookie Flexrig.


Well said indeed. This fact is often overlooked.

Great to see your experiments with the flexrig. It’s looking great. Personally I find the rim light is a little harsh, but I guess that depends on your final composition style.

Wow! Thanks! As CG is just my hobby, I am learning it at my own pace. The Blender Animation Toolkit was one of the best purchases I made (along with Humane Rigging), and the Flexrig is just awesome. I’m still learning new things watching those excellent videos again and again.

I appreciate the constructive criticism and will experiment some more with material settings. It’s a work in progress as always…