custom shader camera initial state[solved]

Hi, I have been studying a bit of custom shaders, using as base the cartoon shader advanced sample; Using the ink shader gave weird results, as the shader was putting ink even in the texture contents, when it should put it only at vertex normals discontinuities. I then realized which putting this at my custom texture shader made the ink shader work like it did in the cartoon shader sample:

tempnode = NodePath(PandaNode("temp node"))

Not considering the setShader(which I know what is), what has just happened? What does the first and last line of code do?

Also, my character consists of several parts which use two separated shaders(texcolor and vertexcolor), which are used if the model part has vertex colors or texture colors. The code above seems to just work when there is only one light shader, how would I go to do what the above code does with two diferrent light shaders, considering the fact which these two shaders will be applied several times each one(because of the several character parts)?

Thanks in advance for your help

So? How can I have two shaders for a camera if setInitialState seems to accept only one shader(onde nodepath)?

Do I need two diferrent cameras, viewing the same scene, to have both vertex shader and texture shader with correct inking effect?

I don´t know what setinitialstate did, but it seems essential to a correct ink effect.

I find it unusual to not get any help for almost a week, but I managed to understand and solve the problem myself:

The first line probably have PandaNode because the third line .getState, which is related to Renderstates, needs a PandaNode to operate. The state of the pandanode contained in tempnode variable gets overwrited everytime I set a custom shader to it, so I do not really need a “tempnode 2”, and that´s why cartoon shader sample uses the same tempnode variable again and again.

Since setinitialstate works with one shader for one camera, I had to make a new camera and a new display area, this new camera renders the same contents of the camera 1, and also follows the movements of camera 1, but has a diferrent shader.

For each camera I did:


where bitmask variable is any number; for a character part, for example, i would then use, based if it has texture colors or vertex colors:


This hides the part from the camera with Bitmask32.bit(0), in other words, this camera, which for example, renders only vtxcolors, wont render this part, which has texture colors. The two camera combined, which render diferrent parts of the same scene, results in the correct, expected result for the ink shader.