Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Shadows for many objects HELP

Author
Message
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 6th Sep 2012 08:03 Edited at: 6th Sep 2012 08:05
I'm trying to add shadows to my game. Looked up some tutorials and seems it shows how to do it using a shader, but I'm already using FastBone to speed up my models. Tried the built in commands to turn on shadow but it destroys the frame rate. I dont need anything super flashy, a basic round shadow underneath the model would work for me at this point.

I thought I'd ask for opinions and suggestions before I start experimenting randomly. The matrix is flat so I had thought of placing a circle on the floor for the shadow but not sure how that'll effect the fps. The max amount of objects are 202 not including special effects and trees/props.

Would appreciate any comments as I'm quite stuck right now.



Gunslinger
19
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 6th Sep 2012 15:27
Shadows are really slow at DBP, it kills your FPS. (Like you noticed.)

Just create a plain under the objects, and paint it with a shadow texture.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 6th Sep 2012 16:12
Although some games use extra camera to render all objects black and terrain white, then just project that image to terrain only.

It is faster than shadow mapping and artifact free with any camera resolution.

Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 6th Sep 2012 22:36 Edited at: 6th Sep 2012 22:37
Quote: "Just create a plain under the objects, and paint it with a shadow texture."

Yes I ended up taking that route too. Surprised how well it worked out for me. Thanks



Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 6th Sep 2012 23:50 Edited at: 6th Sep 2012 23:51
make the shadow darker.. would look better

Advanced Updater for your games!
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 8th Sep 2012 02:59 Edited at: 8th Sep 2012 07:03
That looks great.

The problem with simple shadows like that is uneven terrain. If you are on a slope of any kind, the shadow will appear to clip with a hard edge. If you are too close to a cliff or sudden drop, the shadow will appear to hover in air.



I'm also looking into a variety of shadow techniques. Although I don't think it's going to be easy.

Quote: " Although some games use extra camera to render all objects black and terrain white, then just project that image to terrain only."

That's a great method but I get the feeling it only works best in a shader demo. I want like several hundred lights in the game world (worst case scenario) and having a camera draw for each just isn't possible. I suspect I might use this method for a single 'environmental' light like the sun and maybe have all other lights not cast any shadows.

Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 8th Sep 2012 11:21
Quote: "make the shadow darker.. would look better "

Yeah I had it darker earlier but it hurt my eye. Might be the grass texture not working out too well.


@Mage
Thanks and that's is true, I notice some clipping when the shadow hit the "hills" far back in the distance so I flatten more of the terrains further back. I really would like to explore better shadows but simple works best for my simple game.

When I eventually take on a game like yours, I'd definitely hit up better shadow methods.

Login to post a reply

Server time is: 2026-07-07 22:22:16
Your offset time is: 2026-07-07 22:22:16