Posted: 18th Jun 2007 23:44
I'm experimenting with mapping. I have 2 plain objects, one under the other. The top is textured with a water texture, and the bottom with a ground texture. I have the water plain alpha mapped to a value of 50. I'd expect the ground texture to be visible through the water plain (from the alpha mapped water plain), but instead, all that is visible through the water is my sky sphere. The ground doesn't become visible until I move the camera under the water plain (like it just "appears"). This only happens when I have textured the ground plain; if I leave it untextured, then you can see it through the water.

Also, if I try to color the ground brown instead of using a texture, it is still visible through the water, but it stays white. Why?

Here's my code for creating the two plains:

+ Code Snippet
rem load textures
   skytexture=1 : load image "sky.bmp",skytexture
   watertexture=2 : load image "text_water2.bmp",watertexture
   groundtexture=3 : load image "text_ground.bmp",groundtexture

   rem load music
   bgm_overworld=1 : load music "overworld.mp3",bgm_overworld

   rem load sounds
   sfx_laser=1 : load sound "laser.wav",sfx_laser

   rem water
   water=6 :  make object plain water,10000,10000
   rotate object water,90,0,0
   position object water,0,-10,0
   texture object water,watertexture
   set alpha mapping on water,50
   set bump mapping on water,watertexture
   scale object texture water,16,16

   rem ground
   ground=7 :  make object plain ground,10000,10000
   rotate object ground,90,0,0
   position object ground,0,-300,0
   texture object ground,groundtexture
   scale object texture ground,32,32


{my game itself is attached
Posted: 19th Jun 2007 0:25
set object transparency objectNum,2

might help, dunno realy
Posted: 19th Jun 2007 1:03
nope, sorry, didn't work. The water wasn't even transparent at all.

It's weird because any other object besides the ground (my textured sky sphere, my ship object, and the bullets that come from the ship) is visible when viewed "through" the water, but not the ground object...
Posted: 19th Jun 2007 4:24
Yeah I noticed this problem when I was giving heat vision to one of my characters and I used a red cylinder with alpha mapping. I noticed that it would make parts of objects such as trash cans, fences, and houses invisible and you could see the ground behind it. It seems like when an object use alpha mapping, darkbasic only takes into account the object furthest in the back from it. I'm not sure if htis is a bug or what.
Posted: 20th Jun 2007 0:00
Well the thing is:

You can see the ship and its bullets when the camera is above water but the ship isn't
You can see the ground when it isn't textured with the ground bitmap.

I have attached my game so you can see what I mean.

{ok, finally got it attached}
Posted: 20th Jun 2007 21:06
I'm only experimenting with mapping, so if anybody catches what could be a simple error, it probably is.

All I want is for the water plain to be partially see-through so you can see the ground plain through it.
Posted: 22nd Jun 2007 0:30
Ok, so I've solved it partially. I replaced set alpha mapping on with ghost object on. Now the water is transparent, and you can see the ground under it, which is exactly what I want. The only problem now is that I can seem to control how transparent the water is. Any tips?