2D Dynamic Shadows
BlitzMax Forums/BlitzMax Programming/2D Dynamic Shadows
| ||
I wrote a module to create fully dynamic hard edged or soft shadows. You can create any convex geometry you want, since you are drawing the shadow casting vectors like in a vector painting software. Thanks to Orangy Tang for his paper and Indiepath for his DirectX version of DrawTexturedPoly() and some tips on the forum code (still haven't found a manual :-) Downloads and bigger screenshots are here: http://www.pyropixel.de/bmax_shadows.html These demos includes some basic editor functions to play around with. Tip: always build the shadow vectors in anti-clockwise direction. Have fun. |
| ||
Most impressive. Is that my TExtured Poly command you use there? |
| ||
Why aren't the forum manuals in manual section...I always forget how the bbcodes work...:-O |
| ||
Just kill the [img] tags and it will show |
| ||
yep, where do I sign? Is it DX and/or GL? |
| ||
@Indiepath Yes it's your TexturedPoly command. @tonyg It's both. You would need Indiepath's TexturedPoly command and my GL version of TexturedPoly command. See this post for TexturedPoly: http://www.blitzmax.com/Community/posts.php?topic=51059 |
| ||
That's good and, the obvious question, when/where can I get it? |
| ||
YEah where's the code man. I wanna play. |
| ||
Um. I think I have to prepare a little manual and an example code for public use. I will come back later... |
| ||
Ok, I updated my site (link see first post). You will find a first release download there. I hope it will work. Please let me know. |
| ||
Ah you compiled it all, how can we learn from a compiled module.. 'cmon show us the real deal. |
| ||
Not sure what I'm doing wrong but it can't find pyropixel.vector2d. |
| ||
Ah, so it does not work. I thought, when I send you the compiled ones, the dependencies to other modules would be avoided. I'm heavily using vector functions of my own vector module. I believe nearly everyone has got a different vector module but all vector modules are of the same name. This is very anoying. Or is there a trick how to deal with different mods that use the same type declarations? Anyway, updated to release v0.2. on my site (see first post for link). Full source code of shadow module and my vector module. The source code is of course commented very poor :-) |
| ||
Thanks for that Rene. I can't compile the modules. It's possible the framework/Imports are not correct although I used FrameWork Assistant. It can't find DrawTexturedPoly (I *have* added the drawtexturedpoly stuff) |
| ||
Hm, I remember the first time I tried to add Indiepath's DrawTexturedPoly hack, the Blitz IDE recognised DrawTexturedPoly() as a command (the command gets yellow in the code) but when I tried to compile it says something like "Identifier DrawTexturedPoly not found" or something else. Do you have the same problem? |
| ||
I tried to reproduce the problem. I found out, when I add the DrawTexturedPoly() function in the max2d.bmx file to the very bottom, I cannot compile. But when I paste the function somewhat higher in the code for example after the DrawPoly() function, I can compile. Weird! |
| ||
Perhaps I should build the textured poly function outside of the max2d.bmx file. I know how to do that know :D |
| ||
Yes, maybe...I'm afraid of the next modsync update... |
| ||
Yep, moving the drawtexturedpoly in max2d.bmx means I can build modules. For some reason demo3 can't find TLight while Demo4 doesn't have a problem. <edit> Forget that, re-extracted the demo code, re-ran, got an error that debugmode not found, rem'ed the debug statement and it ran. I get the feeling for Bmax modules to be compatible they need to have some sort of structure where they don't use the same function/method names. |
| ||
Great Stuff, I have tried it by myself, but give up after getting trouble with DX and OpenGL. Will try it now. From the Screenies it looks great. |
| ||
I'm keeping an eye on this as the demos are fantastic. What would be nice is a seperate shadow editor where I can load a tileset and create the polygons, save them out and then load them into my program. If it's already possible to do this I'd be interested to know how. |
| ||
Can't get this working - error with build modules? also --------------------------- BlitzMax Application --------------------------- Compile Error Identifier 'DrawTexturedPoly' not found --------------------------- OK --------------------------- |
| ||
"and Indiepath for his DirectX version of DrawTexturedPoly() " and from the website... "This module works only with the Drawtexturedpoly() command." |
| ||
I did everything i read but bmax wouldnt compile for me either |
| ||
Well why doesn't he include it? Just include it for gods sake. |
| ||
Heh - this is why I don't use BMax. |
| ||
Do any of the 'not compile' problems provide messages? |
| ||
@tonyg: did you know: you can press F12 to export all object code to console. Press Shift+F12 to export only selected objects. You could write a background image loader and use this function. There is still a little bug: there must be at least one TShadowCasterObject or the shadow system will not run, sorry for that. |
| ||
New version uploaded on my site (see first post). No new features, but an only includes version. So no mod hacks are needed, everything is included. The restriction: the include version is OpenGL only since I do not know, how to write a DrawTexturedPoly() command for DirectX... |
| ||
I'll try that next week. It'd be nice to have the shadow/light editor as part of a map editor. Load your map, draw around your shadow casters, place your lights and then save the data. With ability to add lights at runtime I can see some nice stuff being produced. What further plans do you have for this mod and where can I track it's progress? Sometimes I wonder whether there should be a BB.com uber-2d mod using the great stuff being produced on these forums. |
| ||
There are some more features planned: - rotating of TShadowCasterObjects - maybe scaling of TShadowCasterObjects - circle shadow geometries - lense flares - textured umbra shadows (for creating light through window fx, fake caustics, etc.) - a standalone editor with export to file functions I will post everything in this thread and/or update the project site. |
| ||
Wow, this really is amazing. I've already easily implemented this in a project im working on. Thanks. |
| ||
I'm still keeping an eye on this so any news/progress is most welcome. |
| ||
Right now im working on a feature rich editor that will use the shadow system with some new features. Right now the progess is slow because of other projects without shadows :-) Since there is no official DrawTexturedPoly command, I will only develop an OpenGL version. I don't want to do such mod hacks anymore... There will be more news/updates in future, when my Website update is done. |
| ||
Nice... |