Composite Map Blend Modes Math - not directly Vray related

Dear users,

I write a kind of generic fx-shader that mimics most of the VrayMaterial for use in interactive scenarios.
Currently I code the several blend modes for the 3dsmax standard composite map, and I got all of them except one:

Spotlight Blend.

In the documentation it says:

“Same as Spotlight but also adds ambient illumination to B”.

So Spotlight itself is this:
“like multiply, bit with twice the brightness”
result = 2 * image1 * image2

So the code I tried for spotlight blend is this:
result = 2 * image1 * (image2 + 0.5)

But the result is a bit too bright. It seems not to be as simple. Does anybody have the code for spotlight blend? I trade some other blend modes if somebody wants to know .

Thanks and best regards
Robert

The source of the Composite map is included in the 3ds Max SDK in the samples\materials\composite.cpp file.

Best regards,
Vlado

Thanks, this has saved my life.

Cheers

Robert