Hey guys, I had gotten avatars rendering in out game with animations looking how we wanted but now they only render their shadows... What I did to break it was render the scene twice (slightly different by adding and removeing items before the scene render calls) and on the first render (which is to a render target) the avatars only render shadows but then if I don't remove them from the next render (to the back buffer) then they render fine. But i need them to only render in the first render pass, can avatars not render to render targets?
Also during the change to rendering the scene twice (once on a render target and once the screen) the post processing broke and now throws an error on this line of code when trying to render the first pass to the render target (which is half the size of the screen)
SceneInterface.BeginFrameRendering(MainSceneTarget.SceneState, DeferredBuffers);
Additional information: The active render target and depth stencil surface must have the same pixel size and multisampling type.
I thought that the sunburn rendertargethelper set the depth surface to the correct format or is it just not matching with the hdr processor?
Also what is the first things you look to optimise when a game runs to slow on 360?Our game takes 3-7% of time running its update and about 85% in the sunburn render calls (both on pc and 360) but my pc frame rate is about 120 and my 360 framerate is about 20 (with some lower settings like the shadow buffer etc) I use a 8800gt (the slow 8800) on my pc and know it will run slower on the 360 but was just wondering what i should look at first specifically for 360 gpu performance.How heavy is parallax occlusion mapping on the 360? (my editor is broken at the moment so i can't test it) is it worth it in your opinions?
Also my editor is currently broken (Since the render target stuff) should I just provide a path for the editor that has no render target usage and that is much simplier?And one last thing.(Sorry for the long post)Would instancing be useful if we have 15 objects each used 5 times or would the overhead of the instancing be greater than the performance improvement on the 360? I have instanced box's before, can the same be done with models?Anyway if anyone can answer any of my questions (I know there are a lot) I would be very grateful. Thanks for reading this small book...And thanks to any that answer :)
Hi 2.0,
Are you setting a depth buffer along with the render target? If so make sure the depth format includes a stencil buffer (we'll make sure to add a format check in the avatar renderer for 1.3.2). Also make sure the avatar visibility is set to "RenderAndCastsShadows".
It's generally not a good idea to run post processing on both render targets and the final frame. This is because the render targets are often used in the final frame and will receive post processing twice. It also boosts performance to only post process once.
You can do this by creating two scene interfaces that contain the same object and light managers, but different render, post process and avatar managers (using separate avatar renderers will allow you to avoid removing / resubmitting avatars between rendering the render target and final frame by only initially submitting the avatars to one of the managers).
When using deferred and render targets make sure to create a separate DeferredBuffers object for, and sized to, the render target. Otherwise the rendering will take place at a higher resolution than the output (as an example with the Reflection / Refraction Example it would run calculations at 720p, then down sample to 256x256, which is a huge waste of processing).
The editor works with render targets, however with them you cannot add the editor to the scene interface. Instead call Editor.Update and Unload in the appropriate places (right alongside the scene interface calls) and Begin / End only around the final scene render that targets the back buffer. This is a known quirk, we're reworking the editor back-end to resolve this (should be available in the next update).
Instancing is generally a win, however the overall performance gain is dependent on the spatial and geometric complexity of the objects instanced. As an example instancing objects that are across the level from one another will not help as they're unlikely to ever be rendered together anyway, however instancing closely oriented objects can help a lot (assuming the scene is cpu / draw limited).
Let me know if this helps!
Follow me on Twitter – development and personal tweetsAwesome XNA Videos – Lighting, Rendering, and game videos
JohnK "bobthecbuilder": Hi 2.0, Are you setting a depth buffer along with the render target? If so make sure the depth format includes a stencil buffer (we'll make sure to add a format check in the avatar renderer for 1.3.2). Also make sure the avatar visibility is set to "RenderAndCastsShadows".
Yep they are set to rendered and casts shadowsI will try setting the depth buffer tomorrow with a stencil buffer.
JohnK "bobthecbuilder":It's generally not a good idea to run post processing on both render targets and the final frame. This is because the render targets are often used in the final frame and will receive post processing twice. It also boosts performance to only post process once.
We need to run it on both sadly as that is a design choice however it hopefully shouldn't be too slow as its a half res render target.
JohnK "bobthecbuilder": You can do this by creating two scene interfaces that contain the same object and light managers, but different render, post process and avatar managers (using separate avatar renderers will allow you to avoid removing / resubmitting avatars between rendering the render target and final frame by only initially submitting the avatars to one of the managers). When using deferred and render targets make sure to create a separate DeferredBuffers object for, and sized to, the render target. Otherwise the rendering will take place at a higher resolution than the output (as an example with the Reflection / Refraction Example it would run calculations at 720p, then down sample to 256x256, which is a huge waste of processing).
Ahh i will do both of these things as it will let me not have to remove and add avatars every frame at the very least and should boost performance on our half sized render target (which had the default deffered buffer) also will it work making the deffered buffer smaller than the render target ? i suppose that would boost performance a little bit too.
Cool well i will try out these tommorrow and see what success i have (it looks like this should solve a few issues)
Thanks for your quick reply.
Sadly I havn't made any progress :(I have tryed setting a depth buffer up the same as the render target but it still crashes when trying to do post processing.And I still can't get avatars to render on the render target.Many hours later i have seperated the game into 2 different worlds by creating two scene interfaces and I still cannot get avatars rending in the render target one.I also couldnt get post processing on the render target with out it crashing so I then just tryed to getit working on the main game and now i get this
http://imgur.com/7BaJu.jpgSo it is now applying the bloom but it is very wrong, last time i had the bloom working before the render targets it looked fine. so yer...Any ideas?Sorry to be a bother.
I put together a quick test project rendering a scene and an avatar to both a render target and the frame, and everything worked correctly. It might help to isolate your game's avatar and render target code in a separate project to see if something else is affecting the avatar visibility.
I looked into the HDR / bloom further - post processing uses intermediate render targets based on the destination viewport size, if the same post processors (and manager) are used on two different sized viewports (ie: different sized render target and frame) the intermediate targets will continually be disposed / recreated (to compensate for the change in size). This causes a big performance hit and will blow out the bloom.
To avoid this you'll need to create one post process manager and processor for each size target / frame (just like with the deferred buffers), or resize the target to match the frame size.
Here's a quick shot of my test project with HDR / Bloom and an avatar rendered to both a render target and the frame: