Egg file - Multi texturing.

I’ve managed to get my Blender2.63 script to export multi UVs, vertex colours and textures on mixed flat and smoothed faces into an egg file.

However, I stumbled onto a problem. I imagine i’m missing something obvious, but i can find no mention of it in the egg syntax in your source.

If I have 2 or more textures on a given face that are combined in some way, how do I apply a factor to each texture?

For example:
Texture1 uses UVMap1 and applies itself to the diffuse.
Texture2 uses UVMap1 and applies itself to diffuse also.

However, Texture2 is applied at a factor of say 0.25

Currently my exporter applies all the textures at the same factor, as im unable to find a way to change it.

Hopefully i’m missing something trivial.

Sorry, but I’m missing a concrete question or the particular code part that’s not working.

I’ve written my own exporter, but I cant find a way to apply factors to textures when multitexturing

For example how would i set texture one to apply at a factor of 1.0, and texture two to use a factor of 0.25

Blender uses these when multitexturing to apply a weight to how much you mix various textures.

I have looked through the egg syntax and nothing has jumped out at me on how to achieve this.

Now i get it.
But unfortunately I don’t know of anything like that neither.
What you could do is putting the factors into properties assigned to the models. Then, in your application (not the exporter) apply the values found in the properties.

Let me rephrase that.

  • Exporter reads factors and saves them as tags whatever on the models.
  • In your application you read the tags and do appropriate actions (texture stage settings).

The only way that jumps out to me with egg syntax is using the combine-rgb-* {…}

But it would mean putting a few of them together.

I will have a mess, but hopefully im just missing something obvious.

Panda doesn’t provide a “texture factor” like that built-in, so it’s not supported by the egg syntax. You can do it if you write your own shader, but Panda doesn’t know about that, of course.

To make that work, you’ll have to read the texture factor from some external source and apply it yourself.

David

Do either of you know if I could try using the combine scalars instead of setting envtype

For example:
srcColor (r,g,b,a) could be set to (factor1,factor1,etc)
Texture1 now could be modulated by that

srcColor (r,g,b,a) could be set to (factor2,factor2,etc)
Texture2 now could be modulated by that

Then the resulting texture1 and texture2 could be combined in whatever format was set in Blender

I think you will need to use another TextureStage, with a CMInterpolate mode, to blend two different textures with a programmable factor, without using a shader.

But you’re right, it can be done. It’s kind of expensive to have to throw a whole TextureStage at the problem, though (without shaders, you’re typically limited to either 2 or 4 TextureStages on a given node, depending on your graphics card).

David

Thanks for your help.

I’ve settled on exporting meshes and textures as is.
My exporter is now generating CG shader file to mix textures as expected… adding a tag to node so it knows what to load.
Currently just worked out for single point or directional light. Will add the rest as I need them.

Panda really does some work for you loading in the egg, i dont even have to worry about sending uniforms and whatnot as panda is sending the textures and uvs to shader without any coding on my part.

Thanks again.