the stupidest way to get pixel shadows but...

Blitz3D Forums/Blitz3D Programming/the stupidest way to get pixel shadows but...

Paolo(Posted 2004) [#1]
Ok,
I just put this demo to show a theory,
but I believe we all will be happy
if someone find a way to speed this up :) (if possible)

Download_Demo(source)
(30kb)



Paolo.


jfk EO-11110(Posted 2004) [#2]
What you do is Raytracing. To be hones, your version ist real slow :) You shouldn't use linepicks for that.


slenkar(Posted 2004) [#3]
you could send invisible entities from the light instead of linepicks, the shadows would be slower to react but the program wouldnt


ChrML(Posted 2004) [#4]
If you can speed this up to less than 10 seconds, you could use this to create a lightmap during load, however, why?, 3dsmax works fine for that ;) (with render to texture).

Dynamic shadowing is a real hard task to get fast and nicelooking, if that's what you want it to be, so you should read some algorithms from Google, and perhaps try to port it to Blitz3D. Remember that there are many nice games without dynamic shadowing too, like GTA Vice City, so it's absolutly not a must. Good luck!


jfk EO-11110(Posted 2004) [#5]
10 seconds loading is a long time if you can prerender t and include the image in the distribution.

I love this kind of raytracing since it makes everything soooo very easy. don't care about normals etc. simply darken a pixel. Unfortunately this is dead slow. It may be used to create nonlinear renders, but for games design it's just too slow. I even made a test and replaced the linepick with a renderworld using a 2nd camera with a viewport of 1*1 pixels and believe it or not, it was almost as fast as the linepick (about 90%). You also may use some soft linepick replacements, I guess there is something in the archives, it may or may not be faster.
There are some possibilities to optimize your code (eg. no pivot required, just use a linepick from the picked coords to the lightsource), but even then it's still way too slow.

There are some other possibilities we have figured out over time, and believe me, a lot of people used to hack for hours to find something fast.

The thing that seems to be the fastest is to position a camera at the lights position, color all shadowcasters grey, hide the shadow receiver, take a render and use this render as a lightmap.

In this example:
http://www.blitzbasic.com/codearcs/codearcs.php?code=332
I get about 200 FPS with my crappy machine. It may not be useful for multiple light sources and/or large scenes, but I guess it would look very nice with some kind of wrestling or tekken style game.


CodeOrc(Posted 2004) [#6]
Wow, that is fast!

I get a max of 500 fps out of it. Of course if I make Flip=true, I get 71 fps.

Cool code.


Paolo(Posted 2004) [#7]
Thanks for that jfk,

yeah, I like this technique because of the code is pretty much easy and clean :)
I wish there could be a way to speed this up, do you think Mark himself could do something about it?

Anyway,
Nice code you got there, it is actually really fast.

Paolo.


ChrML(Posted 2004) [#8]
Indeed, it's very fast.

Myself I would've optimalized the code a bit, as the guy who wrote it seem to use floats in about all cases, also when it's not neccessary at ALL.