Jump to content

Inject Shader between finished Velocity Buffer and Taa Shader


photo

Recommended Posts

Hi,

we want to prototype some modifications on the TAA Shader.

Therefore we need to add a new input Texture in the TAA Shader.

We also need a Shaderpass between the finished Velocity Buffer and TAA invocation where we can read velocity buffer texture and write to the texture which the TAA shader should consume.

Are there any code samples to achieve this or can you give us some pseudo code, how to do it.

Thanks

Sebastian

Link to comment

Hi sweetluna,

thanks but a bit to high level and I run into problems here.

RenderTargetPtr rt;
TexturePtr texture;

void callbackBody()
{
	auto width = Renderer::getWidth();
	auto height = Renderer::getHeight();
	texture = Render::getTemporaryTexture(width, height, Unigine::Texture::FORMAT_RGBA8, Unigine::Texture::USAGE_READWRITE | Unigine::Texture::USAGE_RENDER);

	auto mat = Materials::findBaseMaterial("new_Pixels");
	Renderer::setMaterial(Render::PASS_POST, mat);
	if (!rt)
	{
		rt = RenderTarget::create();
	}
	rt->unbindAll();
	rt->enable();
	rt->bindColorTexture(0, Renderer::getTextureGBufferVelocity());
	//rt->bindUnorderedAccessTexture(0, texture, 0); //<- Crashes 

	Ffp::renderScreen();

	rt->disable();
	rt->unbindAll();
}

int AppWorldLogic::init()
{
	Render::addCallback(Render::CALLBACK_BEGIN_TAA, MakeCallback(callbackBody));
	return 1;
}

Code compiles but I get no screen ouput when callback gets executed asn sometimes crashes when Ffp::renderScreen gets executed.

I also cannot bind and Unordered Access Texture. It will crash immediatly when I try this.


And how do I get my texture into the TAA shader then?
Is there any in deep documentation or examples on these callbacks?
Thanks :)

Link to comment
×
×
  • Create New...