• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Paul C Skertich

Render Target isn't rendering scene objects for post processing effects.

7 posts in this topic

Hey everyone, I am trying to understand this issue I'm having with render target I've created for post process effects. What I can understand about rendering to texture is that you:

 

  1. Render the scene to the render target.
  2. Switch back to default back buffer.
  3. Render the scene.
  4. Render the quad for 2D rendering.

I've cleared the rendertarget for post processing to black then blue and it does change accordingly what I clear the render target for. However, it doesn't render out any scene meshes inside the render target like it should. I've followed raster tek's example and brayansoft example as well. I'll have a look at the code tomorrow.

 

I've looked at the render target texture description and changed it from DXGI_FORMAT_R32G32B32A32_FLOAT to match the backbuffer texture description. It's still not rendering any scene objects.

 

Would I have to make a copy resource of the backbuffer texture description for the render target? How would I go about fixing this issue? Thanks!

 

For clarification... Say if I load a ball inside the level. The back buffer will distplay the ball but not the render target. The render target will be the color I cleared it to. Hope this clarifies things up.

0

Share this post


Link to post
Share on other sites
Do you have a depth buffer for that render target? Is depth-testing off?
What does PIX/Visual Studio 2013/your graphics-debugger-of-choice tell you?


L. Spiro
1

Share this post


Link to post
Share on other sites

Do you have a depth buffer for that render target? Is depth-testing off?
What does PIX/Visual Studio 2013/your graphics-debugger-of-choice tell you?


L. Spiro

depth is disabled for rendering the quad then re-enabled for normal rendering after it's done doing the 2D quad. 

 

When started for now - the quad shows black indicating no texture has been applied. This won't show up in the main editor but only for me during the development in process.

[sharedmedia=core:attachments:20745]

 

When the mesh is loaded. The quad is color I set it to. However, the backbuffer still displays the mesh but the render target doesn't render anything.

[sharedmedia=core:attachments:20746]

 

Also, alphablending is disabled. If I wanted the quad to display an image file then it'll be fine. If the snipplet of code will help then great. Also, I can't use PIX because it crashes everytime I try. The reason why I think is because I imported my functions from C++ to C# and the editor is inside C# language.

 

I looked over the code again and I believe that nothing is getting passed to the render target just a beautiful blue square. I looked over and made sure the render target wasn't being initialized no where else and it wasn't. So, perhaps it's the creation of the shader resource view for the render target?

0

Share this post


Link to post
Share on other sites

What I think is going on is the render target is successfully set but the texture applied to the render target is just showing up blue and not the mesh or any of the screen objects. A brief snipplet:

_declspec(dllexport) bool createRenderTarget() {
	
	HRESULT result = S_OK;

	D3D11_TEXTURE2D_DESC textureDesc;
	D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
	D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;

	///////////////////////// Map's Texture
	// Initialize the  texture description.
	ZeroMemory(&textureDesc, sizeof(textureDesc));

	
	// Setup the texture description.
	// We will have our map be a square
	// We will need to have this texture bound as a render target AND a shader resource
	textureDesc.Width = m_TextureWidth; //-- Gloabl Texture Height and Texture Width varables.
	textureDesc.Height = m_TextureHeight;
	textureDesc.MipLevels = 1;
	textureDesc.ArraySize = 1;
	textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //-- This is what the backbuffer is created when DirectX is initialized. 
	textureDesc.SampleDesc.Count = 1;
	textureDesc.SampleDesc.Quality = 0;

	textureDesc.Usage = D3D11_USAGE_DEFAULT;
	textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
	textureDesc.CPUAccessFlags = 0;
	textureDesc.MiscFlags = 0;

	// Create the texture
	result = dev->CreateTexture2D(&textureDesc, NULL, &renderTargetTextureMap);
	if (FAILED(result)) {
		MessageBox(0, L"Unable to create render target texture!", L"Render Target failed!", 0);
		return false;

	}
	/////////////////////// Map's Render Target
	// Setup the description of the render target view.
	ZeroMemory(&renderTargetViewDesc, sizeof(renderTargetViewDesc));
	
	renderTargetViewDesc.Format = textureDesc.Format;
	renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
	renderTargetViewDesc.Texture2D.MipSlice = 0;

	// Create the render target view.
	result = dev->CreateRenderTargetView(renderTargetTextureMap, &renderTargetViewDesc, &renderTargetViewMap);
	if (FAILED(result)) {
		MessageBox(0, L"Unable to create render target.", L"Render Target failed!", 0);
		return false;
	}
	// Setup the description of the shader resource view.
	ZeroMemory(&shaderResourceViewDesc, sizeof(shaderResourceViewDesc));

	shaderResourceViewDesc.Format = textureDesc.Format;
	shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
	shaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
	shaderResourceViewDesc.Texture2D.MipLevels = 1;

	// Create the shader resource view.
	result = dev->CreateShaderResourceView(renderTargetTextureMap, &shaderResourceViewDesc, &shaderResourceViewMap);
	if (FAILED(result)) {
		MessageBox(0, L"Unable to create Render Target.", L"Render Target Failed!", 0);
		return false;
	}

	return true;

}

As for the quad rendering it uses the shaderResourceShaderMap. If I load a normal texture - it will be fine; however when I attempt to load what the render target has rendered out to the shaderResourceViewMap then it display blue quad. Inside the shader for the quad I just have it return the texture sample.

 

Perhaps inside the rendering loop of the quad I have to obtain the address for the shader resource view?

0

Share this post


Link to post
Share on other sites

This is in no way of an improvement. Inside the rendering loop - where I render the scene inside the render target I created a new camera. So, which is why I have this issue now.

0

Share this post


Link to post
Share on other sites

the render target is blue just like the back buffer however, just some how I am moving the (monster - that's not created by me) around as if it was a 2D Texture. So, I'm a bit confused.

0

Share this post


Link to post
Share on other sites

I looked through the debug flags and there seems to be a mismatch between the back buffer and the render target. It complained about the sample quality being different. In the back buffer I'm using a count of 8 and quality of 32 on a DXGI_FORMAT_D24_S8_UINT. On the render target I'm using DXGI_FORMAT_R32G32B32A32_FLOAT with 1 count and 0 quality. When I make the count and quality an same as back buffer - I get returned a invalid argument was passed. So, something is correctly filled out right.

 

I'm still plugging away at this.

0

Share this post


Link to post
Share on other sites

Issue is fixed - just had to make backbuffer and the swap chain to count 1 and quality 0. I wanted high multisampling ablities. For now I'll leave it like this but I want to be able to change it in the near future back to where it was without any issue. Any feedback would be great.

0

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  
Followers 0