Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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.
47 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: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
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


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"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
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: 124
Germany Nrw Herford
HenWoll Offline
Member
HenWoll  Offline
Member

Joined: Feb 2011
Posts: 124
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,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
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
Support me on: https://boosty.to/3rung
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,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
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,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

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


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
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: 124
Germany Nrw Herford
HenWoll Offline
Member
HenWoll  Offline
Member

Joined: Feb 2011
Posts: 124
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
}

Re: SSAO v0.6 for A7 & A8 [Re: HeelX] #479284
03/14/20 23:16
03/14/20 23:16
Joined: Feb 2011
Posts: 124
Germany Nrw Herford
HenWoll Offline
Member
HenWoll  Offline
Member

Joined: Feb 2011
Posts: 124
Germany Nrw Herford
ok hello gs community, i'm already grateful for the double contribution, i now have another problem with the SSAO.

after a long time i had to find out that there is no support for ent view

For example
Code
ENTITY* Ent = 
{
    type = "Test.tga";
    layer = 99999;
    flags2 = SHOW;
    x = 222;
}


So in short, did someone have a hint how view entities (no normal entities, no sky,) can be ignored by the shader?
without creating another view? (I use the standard camera )

big thank you in advance!

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