Michael Hansen

i have look at this sample by Manders vs. Machine

i use 2 rendertarget and it work in winxp but not on xbox360

when you

graphicsDevice.ResolveRenderTarget(0); ( you get a copy of what you just have render)

so you can say this

Texture2d mytex = Myrendertarget.gettexture();

now i shood have a copy of the rendertarget copy from xbox fast mem to local mem stored in my mytex

now shwicth rendertarget and do the same and render to a screenquad on both textures

this dos not work xbox

so thery u can onlye have one rendertarget on xbox one for shadow and the mesh

but i what to postprocess the mesh example bluer it a bit so i need a rendertarget more

we can do this on windows but not on xbox

i have converted about 44000 lines of code from mdx beta 2 to se my engine running in xna on windows

but the engine will never run xbox

download the sample 8 kb or so and create a new xbox360 project add ref link to this project files and deploy to xbox

https://blogs.msdn.com/manders/archive/2006/11/30/feedback-creating-chaos-with-render-to-texture.aspx

CAN SOME ONE PLEASE HELP




Re: XNA Framework help please Rendertarget on xbox360

Shawn Hargreaves - MSFT

You can have many rendertargets on Xbox. You just need to be careful about exactly when you resolve them, and understand that whenever you call resolve or change rendertarget, that will zero out the contents of the current rendertarget.





Re: XNA Framework help please Rendertarget on xbox360

Michael Hansen

you can onlye have one i treyd rendertarget and backbuffer

when i resolve the rendertarget on xbox it is not resolve

i have been working for 3 weeks now and this is a bug and porting my engine to xbox

i will give any one 100 dollars if you can get the above sample to run on xbox from

it onlye use one rendertarget at the time but nothing is resolve i even tryed to resolve to a texture

shawn please give a try ..

get to run on xbox width both rendertarget on xbox and you see nothing is ever resolve to a backbuffer , texture

when you draw it is blank

 this sample code is taking from the above sample where is the bug why does it not work on xbox

protected override void Draw(GameTime gameTime)

{

// Alternate which texture gets the white square drawn on it and which

// gets the fullscreen quad drawn on it.

RenderTarget2D renderTargetFirst = renderTargets[curInitialRenderTarget];

curInitialRenderTarget = (curInitialRenderTarget == 0 1 : 0);

RenderTarget2D renderTargetSecond = renderTargets[curInitialRenderTarget];

// Draw our square on the first RT

graphicsDevice.SetRenderTarget(0, renderTargetFirst);

if (gameTime.TotalGameTime.TotalSeconds == 0) // Only need to Clear the first time through

graphicsDevice.Clear(Color.Black);

spriteBatch.Begin();

spriteBatch.Draw(tex, new Rectangle((int)x, (int)y, (int)width, (int)height), Color.White);

spriteBatch.End();

graphicsDevice.ResolveRenderTarget(0);

// Transfer from first to second RT

graphicsDevice.SetRenderTarget(0, renderTargetSecond);

effect.Begin();

texParameter.SetValue(renderTargetFirst.GetTexture());

dxParameter.SetValue(1.0f / viewportWidth);

dyParameter.SetValue(1.0f / viewportHeight);

EffectPass pass = effect.Techniques[0].Passes[0];

pass.Begin();

graphicsDevice.VertexDeclaration = vdecl;

graphicsDevice.Vertices[0].SetSource(vb, 0, bytesPerVertex);

graphicsDevice.Indices = ib;

graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, numVertices, 0, numPrimitives);

pass.End();

effect.End();

graphicsDevice.ResolveRenderTarget(0);

// Draw second RT onto backbuffer

graphicsDevice.SetRenderTarget(0, null);

spriteBatch.Begin();

spriteBatch.Draw(renderTargetSecond.GetTexture(), new Rectangle(0, 0, (int)viewportWidth, (int)viewportHeight), Color.White);

spriteBatch.End();

}

}

 






Re: XNA Framework help please Rendertarget on xbox360

Shawn Hargreaves - MSFT

At the start of the frame, this code seems to be assuming it can just draw a white rectangle over the top of whatever is already in the rendertarget. This is not correct, because at that point the contents of the rendertarget are undefined. If you want to continue rendering over the top of a previous result, you need to first restore that previous result into the rendertarget (by drawing the texture as a fullscreen quad). Any time you call SetRendertarget, you have to assume the thing you just set now contains garbage.





Re: XNA Framework help please Rendertarget on xbox360

Michael Hansen

this is not my code it is Manders vs. Machine a microsoft dude

a sample in 8 kb a feedback effect it runs fine on windows vista , xp , media center, but not on xbox

i have pointed out the there is a error on rendertarget on xbox

download the sample it is onlye 8 kb compile run on windows or what ever

But when you create a new project xboxgameproject and add ref to the code file and compile for xbox

the sample runs fine on xbox ( Blank screen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)

now onse again 100 dollar is the a bug in xna

