Gamestudio Links
Zorro Links
Newest Posts
Is Text Box data check possible?
by gamers. 02/17/20 11:09
Behaviour of user-defined bars
by Petra. 02/15/20 13:34
Optimization parameters results
by Petra. 02/15/20 13:22
Bollinger Band - Multi Timeframe
by migo. 02/15/20 06:50
Votes for future features
by 7th_zorro. 02/13/20 05:50
Quote size
by Zheka. 02/12/20 17:10
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
6 registered members (AndrewAMD, thomasprv, jenGs, Zheka, gamers, txesmi), 800 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
DebraSteed, Ricard, Apollo1, ziphnor, thomasprv
18377 Registered Users
Previous Gallery
Next Gallery
Print Thread
Rating: 5
Page 5 of 5 1 2 3 4 5
SSAO v0.6 for A7 & A8 #330073
06/25/10 15:08
06/25/10 15:08
8 Images
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
SSAO v0.6 for A7 & A8

SSAO v0.6 for A7 & A8

This is the 0.6 release of SSAO for Gamestudio A7 & A8!

It has been in development for about 1,5yrs now. After working on the new version for nine months, it has improved in many areas: it is ~21% faster than it's predecessor, it introduces a CHM manual, and automatic GPU-bone support, and a new demo (gpu animated characters with SSAO, DOF and PSSM shadows), and support for decals, and user events, and functionality for attached post-processing chains that want to re-use the depth- and normalmap, which is generated by SSAO, even if SSAO is disabled.

Core features
  • Compatible to A7.86.6 & A8.30.3, shader model 3 required
  • Easy integration into any existing renderchain
  • Supports fog and particles; static meshes; solid-, alphatesting and softalpha entities; decals (new); animated sprites
  • Automatic GPU bone support (A8 pro only) (new)
  • Works with (blurred) stencil shadows and PSSM shadows
  • Can sample depth- and normal map, even if SSAO is disabled (new)
  • Lots of showcase demos included + source
  • CHM manual (new)
  • Free to use in any project (MIT license)

Download (2011-10-10)
SSAO v0.6 source + demos ~44MB


Donation
If you like this software, if you find it useful or if you use it in a project (that maybe goes commercial), - and you would like to help me to find the time to work and improve this, please consider a donation via PayPal smile

Behind the scenes
The main targets for the current release were driven by structural- and performance related changes. While introducing GPU bones, I noticed that the amount of surface shaders exploded. I was also sick of having doubled code in all shader, so I wrote a unified shader which is being compiled during startup several times in different flavors for the support of all surface types and cpu- and gpu-animation support. I also pass compiler #defines to the shaders, which caused a huge boost on the performance in general, and, depending on what you dis- or enable, you get lots of extra frames. I also made the encoding scheme for the upscaling stage based on a texture lookup, which gave me also a instant boost. Plus, I made the sky pixel rejection right now, so, the performance is now also dependent on the amount of sky you have, so, SSAO will now run in space- or racing games, where the sky makes 50% of the screen two or more times faster! Another big win is the newly introduced manual.

Forecast & Call for projects
The upcoming features are now listed in the manual! The list is quiet huge and if you need some of them in a hurry, don't hesitate to contact me! It would be really cool to be in touch with developers, who actually use it, because they give me almost all the time hints how to improve it.

Kudos
The GPU-bone support was mainly targetted to be used for the zombie hordes in Call of Death, thanks to Zapan who actually came up with that feature request. The release takes also advantage of some custom engine features added by JCL, thank you very much for that! I also want to thank Slin, JustSid, Superku, Firoball, PadMalcolm, Jane, Kitsu and ChrisB for their assistance to make this possible! Also thanks to the whole community, I love you smile A8 ftw!

Have fun and best regards,
-Christian

