Sign in to follow this  
zonozz

RTT in Multitexture

Recommended Posts

Hi everyone !

 

Question : Motional scene rendered to texture blending with static texture causes cpu utilization up to 80%.

 

Desc:

I try to use texture-blending in render to texture's texture( I'm doing Raster Tek's tutorials ), I make a texture array class for manage multitextures, one of it's function is to add texture from disk & from ID3D11ShaderResourceView. And the shader render function receive texture array by ID3D11ShaderResourceView**, when rendering, it shows a serious performance problems, I think it because add texture(which is the motional scene rendered to) to texture array should copy data to one node, this operation maybe spend much time. So each frame texture array should do copy operation.

 

I change my code to 2 ID3D11ShaderResourcesView variables as this shader's render function params, but I really want anather way to solve.

 

(These 2 variables running without multitexture manager, but in fact it is a multitexture object). Please help me. Thanks a lot.

Share this post


Link to post
Share on other sites

Are you copying the texture to a GPU resource every frame?  If so, that is not a good way to do it - you should only copy it once.  If you are rendering to a texture, then the render target's Texture2D already contains the contents of the scene and you just need to use it with a shader resource view in the subsequent pass.

 

I'm not familiar with the tutorial that you are describing - can you provide more information on what exactly you are trying to do from an API level?

Share this post


Link to post
Share on other sites

Are you copying the texture to a GPU resource every frame?  If so, that is not a good way to do it - you should only copy it once.  If you are rendering to a texture, then the render target's Texture2D already contains the contents of the scene and you just need to use it with a shader resource view in the subsequent pass.

 

I'm not familiar with the tutorial that you are describing - can you provide more information on what exactly you are trying to do from an API level?

 

Thank you ! I'm sorry for my description not clear ( I'm learning english : p )

 

I know how to do that, I mean I want to manage all multitexture objs by multitexture manager, but each frame I add now rendered scene to texture array and do shader with another texture then I realease the texture ( next frame I add rendered texture again ), so it must be a terrible method, now I try to get the texture need to change in texture array, I just need one more interface to access this texture , and update it.

 

this is my code :

 

this->m_pRTT_Perlin_Array[1] = tmpRenderToTexture->GetShaderResourceView();

	this->m_pGraphics->TurnOffZBuffer();

	this->m_pGraphics->GetD3DObj()->GetWorldMatrix(worldShaderDebugger);

	this->m_pGraphics->RenderShaderDebuggerWindow(50, 500);

	this->m_pMultiTextureShader->Render(this->m_pGraphics->GetD3DObj()->GetDeviceContextPointer(),
		tmpShaderDebugger->GetIndexCount(), 2, this->worldShaderDebugger, this->baseView, this->ortho,
		this->m_pRTT_Perlin_Array);

	this->m_pGraphics->TurnOnZBuffer();

 

 

and previous code like this :

this->m_pGraphics->TurnOffZBuffer();

	this->m_pTextureSequence->AddShaderResroucesToSequence(MULTITEX_RTT_PERLIN, tmpRenderToTexture->GetShaderResourceView(), NULL);

	this->m_pGraphics->GetD3DObj()->GetWorldMatrix(worldShaderDebugger);

	this->m_pGraphics->RenderShaderDebuggerWindow(50, 500);

	this->m_pMultiTextureShader->Render(this->m_pGraphics->GetD3DObj()->GetDeviceContextPointer(),
		tmpShaderDebugger->GetIndexCount(), 2, this->worldShaderDebugger, this->baseView, this->ortho,
		this->m_pRTT_Perlin_Array);

	this->m_pTextureSequence->RemoveTextureSequence(MULTITEX_RTT_PERLIN);

	this->m_pGraphics->TurnOnZBuffer();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this