Shawn Hargreaves - MSFT .. please try the sample go and download it and run it on windows and tranfere to xbox and run it

it fails(rember to create a new xboxproject)

the is a bug on rendertarget on the xbox even when you resolve the rendertarget all that you have just render is lost

i have read you post on rendertarget in you blog and all your saying IT CAN NOT BE DONE

TRY THE SAMPLE !!!

https://blogs.msdn.com/manders/archive/2006/11/30/feedback-creating-chaos-with-render-to-texture.aspx

YOU CAN NOT RENDER TO LET SAY

TARGET 1

DRAW

RESOLVE 1

GET TEXTURE FROM TARGET 1

RENDER TARGET 2

DRAW

RESOLVE 2

RENDERTARGET = NULL

DRAW FINAL BUFFER ON SCREEN =========== BLANK========XBOX360

WINDOWS==============FEEDBACK EFFECT ======= 0K

I






Re: XNA Framework help please Rendertarget on xbox360

Shawn Hargreaves - MSFT

I did try the code, which doesn't work because it contains a bug. When I fixed the bug, it worked fine on Xbox.

You can draw to many rendertargets. What you cannot do is assume that when you first start drawing to a rendertarget, it will contain the same thing it did the previous time you drew to it, during the last frame.

To fix this particular program you need to change it so that rather than just swapping the two targets each frame (which makes the second target from the previous frame become the first target of the next frame, but doesn't work because the RT contents have been lost by this point), it draws the texture from the second rendertarget over the contents of the first (and then doesn't actually swap the RT pointers).





Re: XNA Framework help please Rendertarget on xbox360

Michael Hansen

When I fixed the bug

can you please tell what the bug was then i can get my 24 rendertargets in my game engine to work on xbox

and you get a 100 dolars , Mh@3devolution.net do you have a paypal i treansfere the monny to you

here is a link to my engine it runs on windows , but not on xbox

http://www.3devolution.net/EvoFXEngine/tabid/86/Default.aspx ( pictures)

http://www.3devolution.net/DevBlog/tabid/90/EntryID/4/Default.aspx (video so you can see the action = null) old video but cool render

i have tryed for 3 weeks to get rendertarget to work but it fails

 

 please tell what the bug was !!!!!!!!!!!!!!!!!!!

 






Re: XNA Framework help please Rendertarget on xbox360

Shawn Hargreaves - MSFT

I don't want your money Michael, that's ok thanks :-)

The bug in the feedback sample is that it is assuming rendertarget contents will persist from one frame to the next, which is in fact not true. To fix it, I took out the code that currently just swaps the current rendertarget, replacing it with a sprite batch call to restore the texture that was resolved from the second rendertarget at the end of the previous frame over the contents of the first rendertarget, immediately after activating it onto the device.





Re: XNA Framework help please Rendertarget on xbox360

Michael Hansen

mabye i am stupid bu i tryed it and i cant no get it to work

can you please post some code

tanks






Re: XNA Framework help please Rendertarget on xbox360

Shawn Hargreaves - MSFT

// Alternate which texture gets the white square drawn on it and which
// gets the fullscreen quad drawn on it.
RenderTarget2D renderTargetFirst = renderTargets[0];
RenderTarget2D renderTargetSecond = renderTargets[1];

// Draw our square on the first RT
graphicsDevice.SetRenderTarget(0, renderTargetFirst);
if (gameTime.TotalGameTime.TotalSeconds == 0) // Only need to Clear the first time through
graphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
if (gameTime.TotalGameTime.TotalSeconds > 0)
spriteBatch.Draw(renderTargetSecond.GetTexture(), Vector2.Zero, Color.White);
spriteBatch.Draw(tex, new Rectangle((int)x, (int)y, (int)width, (int)height), Color.White);
spriteBatch.End();
graphicsDevice.ResolveRenderTarget(0);

// Transfer from first to second RT




Re: XNA Framework help please Rendertarget on xbox360

Michael Hansen

million tanks to you it works

my owen feedback effect in my engine is now working and the all the otheres 24 rendertarget is running

with the rest of the engine is now blowing 100 frames per second on xbox

there is 4000 bounding box split up in a kd-tree, in each box there is terrain blocks , rocks , leafs ,palm trees waving in the wind a total of 12000 polys

and ofcourse the sun render (best ever created ) and it is done in xna

i have never seen any xbox360 game use this tech in realtime

http://ati.amd.com/developer/siggraph06/Wenzel-Real-time_Atmospheric_Effects_in_Games.pdf

""""""farcry 2 is going home,,,,, or a bit crysis for the unreal3 engine (gears of war )"""""""""""""

get the drift !!!!

 i will make a video and post it on your tube

and let you now so you can see

silly sprite"""

you are on my credits list in my game shawn

tanks tanks tanks tanks

 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

well i got a mail where do i use feedback effect in my engine

read the paper at page 13

well my bag of tricks

i do it for a 32x32 bitmap and use a feedback effect for 10-20 frames or so

depending on the time of the day