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 / Another shader issue...

Author
Message
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 07:00
Hi all,

I've got another problem with shaders. Specifically Evolved's Advanced Lighting system.

In my game, between each level I do a full "purge" of level models, lights and advanced lighting systems, and re-create them on the next level. When doing this I firstly do a PointLight_Delete() on all lights, then I do an Object_Remove() on all of the objects in the system, then I do an Ambient_Delete(), then a Skybox_Delete(), then a LightScattering_Delete(), then a PostFilter_Delete(), then an AdvancedLighting_Delete(), then I delete all of my effects, then my objects, then my sprites, then my images.

However, this all works fine until I have moved between around 10 levels. After that, the game starts massively lagging, then all of a sudden I get a massive Post Filter flare and the whole screen goes white. It's as if the post filters aren't deleting and are just layering on top of each other or something.

It's only to do with the advanced lighting system, because if I disable it, nothing goes wrong.

Am I purging the advanced lighting incorrectly? Is there a different way I should be doing it?

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 12:51
Hello again CumQuaT.

Quote: "I firstly do a PointLight_Delete() on all lights, then I do an Object_Remove() on all of the objects in the system, then I do an Ambient_Delete()"
You don't need to call PointLight_Delete(), Object_Remove(), or Ambient_Delete() manually, since AdvancedLighting_Delete() takes care of all that for you.

Quote: "then a Skybox_Delete()"
are you using a simple skybox? In other words: are you using Sky_SetUp() or SkyBox_SetUp(CubeMapTex$) to create the sky? SkyBox_Delete() is intended to delete skies created by the SkyBox_SetUp(CubeMapTex$) function, and Sky_Delete() for deleting real-time skies created by Sky_SetUp().

Quote: "LightScattering_Delete(), then a PostFilter_Delete()"
Are you setting up the light scattering with LightScattering_SetUp(Width,Height) or PostEffects_Setup(Width,Height,PixelBlur,Bloom,BloomFlare,Dof,Scattering)? If you are using PostEffects_Setup(), then try just calling PostFilter_Delete() without LightScattering_Delete().

Is there any way you could post a simplified demo which shows the problem?
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 12:53
Hi Revenant Chaos, glad you're here!

Even though I don't need to call the extra Delete commands, wouldn't that just make them redundant, and not actually lead to it being slowed down? It only starts messing up after I've deleted them and recreated them about 7 to 10 times...

I'm not sure I can make a simplified version... I can try...

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 13:06
Actually, Rev, I've narrowed it down a little. All of the different levels of lighting are configurable in my engine, and when I turn off any post-processing the glitch doesn't happen. So it's definitely something to do with that.

The lighting flares would indicate that also. It's as if the Post Processing effects don't get deleted. It's like they just stack, instead.

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 13:24
Quote: "wouldn't that just make them redundant, and not actually lead to it being slowed down?"

Yep, it is merely redundant and shouldn't lead to the slowdown but it was in response to:
Quote: "Am I purging the advanced lighting incorrectly? Is there a different way I should be doing it?"


What functions are you calling to setup the postfiltering?

Quote: "The lighting flares would indicate that also."

This is starting to sound like the problem is comming from the bloom shader (which handles the light flares), does the problem occur with no bloom enabled?
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 13:33
To set up the post filter, I'm using this line:



So I'm making use of EdgeAA, Bloom, BloomFlare and Scattering. But surely all of those should be completely wiped when I call PostFilter_Delete()?

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 13:59
Quote: "But surely all of those should be completely wiped when I call PostFilter_Delete()?"
They most certainly should. Their screen quads should be deleted as well, which should prevent the postfiltering from being drawn even if the shaders are still around.

Just curious, when does the "massive Post Filter flare" occur? Is it mid-game or just after loading? What does it look like, just a pure white screen?

Is there any chance that some object is being masked to render to the postfilter cameras? If you forget to call set object mask for an object, it will render to all cameras and could cause problems.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 14:05
Quote: "Just curious, when does the "massive Post Filter flare" occur? Is it mid-game or just after loading? What does it look like, just a pure white screen?"


It goes completely white screen once the level has loaded (I have a loading screen so it may happen before but I don't know it). But the flare doesn't go away. It just stays totally white, but if that happens on, say, the 10th load, the 9th load has a framerate of about 5fps...

Quote: "Is there any chance that some object is being masked to render to the postfilter cameras? If you forget to call set object mask for an object, it will render to all cameras and could cause problems."


That's actually an interesting question. I might look into that, as my purge routine may not remove any temp objects created by the PostFilter setup....

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 14:54
Well I took a look at purging any assets created by the PostFilter routines, and I've stopped the framerate drop, but the white screen still happens... It's still the PostFilters doing it, I just can't work out where...

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 23rd Oct 2011 15:04
try changing the resolution - that should purge everything from the memory

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 15:12
Not practical for my needs. I don't want everything purged. Just certain things.

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 15:17 Edited at: 23rd Oct 2011 15:20
Quote: "I've stopped the framerate drop"
Nice.

Quote: "try changing the resolution"

While it isn't an actual "fix", that might not be a bad idea. Following it up with reload display pointer couldn't hurt either.
Edit: nevermind...


Just to be sure everything is being deleted, you could loop through some ridiculously huge range and see if anything still exists.

Edit2:
Quote: "that should purge everything from the memory"
Wait, are you sure that purges everything? I thought it only effected the Video memory.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 15:31 Edited at: 23rd Oct 2011 16:08
I'm actually already looping through a ridiculously huge range of images, sprites, objects, etc and deleting them (except the ones that are still needed but they're all accounted for)

But it's still happening. It may not ENTIRELY make sense, but here's the code from my purge routine to show you what I'm doing.



And this is the code I'm using the set up the advanced lighting:



And each time an object is instanced to build the level, I give it a bit of this:



And during my housekeeping/syncing phase, I run this:




But I still have this problem happening:

On the 13th level load it looks like this.

On the 14th level load it looks like this.

This issue is starting to drive me batty

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 23rd Oct 2011 15:43
Quote: "Wait, are you sure that purges everything? I thought it only effected the Video memory."

well, not absolutely everything, but very close to it.
I think it doesn't purge shaders, music, sounds and maybe bitmaps.
Objects and textures definitely do get purged

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 15:55
And sprites!

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 16:20
Typo in PurgeAssets (doesn't help though):


Mabey a camera is sticking around and messing with their sequential IDs, you could try searching for and deleting them as well.

In your object creation code, try:



Probably doesn't matter much, but you should update the skybox before the advanced lighting.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 16:46
Once again, I owe you, Revenant! Doing a total camera purge seems to have fixed the problem! Looks like Evolved's code doesn't clear out old cameras when you delete the PostFilter setup like it does with the Advanced Lighting setup!

When I finish this game I'm totally sending you a signed copy

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 23rd Oct 2011 16:52
Sweet, glad its fixed.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 23rd Oct 2011 16:57
It MAY still be there, but I moved between levels 26 times and nothing changed. It's never taken more than 14 switches to do it in the past, so I feel confident thanks again!

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame

Login to post a reply

Server time is: 2026-07-10 09:56:50
Your offset time is: 2026-07-10 09:56:50