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 / Dynamic cube map and screen resolution

Author
Message
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 25th Apr 2014 07:11 Edited at: 25th Apr 2014 07:12
I'm using Evolved's cubic shadow shader, which uses a dynamic cube map made from a camera to render shadows. I don't know if this is even possible, but I would love to scale the cube map higher than the screen resolution. If I go higher than the screen height I get no shadows. Any options here, or will I have to live with pixelated shadows?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Apr 2014 11:44
Quote: " If I go higher than the screen height I get no shadows."


Without seeing any relevant code I can only guess what you've done - but my guess is that it's a GFX card limitation. Perhaps internal camera target surfaces are limited to the native resolution whereas textures can be much greater resolution?

Quote: "Any options here"


Yes - use a more advanced shadowing method. I think it was Rudolpho who posted a demo using cascade shadow maps - but I haven't tried it myself yet.

Quote: "or will I have to live with pixelated shadows?"


Probably - unless you are prepared for a lot of work. I assume you are already using filtering of the shadow edges.



Powered by Free Banners
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 25th Apr 2014 17:04
Hey GG! It's basically the same code you helped me out with before, herehttp://forum.thegamecreators.com/?m=forum_view&t=210443&b=1
If I set the map size in this statement Make Dynamic Cube Map CubeMapID,512 above that of the screen height I get glitches. I assume that's because the camera can only render the view size, and as a cube map it must be a square, so screen height x screen height is the maximum size. I think.
I'll check out what Rudolpho posted, I remember reading that thread a while back.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Apr 2014 23:06
Quote: "Hey GG! It's basically the same code you helped me out with before"


Ah! Forgot about that.

Quote: "I assume that's because the camera can only render the view size, and as a cube map it must be a square, so screen height x screen height is the maximum size. I think."


That would be my guess too - but still a guess though.



Powered by Free Banners
Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 26th Apr 2014 11:51
I tried out the old code that you and Green Gandalf worked on, and the resolution was not bad. Now your man seems to have no shadow.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Apr 2014 15:03
Quote: "That would be my guess too - but still a guess though"


Some simple tests using the standard set camera to image command don't reveal this problem. Perhaps its a hidden limitation of the dynamic cube map commands?

I looked through the code of our earlier demo and couldn't see anything else that would cause problems such as an implicit assumption of a specific resolution elsewhere in the code. It's a bit baffling - the shadow and lighting rendering works but gets progressively worse as the resolution increases beyond the desktop height. The symptoms are as if the light range calculation goes wrong - but I can't see what that has to do with the shadow map resolution.

I still suspect I've overlooked something simple somewhere.



Powered by Free Banners
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 27th Apr 2014 05:45
Quote: "I still suspect I've overlooked something simple somewhere. "

Well if you happen to find anything I would of course be pretty happy about it . It's probably not the best shader to use for a global lighting solution, I wasn't aware that I wouldn't be able to adjust the cube map size very high when I decided to use that shader though. Should have tested it more first.

Quote: "I tried out the old code that you and Green Gandalf worked on, and the resolution was not bad. Now your man seems to have no shadow."

Objects closer to the light have much better shadows, because the camera renders them from the light source, objects further away from it are naturally smaller so the shader has less pixels to work with.
It's a quandary, all right.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Apr 2014 13:23 Edited at: 27th Apr 2014 13:24
Was the man really that far away from the light? Where was the light? If it was supposed to be the sun then you don't really need a cube map shadow shader - an orthographic camera with a directional light should do the trick (although I haven't got an example to hand - someone posted a demo a while back).

One thing I've tried (with mixed success admittedly) is to place a surrogate light closer to the scene objects and use that with shadow mapping in the usual way. You only need the extra complexities of a dynamic cube map shadow system for lights close to the scene objects so different objects are lit from different directions.

Quote: "It's a quandary, all right."


It is - and the cascade system is one attempt to solve the problem of shadowed objects being varying distances from the light source. I believe FPS Reloaded uses that system - although I'm not yet impressed with the results (I haven't checked the last two updates yet though so some shadow glitches might have been fixed).



Powered by Free Banners
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 27th Apr 2014 22:59
Quote: "Was the man really that far away from the light? Where was the light?"

He's not really that far from it, but he's scaled down considerably from the demo before. There's a tree just to the left of the camera, the light is directly behind it.
I've been examining the lights in various games, mostly assassins creed which I believe also uses cascaded shadow maps. I was hoping to have some sort of day/night cycle, as well as some sections using torch light only so this seemed the best option, if only I could crank the cube map up to 2k or so.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2014 03:00 Edited at: 28th Apr 2014 17:21
I'll try to remember to see if I have similar problems in some of my dynamic cube map demos.

Edit Just checked two of my demos, one with shadow mapping and one with reflection mapping. Both fail when the dynamic cube map resolution exceeds the display height. This tends to confirm that the problem is a bug or limitation of the dynamic cube map commands and not a bug in the code.



Powered by Free Banners

Login to post a reply

Server time is: 2026-07-06 11:21:41
Your offset time is: 2026-07-06 11:21:41