2D Realtime Shadow Module
BlitzMax Forums/BlitzMax Programming/2D Realtime Shadow Module
| ||
I want to anounce version 1.0 of my shadow module PPSoftshadow. For download just follow the link in my sig. ![]() ![]() ![]() ![]() Some features are: - Dynamic shadow calculation in real time - Unlimited dynamic lights with many parameters - Hard edged shadows or soft shadows - New inline editor to create light and shadow geometry - Lens Flare system - Rotating shadow objects - and more... Maybe some of you will give it a testdrive. Feedback is of course very welcome. Fee free to use it with your project. Have fun, René |
| ||
Hi, René, you forgott to compile the module for linux....or would it be possible to release the bmx code? thanks |
| ||
Hi Rene, Superb mod. If I hit F2 in demo6, shadow, and hit enter and then delete I get an... Unhandled Exception: Attempt to access field or method of null object from PPSoftshadow.Editor() |
| ||
I've been waiting for this one ever since it was first showcased some months ago. Nice work! |
| ||
In addition, you had a DX version working with Indiepath's changes to the DX modules. Now that's released as source and no longer needs a BRL module change would you consider re-implementing it? Failing that a source release would be much appreciated. |
| ||
It looks nice, but... is it actually soft shadows? They look pretty hard-edged. Soft shadows have soft edges. |
| ||
Thank you for your feedback! @Fr3eMaN yeah, sorry, no linux at the moment. Some parts of the GUI are not open source right now. That is why I don't want to release the source. I'm very sorry :-( Hope I find time to setup a Linux system by time... @tonyg 1. thanks again. fixed in version 1.01 coming tomorrow. 2. Yes, right it's OpenGL only at the moment. I will try to implement DX for version 1.02. @AngelDaniel In fact most of the screenshots do not show softshadows. You can activate for each light to cast hard-edged- or softshadows. You can even set softshadows on or off for every vector of a shadow object. So one side of the wall could throw hard-edged shadows while the other side throws soft-edged ones (don't know when this could be usefull :-). But I should be fair and say that I'm not completly happy with the softshadows. There are some glitches in extreme near distance situations. Furthermore the shadow volumes are not influenced by other shadow casting objects. This is the second thing I'm not happy with. But hey...it's free :-) |
| ||
i've tested an old version of the module and had problems with shadows of moving objects, becouse you must add a lot of vectors, is there now a solution to remove vectors? |
| ||
New version 101 is up. Fixes the crash reported by tony and I have added a help window with keys you can use. I've started DX integration. I will let you know when it will work @Fr3eMaN I don't understand your question. You can add and remove shadow casting vectors with the built in editor. You can do so without editor as well. Or do you mean, if the shadow calculating process is faster now, by using less vectors? Then the answer is 'no'. It's still the same calculation. I know there is no other way on Linux right now using a module pre 1.0 where I included the source code. But pre 1.0 means there is a memory leak, and the computer gets slower and slower until it crashes. |
| ||
Looks really good. The editor has some small glitches (its possible to place a new shadow polygon without creating a "caster object" in which case it has no effect and can't be removed as it seems) V7 demo shows some problem with soft shadows thought. On the border, if lights and caster are both set to softshadow, there is an "overshadowed" part that seems to be more or less the area that is "softened" at the border ... |
| ||
looks very cool ! Well done. |
| ||
Thankyou! Yes, the editor do have some glitches. I will fix that one posted in next version. |
| ||
Maybe Indiepath (or everyone else too :-) can help me with your texturedpoly module. I can't get it to work. What am I doing wrong in the following code?SuperStrict Import indiepath.texturedpoly Graphics 800,600,0 TPoly.Initialise() SetBlend ALPHABLEND SetClsColor 200,200,200 Local img:TImage = LoadImage("pyro2_logo.png") Local poly:Float[45] Local c:Int Ptr=Int Ptr(Float Ptr(poly)) poly[0] = 10 poly[1] = 10 poly[2] = 0 poly[3] = 0 poly[4] = 0 poly[5] = 1 c[6] = $FFFFFFFF poly[7] = 0 poly[8] = 0 poly[9] = 10 poly[10] = 200 poly[11] = 0 poly[12] = 0 poly[13] = 0 poly[14] = 1 c[15] = $FFFFFFFF poly[16] = 1 poly[17] = 0 poly[18] = 200 poly[19] = 200 poly[20] = 0 poly[21] = 0 poly[22] = 0 poly[23] = 1 c[24] = $FFFFFFFF poly[25] = 1 poly[26] = 1 poly[27] = 200 poly[28] = 10 poly[29] = 0 poly[30] = 0 poly[31] = 0 poly[32] = 1 c[33] = $FFFFFFFF poly[34] = 0 poly[35] = 1 poly[36] = 10 poly[37] = 10 poly[38] = 0 poly[39] = 0 poly[40] = 0 poly[41] = 1 c[42] = $FFFFFFFF poly[43] = 0 poly[44] = 0 While Not KeyHit(KEY_ESCAPE) SetColor 255,255,0 DrawText "Texturedpoly Test",100,100 SetColor 255,255,255 SetAlpha 1 'DrawImage img, 0,0 TPoly._Begin() TPoly.Draw(img,0,poly) TPoly._End() Flip;Cls Wend |
| ||
Hi Rene, It's failing the 'If xyuv.length < 6 Or (xyuv.length & 1) ' test in tpoly.draw. Not sure why and it's getting late but I'll try a little bit longer. <edit> If I take out the xyuv.length&1 test it seems to work OK. Should it be an 'and' test rather than an 'or'? Must admit I'm not entirely sure what that bits doing. |
| ||
Aha, good eye ;-) Think we should ask Indiepath in his forum about that. |
| ||
Remove xyuv.length&1, can't remember why it's there. |
| ||
Ok, thank you Indie. I changed the line and included this version of texturedpoly mod into the rar archive of version 1.02 (if that is okay?). Version 1.02 is up and supports DirectX now! Give it a try... Next thing will be a Linux and a PowerPC version. René |
| ||
That's cool as long as you make sure people know where it came from. |
| ||
Of course...;-) |
| ||
Ok, version 1.02 ships now with Linux modules. But I didn't test them, since I created them with a live Linux with no proper graohic drivers. Maybe some of you with a Linux system can give it a try? Fr3eMaN? Have fun, René |
| ||
hi works fine on linux! thanks Rene |
| ||
PPSoftshadow mod is now running with PPC Macs. I included the modules in the latest download. Follow the link in my sig... René |
| ||
nice to see - do you use some of my sample codes on blitzbase.de ? it was a template for something like this - long time ago... |
| ||
In the BlitzMax Mod folder are 3 subfolders: brl.mod Deps.mod pub.mod Where do I put the 2 mods? Do I have to recompile all afterwards ? I tried putting the two mods in the brl.mod folder, recompiling and now get this error whenever compiling Compile error cant find interface for module pyropixed.ppgui. I'm running the latest BlitzMax on Mac os 10.4.77. |
| ||
@MrCredo I have written the module completely from scratch with the dynamic soft shadow article by Orangy Tang. I remember that I saw a shadow system by klepto2 on a german blitz forum which inspired me to understand the article mentioned above and to realise a blitzmax mod. But I know your site. There is a lot nice stuff and articles. And I cannot 100% reject, that I used some samples of your site :-) @DannyD The two mods have to be placed directly into BlitzMax' mod folder. Not into a subfolder like brl or pub. So afterwards in the mod folder should be indiepath.mod folder and pyropixel.mod folder beside pub.mod and brl.mod folder. You cannot compile the shadow system, since all compiled modules should come with the download. There are no source codes in the download you could compile. |
| ||
@Rene: This was the module MrCredo was speaking of. I have only added some features like coloured lights, rotating and moving objects, so the main work was done by MrCredo. |
| ||
Rene, Thanks for the reply. I moved both mod folders to the mod folder as suggested. I then tried texturedpoly.mod/examples/example1.bms and got: Building Example1 Compiling:Example1.bmx Linking:Example1.debug ld: table of contents for archive: /Applications/BlitzMax/mod/indiepath.mod/texturedpoly.mod/texturedpoly.debug.macos.ppc.a is out of date; rerun ranlib(1) (can't load from it) Build Error: Failed to link /Applications/BlitzMax/mod/indiepath.mod/texturedpoly.mod/Examples/Example1.debug.app/Contents/MacOS/Example1.debug Process complete |
| ||
Never saw that error. But you can try to compile Indiepath's texturedpoly mod (sorry, I said there is nothing to compile, but indeed the source of Indie's texturepoly mod is in the download). So try this in console: bmk makemods -a indiepath.texturedpoly Afterwards try to run the example again. If it does not work, try if the example runs without debug mode? |
| ||
just had a look through the examples and I am very impressed!. this is exactly what will make me lil game a real looker. Nice work! Lil question, Can lights be moved individually? Would be nice to have a light follow along with a character. Deleting and recreating it every loop doesn't seem to work. the screen gets flooded with sprites. Perhaps an X/Y property on the TLight class would be handy :) |
| ||
There appears to be another lil issue. It may be related to the above though. When you lock the Light position to a specific spot (no mouse-follow) and you use PPSoftshadow.SetOffset(X,Y) to offset the casters and lights, all the objects behave properly, and the shadows move along with them, but the actual Light sprites (glare and lensflares) stay in their fixed screen-coord position. They should be moving along with all the rest. |
| ||
Yes, it's a bug I also realised tonight. I have fixed it on my local version here. I will upload a new version today. Every light should already have an x and y property. Have you tried it? |
| ||
Ok, there is a new preRelease v1.03 online on the site which fixes the SetOffset() Light problem and some other minor bugs. preRelease because it only contains Windows modules right now. The other OSs will follow soon. |
| ||
Ace! thanks. Yes I tried using light.x and _x and position.x and all sorts, but to no avail unfortunatly. Edit: Got the light movement working. |