Blend Modes: Average?

Hey,

Is there a way to have two textures blended together on a model, to have the average of these two textures showed up? ((tex1+tex2)/2) I didn’t find such a blend mode in the manual.

There is “modulate” (tex1 * tex2, without the 0.5 factor). Modulate makes images darker, since color values are in the range 0…1. A factor of 0.5 would make the texture even darker.

Perhaps you could get the desired effect using two stages:

  • first would be normal modulate ( tex1* tex2 )
  • second would be modulate too, with a constant second color of (0.5,0.5,0.5,0.5).

Didn’t check the code, but something similar to this:

ts2 = TextureStage( 'ts2' )
ts2.setColor( Vec4( 0.5, 0.5, 0.5, 0.5 ) )
ts2.setCombineRgb( TextureStage.CMModulate,
                              TextureStage.CSPrevious,
                              TextureStage.COSrcColor,
                              TextureStage.CSConstant, # <== here is the 0.5
                              TextureStage.COSrcColor )

enn0x

I think you meant Add mode, which would be closer than modulate mode. Add mode computes (t1 + t2), but the result clamps at 1.0 instead of going up to 2.0.

You could add the two textures and then Modulate by 0.5, which would be almost exactly what you asked for, except that I think the intermediate result would clamp at 1.0 before being modulated, so it wouldn’t work for bright textures.

Of course, you could just pre-darken your textures by a factor of 0.5, for instance with image-trans, and then use plain add mode.

But, you could also just use Decal mode, which would blend the two textures according to the alpha value of the second texture. If you apply a uniform alpha value of 0.5 to this texture, whammo, a uniform average.

David

Ouch, sorry, I thought pro-rsoft has been asking for tex1 * tex2. Hmm… should read more careful.

Sorry enn0x, but I did say tex1 * tex2, but I saw I made an error, and changed it to tex1 + tex2. So you were absolutely right.

I think it might be better to choose another another option - CG. I’m gonna try to do that :slight_smile:

Not a problem :slight_smile: