Page 1 of 1

Waking up the sleeping code devils :P

Posted: Mon Aug 19, 2013 4:18 am
by revelator
Phun aside :) sikkpin asked my help getting SSAO to Work, but before i lead him into even darker reaches :twisted: I suggested id ask here, maybe MH or barnes can give him a hint of what would be needed.

From his post at doom3world.
What are the chances of getting you to help me with a problem that I can't seem to figure out. That problem being generating the ao buffer before the lighting pass. Since I don't know enough do it from scratch (draw a fullscreen quad, bind the shader and such, and then draw and capture), I'm forced to rely on the functionality that's already there (DrawStretchPic(),EmitFullScreen(),RB_STD_DrawShaderPasses(), etc.) but no matter what I do, I just can't get it to work.

I mean, ssao is already in there and fully functional, but since the ao texture is created after the lighting pass during the post process phase but passed to the lighting shaders, it's always a frame behind, which of course doesn't look good. Other than the surface sorting issue, which I can live without, proper ssao is the only thing left rendering-wise that I really need done.

So what do you say? :) I'll be in your debt and will do anything you need that's in my power to return the favor.


Cheers

Sikk
In return i bet he would probably help with any shader related stuff you might be fighting with :)

Re: Waking up the sleeping code devils :P

Posted: Mon Aug 19, 2013 5:04 pm
by qbism
Have you noticed any issues with soft shadows freaking if textures are set to downsample? 1024 or 256 for example.

Re: Waking up the sleeping code devils :P

Posted: Mon Aug 19, 2013 6:32 pm
by revelator
Aye so do not downsample :lol:

It uses an image to get the depth renderer for the softshadow effect much like the SSAO hack so downsampling will make it look wierd,
was wondering if we couldnt create one at runtime instead of using a hardcoded one hmm ? bit like darkplaces detail maps.

edit: should actually be redone sikk created it while doom3 was not GPL and it probably suffers from a bit of the same issues that SSAO does.

Re: Waking up the sleeping code devils :P

Posted: Mon Aug 19, 2013 10:21 pm
by revelator

Code: Select all

//==============================================================================
// Screen-Space Soft Stencil Shadows or SSSSS ;)
//==============================================================================
postProcess/softShadows
{
	sort	postProcess

	// soft shadow sample
	{
		if ( Parm3 == 0.0 )
		Program		ss_sample.vfp
		fragmentMap	0		_ssRender
		fragmentMap	1		_currentRender
	}

	// shadow mask blur
	{
		if ( Parm3 == 1.0 )
		Program		ss_blur_box.vfp
		vertexParm	0		Parm0		// offset scale
		vertexParm	1		Parm1		// epsilon
		vertexParm	2		Parm2		// field of view
		fragmentMap	0		_ssMask
		fragmentMap	1		nearest _ssDepth
		fragmentMap	2		_currentRender
		fragmentMap 3 		nearest forceHighQuality textures/postprocess/dither16x16.tga
	}
	{
		if ( Parm3 == 2.0 )
		Program		ss_blur_poisson.vfp
		vertexParm	0		Parm0		// offset scale
		vertexParm	1		Parm1		// epsilon
		vertexParm	2		Parm2		// field of view
		fragmentMap	0		_ssMask
		fragmentMap	1		nearest _ssDepth
		fragmentMap	2		_currentRender
		fragmentMap 3 		nearest forceHighQuality textures/postprocess/dither16x16.tga
	}
	{
		if ( Parm3 == 3.0 )
		Program		ss_blur_x.vfp
		vertexParm	0		Parm0		// offset scale
		vertexParm	1		Parm1		// epsilon
		vertexParm	2		Parm2		// field of view
		fragmentMap	0		_ssMask
		fragmentMap	1		nearest _ssDepth
	}
	{
		if ( Parm3 == 4.0 )
		Program		ss_blur_y.vfp
		vertexParm	0		Parm0		// offset scale
		vertexParm	1		Parm1		// epsilon
		vertexParm	2		Parm2		// field of view
		fragmentMap	0		_ssMask
		fragmentMap	1		nearest _ssDepth
		fragmentMap	2		_currentRender
	}


	// final blend for unblurred shadow mask
	{
		if ( Parm3 == 5.0 )
		Program		ss_blend.vfp
		fragmentMap	0		_currentRender
		fragmentMap	1		_ssMask
	}
}
notice the -> nearest forceHighQuality textures/postprocess/dither16x16.tga ? my best bet is that this is where it goes buum with downsampling :)

but it seems parms above 3.0 uses the internally created texture so try and fiddle a bit with its settings.