I got some shader support here, so had a look.
Your program is valid but insufficient for this kind of effect.
You need to set the ambient light in the shader from pitch black to something slightly brighter. This is required by your normal mapping algorithm to see any texture on your objects.
You also need to specify the number of lights, and their properties. The code I have posted will demonstrate something similar to what Dark Shader has done to make things work. Use my function in your project and expand on it.
rem Initialise
sync on
sync rate 0
rem Load model and shader effect
load object "cube.dbo",1
autocam off
load effect "Normal Mapping.dbs",1,1
set object effect 1,1
x# = 3000
y# = 5000
z# = -1000
range# = 8000
red = 120
green = 100
blue = 90
` -------------------------
` Set the ambienct light
null = Make Vector4(1)
Set Vector4 1, 0.2, 0.2, 0.2, 1.0
Set Effect Constant Vector 1, "AmbientColor", 1
` -------------------------
` Set the technique based on number of lights
numberOfLights = 1
` Limit the old fashion way
If numberOfLights < 0
numberOfLights = 0
Else
If numberOfLights > 9
numberOfLights = 9
Endif
Endif
` Or with matrix1, limit the values this way
` numberOfLights = Clamp( numberOfLights, 0, 8)
If numberOfLights > 0
Set Effect Technique 1, "DBLight" + Str$(numberOfLights)
Endif
` -------------------------
` Sets a lights properties and returns true if successful
` The shader and object must exist and the shader must be on to the object
` The function requests the shader ID for comfirmation, but uses the shader applied on the object
lightNumber = 0
If SetShaderLightEx(lightNumber, 1, 1, x#, y#, z#, range#, red, green, blue) = 0
`Show Message "Failed to set light position"
Endif
` -------------------------
` This version request vector4 colour and position parameters
`SetShaderLight(lightNumber, effect, object, v4LightPosition, v4Color)
do
rem Draw main camera
sync mask %001 : sync
loop
//============================================================
Function SetShaderLight(lightNumber, effect, object, v4LightPosition, v4Color)
If effect > 0
If object > 0
` Do not set anything if the object or effect is non existant
If Not Effect Exist(effect) = 0 Then ExitFunction 0
If Not Object Exist(object) = 0 Then ExitFunction 0
` Get the effect pointer
null = Get Object Effect( object, -1 )
` Apply
Set Effect Constant Vector Element "LightPos", lightNumber, v4LightPosition
Set Effect Constant Vector Element "LightColor", lightNumber, v4Color
Release Effect Pointer
Endif
Endif
Endfunction 1
//============================================================
Function SetShaderLightEx(lightNumber, effect, object, x#, y#, z#, range#, red, green, blue)
Local red# : red# = red * 0.0039215
Local green# : green# = green * 0.0039215
Local blue# : blue# = blue * 0.0039215
Local v4position
Local v4color
Local outcome
remstart
` Matrix1 code
v4position = New Vector4(x#, y#, z#, range#)
v4color = New Vector4(red#, green#, blue#, 1.0)
remend
` Code for DBP without Matrix1
v4position = 999998
v4color = 999999
null = Make Vector4(v4position)
null = Make Vector4(v4color)
Set Vector4 v4position, x#, y#, z#, range#
Set Vector4 v4color, red#, green#, blue#, 1.0
` Apply
outcome = SetShaderLight(lightNumber, effect, object, v4position, v4Color)
Delete Vector4 v4position
Delete Vector4 v4color
Endfunction outcome
This is a good shader for learning the basics, try to have a read of the shader code to get a grasp of what all of the properties are doing.
Later on you could attempt to improve it or try out some of
Evolveds shaders on his website or the
shader library here, the normal map shader you have used is not the best out there which tend to use some kind of cubemap reflection and height map.
Check out some of my
early shader tests a few years back and do a search on normal mapping in the forums to see what others have come up with for inspiration.