Jonny9797 wrote:
I myself have spent the last week working with DirectX 8 and am almost finished converting my engine.
Since you (Robin and Spodi) have done so already, I have a few questions if you don't mind:
- Why you you have D3DRS_LIGHTING turned on in that screenshot? I was under the impression that is was useless in a simulated 2D world.
- Did you code in any kind of night or lighting system? I am having trouble figuring out the best way to do it. Multi-texturing sounds good, but it forces the lights to line up with and be the size of a tile, does it not? However, when I alphablend light in random places, I have trouble figuring out how to darken the rest of the tiles (darkening the vertex colors doesn't seem to work).
- How do you directly edit the alpha channel of individual pixels in Photoshop? I have looked and searched and googled and I can't figure it out.
Thanks in advance.
Its been a while, but D3DRS_LIGHTING isn't useless in a 2D world but rather useless on lit verticies. Typically this is how 2D games are done because self-lighting your verticies is incredibly easy. You often have a grid of tiles and don't break that structure very much in a 2D game, while in 3D you, many times, can't even figure out where the verticies are without toggling the display and many verticies need to be handled on a hardware level because you have so many models and a much more varying world using stretched and transformed textures.
To do day and night, just change the lighting. If you're using lit verticies, which you most likely are/will be, you just have to decrease the RGB values of every light. If you are storing your lights as a long which you probably should be to have to prevent converting to a long every render (which happens more often then converting from a long), then you can easily break it apart using a little series of bitshifts and bit-wise operations. I can elaborate how to do this if anyone wants. I
love bit twiddling.
To edit the individual pixels in Photoshop... good question, and I wish I knew. I wish other programs made the setting of the alpha value as easy as Flash makes it.
Only thing I have ever figured out how to do is flood fill the alpha channel in Paint.Net using a 3rd party plug-in, and that just allowed me to get rid of the background. What kind of sick, twisted world is this where people don't care so much about alpha channels? Its madness! Maadddnneesss!!!!
(Robin, you will probably like this:)By the way, if anyone is interested in doing some dynamic lighting in DX8 + VB6 without removing the TLVertex, check this out:
Optimized vbGORE implementation:
http://www.vbgore.com/forums/viewtopic.php?t=6258Unoptimized stand-alone theory implementation:
http://www.vbgore.com/forums/viewtopic.php?t=4709The first is optimized for vbGORE using minimalist updating, a bit based on vbGORE's engine (size of the screen view, for instance), but can easily be changed to your own. The latter is a stand-alone project that doesn't use much optimizing, but is much easier to read. I recommend checking out at least how I optimized it for vbGORE, and probably even just copying a lot of that code. Keep in mind my vbGORE implementation
does not make use of the rest of the map lights which makes it a bit like a software version of hardware lights, but you guys can probably change it without too much effort to work with both. I was just sick of trying to deal with vbGORE's map lights to get it to work.