Multi Texturing & lighting...

Blitz3D Forums/Blitz3D Programming/Multi Texturing & lighting...

OverDozing(Posted 2005) [#1]
Hey,

I am doing a Blitz Terrain, I am adding 1 texture then I play with a light to simule the night, everything is fine.
Now, I am adding a second texture to the terrain and the new texture isn't affected by the light ?? Now come ? I tried many Blend/texture flag possibilities but nothing is correcting the problem.
Here how I set up the textures on my terrain:

;AddMultiTex(Name$,Flag,Scale#,Blend)
AddMultiTex("Land01.jpg",1,20,2) <- this is the first texture... not an additional
AddMultiTex("Plage.jpg",2,TerrainSize(WorldMap),3)



Function AddMultiTex(Name$,Flag,Scale#,Blend)
CountMultiTex=CountMultiTex+1
MultiTexFlag(CountMultiTex)=Flag
MultiTexName$(CountMultiTex)=Name$
MultiTexScale#(CountMultiTex)=Scale#
MultiTexBlend(CountMultiTex)=Blend
End Function
Function InitWorldTexture()
For i=1 To CountMultiTex
MultiTex(i)=LoadTexture(MultiTexName$(i),MultiTexFlag(i))
ScaleTexture MultiTex(i),MultiTexScale#(i),MultiTexScale#(i)
EntityTexture WorldMap,MultiTex(i),0,i
TextureBlend MultiTex(i),MultiTexBlend(i)
Next
End Function


_PJ_(Posted 2005) [#2]
Have you set FullBright anywhere?


OverDozing(Posted 2005) [#3]
No, I didn't, all the parameters conserning the textures on the terrain are in the functions you can see on the first post.
Also, I am using AmbientLight 30,30,30

The light is a type 1 and unique in my scene, positions & rotation are updated to simule a sun.
After a certain degree, I decrease the light colors little by little to don't have illumination on the meshs on the downside and here the problem, the additional textures on the terrain are not going to fad: neither by the light rotation/positions, neither by the light colors.

Plz help me.


_PJ_(Posted 2005) [#4]
Hmm... I have some funny things happen when I try blending textures. Even worse on my (8M graphics) laptop. Apart from the lighting, are the correct texurtes displaying correcty?

I'm wondering if it may be a hardware/graphics memory problem?

Sorry dont know much about this blendy stuff - bit techy for me!


OverDozing(Posted 2005) [#5]
Well yeah the textures look pretty fine.
I am curently working with a laptop and the video card isn't a high class...

I know I have some problems with 'entityalpha', the entity will flash if i used it...

Damn, is it really the reason of my multitex/lighting problem ?

Oh well, thank you for your support!


Ross C(Posted 2005) [#6]
Have you tried the HWMultiTex command and disabling it?


John Blackledge(Posted 2005) [#7]
Can I tell you what's working for me?
Terr\hbmpclr2 = LoadTexture("Ground\rockunder.bmp") 
EntityTexture Terr\hent,Terr\hbmpclr2,0,1
Terr\hbmpclr = LoadTexture("Ground\grass.bmp") 
EntityTexture Terr\hent,Terr\hbmpclr,0,2
TextureBlend Terr\hbmpclr2,1
TextureBlend Terr\hbmpclr,2

This means that the 'under' texture is loaded first, at layer 1.
The main texture is loaded second, at layer 2.

You seem to be using blend 2, then 3.
I've found that that best results are to be had by using blend mode 1 on the under texture, then blend mode 2 on the main texture.

On the subject of laptops, I've seen some wacky effects not found on desktop machines: on my brother's laptop my 3 animated meshes won't display, only 2 will ever show wihin the camera view, the third just disappears!
But we cannot repeat this 'anomaly' on _any_ other machine, laptop or desktop.

Trust laptops? I don't think so.


OverDozing(Posted 2005) [#8]
Ok, I just tried to enable/disable HWMultiTex and no differences, I tried with some other Flag/blend texture and still nothing.

I tried to inverse the texture applying order as well and still nothing....

The thing is, it seem that I have 2 chooses:
1- use only 1 texture on my terrain and being able to use the 'TerrainShading'
2- use 2 or more textures and having a fullbright terrain...

I start to really believe it's coming from the laptop.
I should test this on a 'mesh' terrain when I have a chance.

anyways, Thx for the help !