I think this is how blend mapping works correctly, and you can use detail mapping dot3 mapping and alpha mapping all at once on a model.
Dont forget the attached media, sorry i needed to resample the images because it was a big file, but surely you can try your own images as well. With more clear images the effect is more visible.
Above cube is ordinary textured
below cube is blend mapped
so you can see how they react to ambient light.
Detail Map, Normal Map, Color Map and Alpha Map
Unfortunately this version has to change the final diffuse color which means it wont be same as a non-blend mapped object.
Rem ***** Main Source File *****
AutoCam Off
Sync On
n = 1
c = 2
a = 3
d = 4
Load Image "n.jpg", n
Load Image "c.jpg", c
Load Image "a.jpg", a
Load Image "d.jpg", d
Make Object Box 1, 256, 256, 256
blendMap(1, n, c, a, d)
Make Object Box 2, 256, 256, 256
Position Object 2, 0, 256, 0
Texture Object 2, c
Scale Object Texture 2, 4, 4
` make new light
set ambient light 20
`Color ambient light rgb(200, 0, 0)
Set Normalization On
make object sphere 10,-10
set object light 10, 0
make light 1
set light range 1, 512
Do
GOSUB movelight
ax# = WrapValue(ax# + mouseMoveY())
ay# = WrapValue(ay# + mouseMoveX())
Rotate Camera ax#, ay#, 0.0
If MouseClick()=1 Then Move Camera 10
If MouseClick()=2 Then Move Camera -10
Sync
Loop
movelight:
sunDist# = 412
sunAngle# = wrapvalue(sunAngle#+0.1) `replace with timer value
gameSunX# = sin(sunAngle#)*SunDist# + cos(sunAngle#)*SunDist#
gameSunY# = sin(sunAngle#)*SunDist# - cos(sunAngle#)*SunDist#
gameSunZ# = 0.0
set directional light 1, -gameSunX#, -gameSunY#, -gameSunZ#
position object 10, gameSunX#, gameSunY#, gameSunZ#
return
Function blendMap(o As Integer, n As Integer, c As Integer, a As Integer, d As Integer)
Set Object Diffuse o, Rgb(128,128,128)
Set Object Emissive o, Rgb(128,128,128)
Set Object Specular o, Rgb(128,128,128)
Set Object Ambience o, Rgb(128,128,128)
Texture Object o, 1, d
Scale Object Texture o, 1, 50, 50
Set Detail Mapping On o, d
Set Blend Mapping On o, 2, n, 3, 24
Set Blend Mapping On o, 3, c, 3, 4
Set Blend Mapping On o, 4, a, 3, 5
Set Alpha Mapping On o, 50
Scale Object Texture o, 0, 4, 4
EndFunction
Normal Map, Color Map and Alpha Map
This version has the exact same diffuse color as a non-blend mapped object. And Adds alpha mapping on the object as an extra.Just change the Function with following.
Function blendMap(o As Integer, n As Integer, c As Integer, a As Integer, d As Integer)
Set Object Diffuse o, Rgb(128,128,128)
Set Object Emissive o, Rgb(128,128,128)
Set Object Specular o, Rgb(128,128,128)
Set Object Ambience o, Rgb(128,128,128)
`Texture Object o, 1, d
`Scale Object Texture o, 1, 50, 50
`Set Detail Mapping On o, d
Set Blend Mapping On o, 1, n, 3, 24
Set Blend Mapping On o, 2, c, 3, 4
Set Blend Mapping On o, 3, a, 3, 5
Set Alpha Mapping On o, 50
Scale Object Texture o, 0, 4, 4
EndFunction
Normal Map and Color Map
This version has the exact same diffuse color as a non-blend mapped object. Just change the Function with following.
Function blendMap(o As Integer, n As Integer, c As Integer, a As Integer, d As Integer)
Set Object Diffuse o, Rgb(128,128,128)
Set Object Emissive o, Rgb(128,128,128)
Set Object Specular o, Rgb(128,128,128)
Set Object Ambience o, Rgb(128,128,128)
`Texture Object o, 1, d
`Scale Object Texture o, 1, 50, 50
`Set Detail Mapping On o, d
Set Blend Mapping On o, 1, n, 3, 24
Set Blend Mapping On o, 2, c, 3, 4
`Set Blend Mapping On o, 3, a, 3, 5
`Set Alpha Mapping On o, 50
Scale Object Texture o, 0, 4, 4
EndFunction
Too Sexy