Hi, Robert.
I'm the user. It's very easy to render to 3D texture. By reading NVIDIA SDK 10, we should know each render pass render a scene to a slice. So, we can do this in OSG by setting numbers of camera. OSG camera code has a function:
camera->attach(Camera::COLOR_BUFFER, txt3D.get(), 0, z, false);
the 4th parameter is the slice number you want to render.
So the entire scene graph will be:
ROOT
Camera1     Camera2      .....    CameraN
Scene         Scene                Scene

each camera attach to a slice, and it will be OK.

Regards,
Hesicong
Http://www.hesicong.net


Robert Osfield wrote:
Hi Omar,

I haven't personally tested render to texture (RTT) with Texture3D
yet, but in theory all the wiring for it is in place.  A couple of
months back I recall another user initially trying to RTT with
Texture3D and found problems, but I believe he got things working in
the end.  Hopefully the user in question with spot this thread and
provide us some insight.

OSG wise I think it'd be useful to modify and existing example, or
perhaps write a new one that tests this particular feature, then we
can use this as test bed to get the feature fully working, as well as
provide guidance to others trying to solve similar tasks.

Robert.

On Thu, Jun 19, 2008 at 3:48 PM, Omar <[EMAIL PROTECTED]> wrote:
  
Hello

Im trying to setup a RTT to a 3D texture. However i cant see any changes
to the texture when i render to it. Im attaching texture3D a 4 layer 3D
texture(diffrent image on each slice). This is rendered on a quad; all
of this works fine. Both the quad and the texture3D are made
in createModel(); which i wont paste here because it is the same as the
3D texture example.

This texture3D is rendered to by a RTT camera, the camera has no
children so it should render the clear colour of bright green? (even
when it has children it doesnt change the texture its rendering to), as
in the code below it should make slice 1 a bright green colour if the
RTT works.

Unfortunatly i just get the same 4 layers i started with, the RTT doesnt
change the texture.

osg::Node* node =createModel();
osg::Camera* camera = new osg::Camera;

camera->setClearColor(osg::Vec4(0.1f,1.0f,0.3f,1.0f));
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // set viewport

camera->setViewport(0,0,texture3D->getTextureWidth(),texture3D->getTextureHeight());


camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->setRenderOrder(osg::Camera::PRE_RENDER);
camera->attach (osg::Camera::COLOR_BUFFER ,texture3D,0,1,false);

osg::Group*root = new osg::Group();


root->addChild(node);
  //camera->addChild(node);
root->addChild(camera);
viewer->setSceneData(root);

return viewer->run();

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

    
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to