[SOLVED]how to cellshade without shaders? (ideas given)

hi all there.

today i have another question for you.
i guess it involes a little source-code change but i like to make it without. so here’s my problem/question.

i have lights in my scene deactivated so everything is fully lit by default. no i have a model which should be shaded but instead the gouraud shading i like a custom shading map.(to get the typical cell shading effect without shader)
lets stick with a fixed directional light-source for the time beeing.

i figured out 2 ways to do generaly solve this.:
1-create a cubemap with the shading-guardient in it and use the surface
normals to calculate the uv coordinations, simmilar to cube-environment maps.
using the curent TexGenAttrib.MWorldCubeMap for reflection already brings good results but the shadows are wandering around with the camera since it’s a reflection. thats what it looks like atm:

i’m not shure but i think TexGenAttrib.MLightVector could be of use here. can anyone explain how this works in detail and how to use it?(generaly not for my special case =), the docs aren’t very detailed about this MLightVector)

2-use the existing TexGenAttrib.MEyeCubeMap but instead of the camera’s rotation use the rotatoin of a directional light. i havent tested it yet but it should be possible as long as we can set up 2 cameras where 1 actually rendering nothing (just to gereate the reflection map). or will panda recompute the reflection for each camera?

i guess the first solution i had would be the way to go but i like to hear you’r opinions. so anyone who can tell me how to use this mlight vector?

a big thx in advance for you help=)
thomas e

Cel shading usually has two parts: the inking and the painting.

I’m still researching the painting part, but I think I found a way to ink the outlines without shaders:

  1. Invert backface culling
  2. Render as a wireframe with thick black lines
  3. Render again normally (the z-buffer should sort it out)

Try it out on Suzanne, and show me what happens!

i’m planing to let the lines-part away. never looked really good in my eyes. a very easy way is just use a black model with inverted normals (just like your step 1) but just scale the model up a tiny bit. (using the normal values and make a fitting hull would be even better).

if you want to use wireframes, you could just draw a 3d line on every edge which lies between a clipped and a non clipped triangle (you should be able to to get them with the surface normal values and the according points… cries for some c++ code since python is not very suited for such algorithms)

well actually i was just looking for the shading part. so anyone here who knows how to use this MLightVector stuff? maybe our living panda library drwr?
if noone knows i’ll just stick with the worldcubemapping stuff… most end-user propably wont even notice the wandering shadows anyway. or they’ll see it but dont know whats really wrong with it^^

All you need is extreme color banding right? Can’t you reduce the color depth and turn off dithering or something?

hm jeah reducing this would do… but that would be for the shading of the model only. not eveeryting. aside from that… i really like old-scool games…but i dont really want to use a game with 4 bit colordeep… :confused:
bdw… looks like there was another nice one hidden in the manual
TexGenAttrib.MWorldNormal did a perfect job. using a cubemap as texture. you can modulate the whole texturestage to darken your real model =)

ape = loader.loadModel("ape2.egg")
tex = loader.loadCubeMap('cubemap_#.png')
ape.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldNormal)	
ape.setTexture(tex, 1)	

and another nice effect running without shader without any framerate-loss.
shaderless shading … so to say. i’ll post the shnipset in the shnippelsettel corner and concider this problem as solved.

although this is actually solved. but since we talk about toon stuff…
@cyan. you could try to use TexGenAttrib.MEyeCubeMap and set up a cubemap as texture wich is black in the back and white in the front. since the cubemap is rotating with the camera you should be able to tint all normals which are nearly 90° to the camera axis into black (depending on the white/black paint in your cubemap) . performance-friendly, easy, and if you use vertex colors to color your model it even works on very old graficcards (well if you add a normal texture you would need 3 textures in all… but a lots of cars support 4 textures and more)
give it a try =) edges should be came softly into the fiew and disapear if you tune it a little.
everyone thanks for using your brains =)