cjb0087
Knave
Australia
76 Posts |
|
EACam
Warrior
154 Posts |
Posted - Apr 26 2004 : 10:19:24 AM
|
Ahh, with REF, I can unlimited lights. I've even checked the Caps viewer utility that came with the SDK and even it says i have 0 max active lights.
(oh, and that gamma thing, it was because I was checking CANCALIBRATEGAMMA instead of FULLSCREENGAMMA) |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Apr 26 2004 : 10:22:17 AM
|
Since you're creating a 2D game, it might be easier for you to do lighting manually by using lit vertices. |
|
|
EACam
Warrior
154 Posts |
Posted - Apr 26 2004 : 11:28:46 AM
|
I was actually highly considering that...it would be tremendously easy, not very slow, and give me far more control. As of now, I'm thinking i should just calculate what tile the light is in, then determine the distance of all the nearby vertices to the light and light them accordingly. Does this sound like a good method?
Thanks. |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Apr 26 2004 : 11:46:20 AM
|
You haven't really given many details other than it is 2D. You mention a tile in your most recent post, so I'll just guess that the entire map is a tile map? If that's the case, then the smaller your tiles the better the light system will be. Also, you might consider using 4 triangles per tile instead of the traditional 2.
Manual lighting can be really fast depending on how your map is organized. If your map is a 2D array, then I would create a restriction of making lights only effect a certain area. Omnidirectional lights, or spot lights with a short range. Any further suggestions on my part would really be based on speculation on how your tile engine is designed.
Perhaps you can give a few more technical speicifications, such as average map size, tile size, number of tiles displayed on the screen, etc. Also, what kind of lights are you trying to create in the game? Omni, spot, directional? |
|
|
EACam
Warrior
154 Posts |
Posted - Apr 26 2004 : 12:26:14 PM
|
mostly spotlights...the game is a scolling tile game, and there could be any where from 20x20 tiles to 100x100 tiles +. all tiles are 32x32 but the sprites can be bigger or smaller. hmmm, 4 triangles? i'm wondering how i would set that up, i'm not to great in the geometry department.
|
|
|
Spodi
Warrior
USA
142 Posts |
Posted - Apr 26 2004 : 5:24:36 PM
|
Instead of: ____ xxx/x xx/xx x/xxx /____
Just do ________ |\xxxxx/x| |xx\xx/xx| |xxx\/xxx| |xx/x\xxx| |x/xxxx\x| |/______\| |
vbGORE |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - Apr 26 2004 : 6:34:12 PM
|
BTW Spodi how's DXRE going? |
Whatever. Who knows... |
|
|
EACam
Warrior
154 Posts |
Posted - Apr 26 2004 : 8:42:46 PM
|
yeah, I knew that much Spodi...sorry, i wasn't very specific, I was refering to using that for lighting and rotating it. I think I'll just stick with 4 vertices.
BTW, What IS DXRE? I downloaded it once, but couldn't figure out what it did. I couldn't do anything except watch identical people walk all over the place. Good graphix tho. |
Edited by - EACam on Apr 26 2004 8:44:11 PM |
|
|
Spodi
Warrior
USA
142 Posts |
Posted - Apr 26 2004 : 9:50:13 PM
|
Heh, DXRE is mainly just an engine. Most people who use it say they really like it, only problem is there is no documentation or anything, I'm too lazy. I've stopped on it since the last release (2 months ago now I believe) since I started on something else. I'll probably get back into it to finish it off finally during summer vacation. I just kinda got discouraged since I cant update my site (FTP dun work and cant get ahold of my host).
http://mindless.sytes.net/ or http://mindless.dragonbound.com/
But going more then that, sorry EACam, I have no idea. :) |
vbGORE |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Apr 27 2004 : 07:32:59 AM
|
Spotlights don't look very good on a tiled map. If the light ever gets rotated, then you'll see effects from the Gourard shading. Omni lights work best because their area of effect is always a circle, that makes them easier to manipulate and calculate. Spotlights are generally either ellipses when projected at an angle, and their projected light is generally somewhat constant througout the lit area. If you want to use spotlights, then I would suggest using a lightmap. |
|
|
EACam
Warrior
154 Posts |
Posted - Apr 27 2004 : 08:50:05 AM
|
did i say spot? I totally meant point |
|
|
Spodi
Warrior
USA
142 Posts |
Posted - Apr 27 2004 : 6:37:44 PM
|
Okay, yeah, it should be possible to do point lights. Though, I've always had a problem with the lighting - it always looks more like a diamond then a triangle. Say you have this for example (each X represents a tile, the O represents the light origin.)
XXX XOX XXX
Okay, so if the middle tile has full lighting (255 argb) then the point(s) of the other tiles that point at the middle have full lighting and the outside points have, lets say 200, it will look like a diamond more then anything. I mainly ran into this problem when trying to apply Fog to DXRE (4 textures, each 1/4 of the screen, using same method as above, ended up looking like CRAP). Theoretically, this should make a circle, or close, right? |
vbGORE |
|
|
EACam
Warrior
154 Posts |
Posted - Apr 28 2004 : 09:08:31 AM
|
It should, and i'm almost positive it will. I think your method may be what's causing that. I'm going to do this:
Say, again, the light is O. Now say it has a range of 100. Well, considering my tiles are 32x32, it's range will extend to 4 tiles (1/32=3.1, and remember, if it's even 0.0000001 more than a number, it'll be rounded UP to the next one, since the next tile WILL get SOME lighting.) Ok, so in memory it'll look like this:
XXXXXXX XXXXXXX XXXXXXX XXXOXXX XXXXXXX XXXXXXX XXXXXXX
To ensure ALL lighting is applied, I make sure that the full length is considered in all four cardinal directions (up, down, left, right). Notice the radius is 3, but the diameter is actually 7 (2x3 + 1) because the light takes up one tile, this isn't exactly how it'll look, but text limits what I can draw . Now, some of tiles in the corners of this box will receive NO lighting, but that's ok. So from here, I simply loop through every vertex of every tile in this box and light it according to its distance from the light using pythagoras' good old theorem. This is the hard part, because "light it according to its distance" is easier said then done. But with a little trial and error, i'll get it looking fine...
I hope. |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - Apr 28 2004 : 11:04:43 AM
|
quote: "light it according to its distance" is easier said then done
I think it's not that hard. you just calculate the distance between the center and the desired point, and then make some calculations. Check this out:
http://216.5.163.53/DirectX4VB/Tutorials/GeneralVB/GM_Lighting.asp |
Whatever. Who knows... |
Edited by - VBBR on Apr 28 2004 11:42:37 AM |
|
|