![]() |
DirectX8 + Alpha Channels - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: DirectX8 + Alpha Channels (/showthread.php?tid=1506) Pages:
1
2
|
DirectX8 + Alpha Channels - Robin - 12-01-2008 ![]() Converted Winds Whisper's engine to DirectX8 for a new project I'm working on. It can handle Alpha Channels! Here's the .png files which are used as textures. ![]() ![]() If you save those and load them in photoshop, you'll see that those bits which look transparent really are ![]() Only took me a couple of hours for the conversion which I think is pretty good. I replaced my character with the pole thing, so all I need to do now is make the engine recognise what tiles are saved where and render them appropriately ![]() EDIT: Here's a special effect ![]() ![]() Re: DirectX8 + Alpha Channels - Anthony - 13-01-2008 Tutorial! xD. Looks very nice Robin. *is jealous* Re: DirectX8 + Alpha Channels - Matt2 - 13-01-2008 Congratz. But, does it really take that long to convert just a few blts here and there to DX8? Re: DirectX8 + Alpha Channels - Rezeyu - 13-01-2008 Took Smchronos a long time to make his engine dx8. Re: DirectX8 + Alpha Channels - Robin - 13-01-2008 Matt Wrote:Congratz. Lol. You really don't understand DirectX do you? DirectX7 allows you to use DirectDraw, which allows you to just copy any piece of a bmp file to a backbuffer and create an image. In DirectX8 you no longer have 2D support. Everything needs to be created in a 3D environment and all the sprites and tiles need to be saved in a texture format. All the ingame graphics need to be created using polygons. Re: DirectX8 + Alpha Channels - Dragoons Master - 13-01-2008 3D is really more complicated than 2D, but the problem that I faced when trying to convert to DX8 was not the 3D, because I had some experience with it, but was the DX8 it self... I wasn't able to know which is the best and easiest way to initialize everything so I didn't even started... Re: DirectX8 + Alpha Channels - Spodi - 13-01-2008 Well pretty much the big difference between using DX7 and DX8 is in DX8, you use textures, not surfaces. You can use surfaces, but it is ugly and slow and ruins the whole purpose. Re: DirectX8 + Alpha Channels - Robin - 13-01-2008 Luckily all my graphics were in the correct texture format ^^ Btw, made it so the engine can recognise the Mirage tile system now. Re: DirectX8 + Alpha Channels - Matt2 - 14-01-2008 Robin Wrote:Matt Wrote:Congratz. Ahh. I get it now. We gotta start off somewhere. Lol. Learning DirectX in all would be nice. xD Re: DirectX8 + Alpha Channels - Robin - 14-01-2008 Yeah, I know what you mean. It was such a big transition between BitBlt and DirectDraw, and an even bigger one between DirectDraw and DirectX8. My advice to anyone is to use DirectX8. It might look harder, but it's actually a lot easier to manage than DirectDraw. Re: DirectX8 + Alpha Channels - Rezeyu - 14-01-2008 Smchronos removed HP bars from the Engine because he said DX8 had issues drawing 2D rectangles or something. Re: DirectX8 + Alpha Channels - Robin - 14-01-2008 He fails at Dx8 then. Re: DirectX8 + Alpha Channels - Spodi - 15-01-2008 Issues drawing rectangles? Everything is triangle, and a rectangle is just made with two triangles. If he is talking about untextured rectangles, they are just that - untextured. Set the texture to Nothing. Thats all it takes. If you can't get that right but you can convert the rendering to DX8, well thats just some good signs of copy-and-paste action. :wink: Re: DirectX8 + Alpha Channels - Robin - 19-01-2008 ![]() Image of it using Mirage's tile system. Re: DirectX8 + Alpha Channels - Rezeyu - 19-01-2008 ![]() Re: DirectX8 + Alpha Channels - Robin - 19-01-2008 God that's ugly. Re: DirectX8 + Alpha Channels - Rezeyu - 19-01-2008 It's just text. It's because it's skinnable. Re: DirectX8 + Alpha Channels - Jonny9797 - 25-01-2008 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. Re: DirectX8 + Alpha Channels - Dragoons Master - 25-01-2008 I just finished converting too. I had the same problem xD Night it self is easy, but draw a big box and set the rgba color of all the vertices to 0,0,0,alpha value, and make it like... 170, that's my night. About the lights, I'm not sure... Re: DirectX8 + Alpha Channels - Robin - 25-01-2008 Jonny9797 Wrote:I myself have spent the last week working with DirectX 8 and am almost finished converting my engine. I have no experience in DX8 at all. I literally spent 3 hours converting the other day because I wanted to work with those tiles I have, which are full of alpha channels. I was basically just ripping out parts of the old DX8 engine Kenko and I worked on for NarutoRealm. Luckily I'm a fast learner, and I know how to do things with it now. Haven't done a lighting system yet, although I probably will do, as I'm currently in talks with Rory to implement a Harvest Moon style farming system. Here's a screenshot of the opacity tool: http://img222.imageshack.us/img222/1231/lolololololololbk7.png Re: DirectX8 + Alpha Channels - Jonny9797 - 25-01-2008 Robin Wrote:I have no experience in DX8 at all. Ahh, I see. Thanks anyway. Robin Wrote:Here's a screenshot of the opacity tool: Thank you. I can't believe I didn't see that. Dragoons Master Wrote:I just finished converting too. I had the same problem xD Night it self is easy, but draw a big box and set the rgba color of all the vertices to 0,0,0,alpha value, and make it like... 170, that's my night. About the lights, I'm not sure...Yeah, I have done similar things to produce a nice night effect, but I still can't get lighting to work the way I would like it to. Oh well, back to working on it! ![]() Re: DirectX8 + Alpha Channels - Dragoons Master - 25-01-2008 If you get any advance, let me know plx ^^ Re: DirectX8 + Alpha Channels - Spodi - 26-01-2008 Jonny9797 Wrote:I myself have spent the last week working with DirectX 8 and am almost finished converting my engine. 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. ![]() (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=6258 Unoptimized stand-alone theory implementation: http://www.vbgore.com/forums/viewtopic.php?t=4709 The 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. ![]() Re: DirectX8 + Alpha Channels - Jonny9797 - 26-01-2008 Spodi Wrote:you just have to decrease the RGB values of every lightYeah, that it how I was doing it. Spodi Wrote:By the way, if anyone is interested in doing some dynamic lighting in DX8 + VB6 without removing the TLVertex, check this out:Wow! That is exactly what I was looking for. Thanks for posting the source. I can't wait to go through it. Re: DirectX8 + Alpha Channels - Kenko - 27-01-2008 Looking good so far! I apologize for some of my sloppy coding. Make sure you don't release the source -- for obvious reasons. Other than that, keep up the awesome work, Robin! :wink: |