P.S: don't forget to post bugs and comments wink and in the case that you don't like it, tell me why!
Last edited by HeelX; 10/09/11 19:28.
46 Comments
Re: SSAO for A7 & A8 v0.51 [Re: painkiller] #385602
10/20/11 19:44
10/20/11 19:44
Joined: Jul 2008
Posts: 1,980
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 1,980
Germany
Vielen Dank HeelX für diesen tollen Beitrag ! Ich habe es eben binnen 2 Minuten in mein Projekt integriert. Funzt super! Dickes Danke !

mfg


My entry...your exits
Zombies dont like pink glow slime, fact!
"We gonna rock down to electric avenue" "One way ... or anotha ..."
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
-=GOOGLE IS SKYNET=-
rayp.flags |= UNTOUCHABLE;
Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #478967
01/29/20 09:25
01/29/20 09:25
Joined: Feb 2011
Posts: 121
Germany Nrw Herford
BlackJack Offline
Member
BlackJack  Offline
Member

Joined: Feb 2011
Posts: 121
Germany Nrw Herford
after an extremely long search I didn't want it to be true, my project had a memory leak and I assumed that it was up to me but in fact it was the ssao shader.
I didn't want to part with it.

I also checked this in his test demos with a acklog and the error is still there

Quote
Unfreed: 1189, , 132 bytes
Unfreed: 1190, , 132 bytes
Unfreed: 1191, , 132 bytes
Unfreed: 1192, , 8 bytes
Unfreed: 1194, , 8 bytes
Unfreed: 1196, , 12 bytes
Unfreed: 1201, , 8 bytes
Unfreed: 1202, , 8 bytes
Unfreed: 1203, , 12 bytes
Unfreed: 1208, , 8 bytes
Unfreed: 1209, , 8 bytes
Unfreed: 1210, , 12 bytes


in any case, the error comes from the ppSsao.c from the line 960

Code
SsaoObjMtl* createSsaoObjMtl ()
    {
        SsaoObjMtl* o = (SsaoObjMtl*)sys_malloc(sizeof(SsaoObjMtl));

        o->m = (MATERIAL***)sys_malloc(sizeof(MATERIAL**) * SSAO_OBJ_ANIM_CNT);

        int i, j;
        for (i = 0; i < SSAO_OBJ_ANIM_CNT; i++)
        {
            (o->m)[i] = (MATERIAL**)sys_malloc(sizeof(MATERIAL*) * SSAO_SRC_CNT);
            
            for (j = 0; j < SSAO_SRC_CNT; j++)
            {
                ((o->m)[i])[j] = mtl_create();
            }
        }
    }


The SSAO code reserves via sys_malloc memory, but sys_free cannot be found anywhere in the complete code.
does anyone have a suggestion here what I can do?
since the first link is down here on the page, here is the other address:
SSAO for Gamestudio A7 & A8

Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #478968
01/29/20 10:41
01/29/20 10:41
Joined: May 2009
Posts: 5,145
Caucasus
3run Online
Senior Expert
3run  Online
Senior Expert

Joined: May 2009
Posts: 5,145
Caucasus
Hey man.

I'm not a shader pro, but I would try to make SsaoObjMtl* o global and then, on engine close (or right before changing the level) I would sys_free all stuff related to it.

Edit: nahh.. just downloaded the demo, and it seems too complicated for my dumb solution to work. There is that 'removeSsao' function, but it doesn't help with memory leak. I can confirm that I'm getting memory leak too.

Best regards!

Last edited by 3run; 01/29/20 11:06.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #478971
01/29/20 13:43
01/29/20 13:43
Joined: Jun 2007
Posts: 1,286
Hiporope and its pain
txesmi Online
Serious User
txesmi  Online
Serious User

Joined: Jun 2007
Posts: 1,286
Hiporope and its pain
Hi,
I have checked the issue. There are two functions that allocate not freed memory. One is the one you found and the other is 'ssao_startup'. I think all this memory survives a level load, so it is not needed to remove it on level changes or SSAO deactivation. It only needs to be released at program exit time.

