terrain with texture splatting

I was just saying that if your not using the toon shader then the auto shader system will render your terrain up with both lighting and stencilling just fine, at least in cvs or if your using R74 of the exporter. You indicated in an earlier post that you didn’t think you could get your lighting working, hence I corrected it in case that information was of use to you. If not, then at least you know!

Of course, if toon shading is done via a post-processing filter (As I said, I really don’t know that system, as rdb indicated!) of the auto shader systems output then that would allow you to get stencils, lighting and toon shading all working at the same time. I don’t know if that is the case, though you could certainly write a set of shaders to do it that way if you are feeling brave; there might even be someone who has created such a setup already who will let you copy it.

that would be cool…

Oops, I messed up cartoon shading and cartoon inking here. Cartoon inking is done in a postprocessing filter (and requires the shader generator for the additional render target), and cartoon shading is done by the shader generator alone.

I kinda forgot about this topic.
What should I do now?

shrug Not sure really - that is obviously your call. However, terrain and the subtleties of any particular visualisation are a very small part of a game - I would work on the rest and, later on see where you are at. The release of 1.7.0 (Whenever that is going to happen!) should make things much better for you, and, with more experience, you might get the confidence/experience to solve the problems as they stand anyway. One of the nice things about Panda is it encourages a certain ad-hoc way of doing things - you don’t have to get stuff ‘just right’ before you move on to the next thing.

I came across this issue recently, as well. This post is only in response to the original problem of having only one texture show up.

If you want to deal with it using Panda3D 1.6.2 and the R81 exporter, there is a simple workaround:
Create a new texture using the same stencil image (set up just like the other stencil, except using Neg in the “Map To” properties of the texture.
Move this texture above the others so it looks like this:
InvertedStencil
Texture1
Stencil
Texture2

I haven’t tried any more than 2 textures, so I don’t know if it applies in that case.

Now that Panda3D 1.7 is out…
I tried stenciling with Chicken R88 and loaded it in Panda 1.7 and one of the textures is still white.
I kept Chicken R71 and use it for exporting stencils correctly, just wanted to let you know.

Dam - I shall look into it. This is with the shader generator enabled right? Its impossible to output stenciling that will work with and without the shader generator due to differences in the way the fixed pipeline and it work - the current technique should only work when using the shader generator.

You mean this method?

.setShaderAuto()

Yeah, it doesnt work with and without it.
Just tried R71 and it didnt work as well - I think I overwrote the old files when moving the new chicken files.
Can I have 2 chickens at the same time?

Yes and no - the main file which contains most of the code has a version-unique name, but there are several other files that do not, and so will be overwritten. Now these other files include documentation, which doesn’t matter, but also the configuration screen and some interface stuff. This later stuff doesn’t change that much however, so often you can get away with running an old and new version, conditional on these other files being compatible with both versions. Whilst there have been changes I don’t any of the once since R71 would break compatibility.

I’ll have a look and see what is happening - I know it was working when I last tested it, but that was with a cvs version quite a few months ago. Won’t be able to do this till Thursday at the earliest however - I’m extremely busy today and tomorrow.

@lethe: I found out that using separate UV layers for each of the 3 images solves this with chicken r88

Ah, ok - thanks for the info. Afraid I haven’t had time to look at this - been very busy these last few weeks. Should get some time after the weekend to have a look though.

Ok, I figured out what the cause of this is, and its ‘fixed’ in R91, which is now on sourceforge. I say ‘fixed’ because I actually think this is a Panda bug - basically it uses the ability to save a texture stage, but for some reason if you save the first texture stage it saves a white image, hence the problem. This only happens if the first image is in modulate mode however, so for now I’ve hacked it so that if the second texture stage is a stencil map it sets the first texture stage to replace rather than modulate. If all that confuses you then your not the only one…

Hmm, can you tell me more? I’m not sure what you mean by “save a texture stage”; Panda does have interfaces to write a Texture out to disk, but this has nothing to do with the particular TextureStage it might be bound to; and Panda doesn’t even have a strict sense of the “first” TextureStage.

Of course, it does require that the Texture image in question exists in RAM, but if it doesn’t, I think you’ll get an error instead of a white texture.

But maybe you’re talking about some other meaning of texture stage, and I’m just confused. :slight_smile:

David

I’m talking about the use of saved-result { 1 } in a texture followed by using that texture with LAST_SAVED_RESULT in the combine modes of a later texture.

Instead of me attempting to describe this in more detail it is easier to simply demonstrate it: http://thaines.net/content/panda3d/stencil_issue.zip First open it in pview, then look at the egg file in a text editor - you will see that the only difference is the first texture stages mixing mode. Given that lighting is off and there are no per-vertex colours you would expect them to give the exact same output, and yet they do not.

Ah, you’re right. Thanks for the excellent example, that helped me track it down quite rapidly.

This was indeed a bug in Panda; actually, in the egg loader, which was overlooking the “saved_result” flag and assigning that texture the default TextureStage. I’ve just checked in a fix which will become part of 1.7.1.

Edit: I should point out a minor problem in this egg file, though–you have two textures with the saved_result flag set (the top one has this flag set too, for no apparent reason). This is not supported by DirectX.

David

Ah, thanks. Downloading it now.
I wonder how other exporters are doing, the egg format supports stuff like texture stencils, instancing, LOD, shape keys, collision geometry, nurbs curves, empties but if the exporters have problems with those then a custom file format isn’t that great.

The repeated saved_result flag is quite deliberate - it allows multiple stencil layers to be stacked up, and works fine with the shader generator, which is required if you want lights to affect your stencilled surface anyway. (The file I gave you is actually a hand edit of a more complex test, where there were 3 textures and 2 stencils, to make a surface with 3 mixed textures - on my graphics card which supports only 4 texture stages you need the shader generator anyway to render it, though it fails quite well with the fixed pipeline.) No idea if the shader generator works with Direct X in that situation, but you need the shader generator to do anything serious with stencils anyway, due to the lighting, so I don’t see this as an issue.

I remember it was said that if I’ll apply shader generator, both textures should be lit, but they are not with R91: discourse.panda3d.org/viewtopic.php?t=8928
I kinda forgot about this topic then

I tried with older chicken version and stenciling didn’t work. Probably wasn’t implemented back then.

The archive I posted has the blend file and textures in png. Can anyone maybe try it with different exporter and tell me if it works? I would like to know if this is an exporter issue or Panda limitation.

I have spent too much time on this…