how to save a image with the select SceneNode only?

andyhebear1

06-03-2010 07:15:01

how to save a image with the select SceneNode only?
andybody can help me!
thanks

hedphelym

06-03-2010 09:38:14

Hide everything else in the scene, then save image from the picturebox\buffer?

andyhebear1

26-04-2010 07:48:12

use this method ,the will a flash in print the scenenode image!any more good methods?

smiley80

26-04-2010 19:41:17

First, you create a new Camera, adjust its position, etc. But don't add it to the render window.

Then create a render texture with that camera:
public void CreateRenderTexture(Size size, Camera camera)
{
uint width = size.Width;
uint height = size.Height;

TexturePtr tex = TextureManager.Singleton.CreateManual(
"rtt",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
TextureType.TEX_TYPE_2D,
width,
height,
0,
PixelFormat.PF_A8R8G8B8,
(int)TextureUsage.TU_RENDERTARGET);

using (HardwarePixelBufferSharedPtr buf = tex.GetBuffer())
{
using (RenderTexture renderTexture = buf.GetRenderTarget())
{
renderTexture.IsAutoUpdated = false;
renderTexture.AddViewport(camera).SetVisibilityMask(2);
renderTexture.GetViewport(0).BackgroundColour = ColourValue.Black;
}
}

tex.Dispose();
}


Now iterate through all movable objects. If you want to render a object, set its VisibilityFlags to 2, if you don't want to render it set VisibilityFlags to 1.

And if you want to save it to file:
RenderTarget rtt = ((TexturePtr)TextureManager.Singleton.GetByName("rtt")).GetBuffer().GetRenderTarget();
rtt.Update();
rtt.WriteContentsToFile("rtt.png");

andyhebear1

28-04-2010 10:51:07

thank you smiley80! it is great

andyhebear1

30-04-2010 08:10:16

,i am useed mogre1.48