The first thing to do is write a function that removes an object material's memory:

Code
void removeSsaoObjMtl(SsaoObjMtl** ref) {
	if(*ref == NULL)
		return;
	
	SsaoObjMtl* o = *ref;
	
	int i, j;
	for (i = 0; i < SSAO_OBJ_ANIM_CNT; i++)
	{
		for (j = 0; j < SSAO_SRC_CNT; j++)
			mtl_remove(((o->m)[i])[j]);
		
		sys_free((o->m)[i]);
	}
	
	sys_free(o->m);
	sys_free(o);
	
	*ref = NULL;
}


then call it for each object material inside a function

Code
void removeSsaoMemLeaks () {
	// remove SSAO object materials
	removeSsaoObjMtl(&ssaoObjMtlSky);
	removeSsaoObjMtl(&ssaoObjMtlSolid);
	removeSsaoObjMtl(&ssaoObjMtlBinary);
#ifndef SSAO_NO_SOFTALPHA
	removeSsaoObjMtl(&ssaoObjMtlSoftalpha);
#endif
	
	// remove SSAO material naming strings (allocated at 'ssao_startup')
	int i;
	for (i = 0; i < SSAO_OBJ_ANIM_CNT; i++) {
		sys_free(ssaoObjAnimDefine[i]);
		ssaoObjAnimDefine[i] = NULL;
	}
	for (i = 0; i < SSAO_SRC_CNT; i++) {
		sys_free(ssaoSrcDefine[i]);
		ssaoSrcDefine[i] = NULL;
	}
}


that has to be called at the program exit

Code
void main () {
   ...
   on_exit = removeSsaoMemLeaks; // Set on_exit event, or call it wherever you want just before exiting
   ...
}


That's all, folks. Salud!

Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #478972
01/29/20 13:56
01/29/20 13:56
Joined: May 2009
Posts: 5,145
Caucasus
3run Online
Senior Expert
3run  Online
Senior Expert

Joined: May 2009
Posts: 5,145
Caucasus
Man, you are the best. Thank you!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #478983
01/30/20 10:30
01/30/20 10:30
Joined: Jun 2007
Posts: 1,286
Hiporope and its pain
txesmi Online
Serious User
txesmi  Online
Serious User

Joined: Jun 2007
Posts: 1,286
Hiporope and its pain
You are welcome wink

Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #479010
02/04/20 18:27
02/04/20 18:27
Joined: Feb 2011
Posts: 121
Germany Nrw Herford
BlackJack Offline
Member
BlackJack  Offline
Member

Joined: Feb 2011
Posts: 121
Germany Nrw Herford
even if this comes a little late, a big thank you from me!
it also works, I have another alternative here

Code
void deleteSsaoObjMtl(SsaoObjMtl** ref)
{
    int i, j;
    for (i = 0; i < SSAO_OBJ_ANIM_CNT; i++)
    {
        for (j = 0; j < SSAO_SRC_CNT; j++)
            ptr_remove(((ssaoObjMtlSolid->m)[i])[j]);

        sys_free((ssaoObjMtlSolid->m)[i]);
    }
    sys_free(ssaoObjMtlSolid->m);
    sys_free(ssaoObjMtlSolid);

    *ref = NULL;
}

void ssao_cleanup ()
{
    #ifndef SSAO_NO_SKY
        deleteSsaoObjMtl(&ssaoObjMtlSky);
    #endif
    
    deleteSsaoObjMtl(&ssaoObjMtlSolid);
    deleteSsaoObjMtl(&ssaoObjMtlBinary);

    #ifndef SSAO_NO_SOFTALPHA
        deleteSsaoObjMtl(&ssaoObjMtlSoftalpha);
    #endif
}

Page 5 of 5 1 2 3 4 5

Moderated by  jcl, Realspawn, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1