hello, running into a few problems here which may be because im approaching the problem completly wrong or just implementing it wrong. First allow me to draw your attention to this screenshot of a game called dark chronicle on the ps2:
http://giotto.ibs.it/gv/sc/80/6080G9.jpg
I wish it was animated because then it would all become clear, but a still will have to do. If you look at the grass floor you will notice a sort of zig-zagging light green on the dark green grass texture - its not just part of the static texture but a pattern that scrolls backwards and forwards over the top of the texture sort of giving the effect of light shining through the branches of the forest trees - its not really accurate by any means but it does look good. I wished to implement something like that in my game, figuring that if i could get that working then I could use the same principle for other things like dark cloud shadows on the ground or cheap fake cloud reflections on water etc etc.
Anyway - programming im fine at, 3d effects im not. I dont want to duplicate the floor and simply ghost it because that would be very ineffcient (large levels, lots of floor) - so I started exploring ways to actually multi texture the floor, this is a new are of exploration for me so i've run into a few problems. Thanks to some tips from APEX i discovered the blend mapping command. I scribbled a random lightish pattern in photoshop and started testing, in the end I managed to acheive the effect perfectly with blend mode 5. Came out like this:
http://www.melted.com/spectural/storage/blending.jpg
Now the problem.. scrolling the light part of it over the plane without scrolling the grass at all. Ultimatly for the best looks I would even like a second light texture blended onto the top so i could scroll them both in different directions and ending up with an object with 3 textures - 1 base and 2 blends. I was told on the irc chatroom that when blending darkbasic does NOT clamp the textures into one and i could scroll one of the blend maps by specifying a texture index. dbScrollTexture does not take an index parameter so i resorted to the commands that came with the vertex command set but its just not working. Trying to scroll index 1 messes up the texture on the plane completly, and index 2, 3, 4, 5, etc all do nothing to the texture at all.. I tried many things so this code isnt the only one i've tested with, but my source file currently looks like this:
void DarkSDK(void) {
dbSyncOn();
dbSyncRate(60);
dbLoadImage("GrsFloor01.jpg", 1);
dbLoadImage("blend.bmp", 2);
dbMakeObjectPlane(1, 20, 20);
dbTextureObject(1, 1);
dbSetBlendMappingOn(1, 2, 5);
int u;
int v;
int i = 0;
bool moo;
while(LoopSDK()) {
if (dbEscapeKey())
return;
if (i > 10)
moo = true;
else {
if (i < -10)
moo = false;
}
if (!moo)
i++;
else
i--;
dbText(0, 0, dbStr(i));
dbLockVertexDataForLimb(1, 0);
u = dbGetVertexDataU(1);
v = dbGetVertexDataV(1);
dbSetVertexDataUV(1, 5, u + i, v + i);
u = dbGetVertexDataU(2);
v = dbGetVertexDataV(2);
dbSetVertexDataUV(2, 5, u + i, v + i);
u = dbGetVertexDataU(3);
v = dbGetVertexDataV(3);
dbSetVertexDataUV(3, 5, u + i, v + i);
u = dbGetVertexDataU(4);
v = dbGetVertexDataV(4);
dbSetVertexDataUV(4, 5, u + i, v + i);
u = dbGetVertexDataU(5);
v = dbGetVertexDataV(5);
dbSetVertexDataUV(5, 5, u + i, v + i);
u = dbGetVertexDataU(6);
v = dbGetVertexDataV(6);
dbSetVertexDataUV(6, 5, u + i, v + i);
u = dbGetVertexDataU(7);
v = dbGetVertexDataV(7);
dbSetVertexDataUV(7, 5, u + i, v + i);
dbUnlockVertexData();
dbSync();
}
}
i know theres more than 7 verts in a plane (im guess so anyway as doing 1 to 6 only distorts the texture for one corner of the plane) but for some reason trying to use the UV commands on verts 8+ causes an unhandled exception error.
Anyway im out of ideas. Can anyone suggest a way to scroll the blended texture, or maybe a completly different way of doing this? (which doesnt require duplicate geometry XD)
Thanks in Advance.