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 / Why does a sphere fails to cast shadow ?

Author
Message
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 11:45
Hello,

Why does a sphere fail to cast shadow , whereas in case of a cube the shadow thing works ! ? Any suggestions ?



Thanks,
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 5th Apr 2012 13:10 Edited at: 5th Apr 2012 13:12
Something very strange is going on there. It's probably something to do with a stencil buffer over run. Your sphere should have about 160,000 polys, but strangely statistic(0) seems to be reporting less than that. If you run the command with a 50,50 res sphere, which is 40,000 polys, it works fine. If you run it with a 60x60, it crashes with a dmem error on my machine.

Shadow mapping objects of that detail seems to be a bit risky. If you look at the shadow map command, you also have mesh,distance and shader parameters. You can use a mesh to throw a lower res shadow that the system can handle, while retaining your uber high poly sphere. In reality, shadow mapping anything with that many polys will cause your program to lag massively, so keep it to a few thousand if possible.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Apr 2012 13:20 Edited at: 5th Apr 2012 13:21
Is that sphere supposed to be super high poly? What's wrong with the usual sphere? I think the sphere 100,100 is a mistake.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Apr 2012 13:31 Edited at: 5th Apr 2012 13:53
Quote: "If you run it with a 60x60, it crashes with a dmem error on my machine."


Works on mine but 100x100 doesn't. I think you're right that 100x100 is asking too much from DBPro. I'm not sure how DBPro shadows work but it might involve adding extra polygons between the back and forward facing polys of the sphere in which case some internal limit might be exceeded.

Just using a lower resolution sphere seems to be the simplest solution.

Edit Yes, it seems DBPro adds an enormous number of extra polys when doing shadowing. I'm not sure why it adds so many though.

Edit2

Fallout

Quote: "you also have mesh,distance and shader parameters. You can use a mesh to throw a lower res shadow that the system can handle"


That sounds like good advice - except I can't get it to work.

Edit3 Ouch! Yes I can - silly typo. Here's my code which works with a high poly sphere:

Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 15:05
Does this limitation also present for Dark GDK ? Or do I get a better option there ?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Apr 2012 19:48
I don't know for certain, but I'd expect DGDK to have the same limitations as DBPro plus a few more because DGDK updates usually lag behind DBPro updates.

It's not much of a limitation though. Why would you need high resolution shadows?
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 20:03
Quote: "I don't know for certain, but I'd expect DGDK to have the same limitations as DBPro plus a few more because DGDK updates usually lag behind DBPro updates."


That line just broke my heart ..... Dark GDK Lagging behind ! That is sad.

Quote: "It's not much of a limitation though. Why would you need high resolution shadows?"
- just load testing the dark side ....
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 5th Apr 2012 21:18
GDK is quite far behind DBP. I'm currently side stepping issues right now. Ones I've found over the last few days: blend mapping functionality outdated, clone object command doesn't share data, cannot pass arrays of values to shaders, sprite texture coords get undone bug, calculate object bounds command missing (just update the header file to fix it though), issues with Dark Lights commands.

Let's just say, I'm glad I know DBP inside out, otherwise I would've been scratching my head for a long time wondering what was going on.

GDK for better overall performance, but DBP for functionality. Everything is always a compromise.

Login to post a reply

Server time is: 2026-07-09 13:31:18
Your offset time is: 2026-07-09 13:31:18