Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / multi texturing to simulate light, help

Author
Message
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 30th Aug 2005 07:12
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:



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.

Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 30th Aug 2005 08:03
okay well i fixed some stupid problems, heres latest code:



and silly me forgot verts start at 0 (so confusing, half the db stuff seems to start at 1 and the rest doesnt XD) so that fixed scrolling. Now i can manually scroll the ENTIRE texture, but i cant just scroll the blend map :/ if I set index to anything but 0 then the code has no effect on the object. Im begining to wonder if i was misinformed and it really did paste the blend directly onto the original texture meaning they arnt seperatly textured at all? im all out of ideas now. Seems that either its NOT multitextured or the vertex uv commands are broke when it comes to indexes apart from 0?

just incase its any use, heres the texture and blend map im using so you guys can test with exactally what i have:

the grass texture: (please dont just steal it XD took me ages to make it seamless >.>
http://www.melted.com/spectural/storage/GrsFloor01.jpg

and the blend map:
http://www.melted.com/spectural/storage/blend.bmp

i think im at your mercy now

Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 30th Aug 2005 11:12
At a guess, I'd say that dbMakeObjectPlane() creates an object with just a single set of UV's. In D3D when you alloc vertex buffers, you use what they call the flexible vertex format, meaning that you must specify exactly how many different texture coords you need (and if you need per vertex colour etc etc). From then on, you're locked to whatever uv count you selected.

D3D doesn't just go ahead and allocate 8 UV's because that would be terribly inneficient for 99% of models that do not require that much.

I'm new to dgsdk but I know a bit about d3d... anyway, now that you raised that issue I must urgently look into dgsdk's multi-tex capabilities and see if any limitations may hinder my upcoming project...
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 31st Aug 2005 16:22
Thanks for the reply - I have this all sorted now I managed to catch Mike earlier and we discovered the problem was due to only a basic blend mapping function being exposed which didnt use texture indexes properly - he showed me how to manually expose a more fully featured one and says that it will be exposed in the headers of the next update for everyone

Yes you were also right about the plane only having one set of texture coordinates - but this is easilly fixed using the dbConvertObjectFVF() command My plane now has 3 textures in total - 1 base and 2 blends and using the vertex commands i can scroll the two blends independently of the base texture. It came out well, check out my Shisaku thread in the WIP forums for a screenshot of the result Its given me tons of ideas of stuff i can do now - multitexturing is great and you shouldnt have any problem with it

Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 1st Sep 2005 11:25
Quote: "but this is easilly fixed using the dbConvertObjectFVF() command"


Yeah, I noticed this command existed the evening after my post. Assuming it works well it's very handy. Mind you, it's not something you want to run very often because, afaik, d3d doesn't have any native upgrade of buffers, so the implementation must be via copying the mesh data around...

Login to post a reply

Server time is: 2024-11-19 01:37:32
Your offset time is: 2024-11-19 01:37:32