shadows

Blitz3D Forums/Blitz3D Beginners Area/shadows

Alberto(Posted 2004) [#1]
Hello

Is it possible to create dynamic shadows in Blitz3D?

Thanks in advance


puki(Posted 2004) [#2]
The answer is yes

Have a look at (includes full source code):
http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=memory04242004213434&comments=no

and also:
http://www.blitzbasic.com/logs/userlog.php?user=963&log=269

Plus you will find fake shadow effects in the code archives.


shamanenCoder(Posted 2004) [#3]
@puki the first link doesn't work! :( ... the 2nd link is only a demo without source


jhocking(Posted 2004) [#4]
Buy sswift's shadow system


Ross C(Posted 2004) [#5]
It's possible to create real time shadows in blitz. Not particulary easy though. I'd recommend looking at sswifts shadow code. Also, have a lok through the code archives, i'm pretty sure there's some stuff in there. Rob (Bloodlocust) has a flex shadow thing somewhere too :o)


Gabriel(Posted 2004) [#6]
@puki the first link doesn't work! :( ...


Works fine here.

the 2nd link is only a demo without source


Correct. If you want shadows that are that easy and that fast, you buy the system from SSwift. I've seen a number of people talk about writing better/faster shadows, but no one has actually done it. "Buy SSwift's Shadow System", as Joe put it, really is all you need to say with regard to shadows. And the best thing, as with all of his systems, is that it's ridiculously easy to implement and the source is really, really well commented and easy to read.


wizzlefish(Posted 2004) [#7]
If you have Gile[s], look at the B3D Parser.


Alberto(Posted 2004) [#8]
thanks all

I have downloaded the SSwifts' shadow System demo.
It seems very good


jhocking(Posted 2004) [#9]
"If you have Gile[s], look at the B3D Parser."

What on earth does that have to do with dynamic shadows?


Alberto(Posted 2004) [#10]
Hello
Again on dynamic shadows
What about the following proceedure ?:
to create a copy of the entity
to paint it black
to flat it using scale comand
to blend it with the terrain
to orient it depending on character and light position

I am making some tests,did anybody make something similar in the past?
Does it work?


sswift(Posted 2004) [#11]
Doing that will not look very good.

For one, unless your terrain is perfectly flat, the shadow mesh will intersect the ground... half of it will be cut off.

For another, if you use a blending mode overlapping polygons will create areas that are darker than others. It'll look like a bunch of triangles of different shades.


Braincell(Posted 2004) [#12]
Well im very close to finishing a great shadow system , its the first thing on my list if only i get a bit more time. Should have it by February, if not by then, then its abandoned. I'm talking about the stencil shadows and i've figured out a great fast way of making dynamic shadow volumes (tested). All i need now is to put it all together.


danjo(Posted 2004) [#13]
i got sswift shadow system and am very pleased with it. some thing to be aware of though is your model you want to use to cast shadows (from). try to model it in real scale (the scale you intend to use ingame). the system doesnt like scaled meshes much.


sswift(Posted 2004) [#14]
Keep in mind that even if Lenn makes a stencil shadow system, stencil shadows would use features not native to Blitz and that could lead to crashes or problems on some video cards. Also stencil shadows require much lower polygon characters, and I'm not even sure how Lenn would solve the problem of casting stencil shadows from boned animated meshes since Blitz doesn't return the modified vertex locations.

"the system doesnt like scaled meshes much."

Have you had problems casting shadows FROM scaled meshes? Because there's only supposed to be a problem casting shadows ONTO scaled meshes.


danjo(Posted 2004) [#15]
it was from scaled. the receivers i have not scaled at all. the object was scaled a lot - 0.01,0.01,0.01 and the shadow cast from it was a large square. nothing like the object at all.


Alberto(Posted 2004) [#16]
sswift

Thanks for your reply
Actually I am coding a sport game .
I want to cast the players' shadows on the field, i.e.on a perfectly flat and one_color (light brown)surface, so my method should work, I suppose.


Braincell(Posted 2004) [#17]
and I'm not even sure how Lenn would solve the problem of casting stencil shadows from boned animated meshes since Blitz doesn't return the modified vertex locations.


Thats the thing, im using your trick is all i can say. You'll see either when its done or when i give up (cos of lack of time) and tell the idea to someone else to make it.

And as far as I've seen the guys fixed it so that stencil shadows work on all cards without glitches.


sswift(Posted 2004) [#18]
"it was from scaled. the receivers i have not scaled at all. the object was scaled a lot - 0.01,0.01,0.01 and the shadow cast from it was a large square. nothing like the object at all."

Well if you run across a problem like that again, emailing me the source so I can debug it might result in a fix. :-)


Gabriel(Posted 2004) [#19]
Hello
Again on dynamic shadows
What about the following proceedure ?:
to create a copy of the entity
to paint it black
to flat it using scale comand
to blend it with the terrain
to orient it depending on character and light position

I am making some tests,did anybody make something similar in the past?
Does it work?



Yes, I used it in Tennis Babes. It works, to a point, but it's no replacement for proper perspective shadows. I used it as a backup for SSwift's Shadow System, in case anyone wasn't getting enough speed and still wanted some dynamic shadows. Most people used SSwift's Shadows and a few people used static shadows. Hardly anyone went with my flattened shadows.


Alberto(Posted 2004) [#20]
Sybixsus

I agree, It can not be a replacement for proper perspective dynamic shadows,I will also purchase SSwitt's shadows system ,for future applications.
Anyway ,speed is a main issue for my game , having a lot of players on the field .
I understood the method is quite fast,is it right?
I was also concerned about SSwitft's remark

"a blending mode overlapping polygons will create areas that are darker than others"

My field is similar to a tennis court,did you get an acceptable result?


Gabriel(Posted 2004) [#21]
My field is similar to a tennis court,did you get an acceptable result?


Not with blending. Sswift is right. Where polys overlap, you get ugly changes in shadow color, so I had to forget blending and go with pure black shadows. Not ideal, but better than the alternative.

Anyway ,speed is a main issue for my game , having a lot of players on the field .
I understood the method is quite fast,is it right?


It was better, but not by as much as you might think. Blitz is *very* slow with skeletal animation, and because you're effectively doubling the number of characters ( assuming all have shadows ) you're increasing the strain on the already slow animation. If your characters happen to be MD2's or have just hierarchical animation, yes, it's a lot faster.


Alberto(Posted 2004) [#22]
Sybisus
thanks,I go for Swift shadow system


sswift(Posted 2004) [#23]
"If your characters happen to be MD2's"

My system doesn't really support MD2's because of limitiations in Blitz. I think I got it to where they cast shadows, but they're updated so infrequently that it looks crappy.


Gabriel(Posted 2004) [#24]
My system doesn't really support MD2's because of limitiations in Blitz. I think I got it to where they cast shadows, but they're updated so infrequently that it looks crappy.


Right, but I wasn't suggesting using them with your system. I was suggesting that they would be better if he was gonna mess around with his flattened out version as a backup method to your system. That would then involve exporting skeletal versions for your shadows and MD2's for the flattened version, but if disk space isn't an issue, it's a thought.


Steven Noyce(Posted 2006) [#25]
I know that this post is old, but I realy want the scource of the first link in this thread. Does anyone have it so they could give it to me? Please?


Nexus6(Posted 2006) [#26]
Here you go

http://graphio.250free.com/download/B3d_test_onlySource.rar


Steven Noyce(Posted 2006) [#27]
This link has the same problem as the last one.

It says
Hottlinking not Permitted
Remote linking of files over 250K is not permitted with free accounts. Please try visiting this site directly.




stayne(Posted 2006) [#28]
http://graphio.250free.com/

the link is at the center of the page


Steven Noyce(Posted 2006) [#29]
Thanks!


Stevie G(Posted 2006) [#30]
Hmmm .. I get a mav with this.


Naughty Alien(Posted 2006) [#31]
..one quality and juicy MAV here too..


degac(Posted 2006) [#32]
Try this link for the first 'Another Shadow System' http://www.graphio.net/download/shadow.rar
I changed the site but blitzcoder.com is gone in the while...


Naughty Alien(Posted 2006) [#33]
I download, and run, and MAV again


degac(Posted 2006) [#34]
mmm...strange, on my system it works perfectly, both the .exe and the source. (Athlon64 3500+, GeForce 6600gt - but at the time I created it, it works perfectly on a AthlonXP 1600+ GeForce4200ti)
What is your system?
Maybe if the flag 256 in the CreateTexture() commands.


Stevie G(Posted 2006) [#35]
Nowt to do with the +256 flag on texture creation as I have no issues using this.

P4, 3.2 mhz, gfx 440mx

It MAV's on a writepixel command ... haven't checked but you may be writing outwith the buffer?

If alm>0 Then 
WritePixelFast(xx,yy,shadow,imgBuffer)
Else
WritePixelFast(xx,yy,luce,imgBuffer)
End If 



t3K|Mac(Posted 2006) [#36]
get MAV all the time. even with +256 flag set.


degac(Posted 2006) [#37]
at this point WHEN you get a MAV? At the start, when move the light or when?
I've re-checked the program and the loop where it writes on the buffer is in the limit of the texture. For me there is no error in it.