OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Strange behaviour on GBufferCamera with 2 attached osg::Image


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
wernerM
Appreciator


Joined: 06 Feb 2013
Posts: 101

PostPosted: Wed Jun 27, 2018 12:53 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

Quote:
if (!renderImage.valid()) {
renderImage = new osg::Image; renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1); renderImage->setInternalTextureFormat(GL_RGBA8); } if (includeDepth && !depthImage.valid()) { depthImage = new osg::Image; depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1); renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB); } renderImage = new osg::Image;
0 The definition of createRTT...

Quote:
renderImage = new osg::Image;
1
Quote:
renderImage = new osg::Image;
2
Quote:
renderImage = new osg::Image;
3
Quote:
renderImage = new osg::Image;
4
When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

Many thanks in advance.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12094

PostPosted: Wed Jun 27, 2018 1:45 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

Hi Werner,

You appear to be included reference to calls and classes that aren't
in the OpenSceneGraph, are you using a 3rd party library that is
providing these?

At this point I can't see a way of helping you as there bit doing the
set up are unknown to us.

Robert.
On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
<> wrote:
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,

osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,

int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true);


When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

Many thanks in advance.



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
wernerM
Appreciator


Joined: 06 Feb 2013
Posts: 101

PostPosted: Wed Jun 27, 2018 1:53 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

Hi Robert,

I'm sorry, I thougth it's OK like that.
Find the definition of the "unknown" method below.
I think this shrinks the code to be just OSG, except createScreenQuad() but that should not really matter.

Thanks

- Werner -

Am 27.06.2018 um 15:44 schrieb Robert Osfield:

Quote:
Quote:
Hi Werner,

You appear to be included reference to calls and classes that aren't
in the OpenSceneGraph, are you using a 3rd party library that is
providing these?

At this point I can't see a way of helping you as there bit doing the
set up are unknown to us.

Robert.
On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
<> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) wrote:
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->getOrCreateStateSet()->setGlobalDefaults(); camera->setClearColor(osg::Vec4()); camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera->setRenderOrder(osg::Camera::PRE_RENDER, _orderNumber); if (_image1) { camera->setViewport(0, 0, _image1->s(), _image1->t());
Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
0
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
1
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
2
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
3
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
4
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
5
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
6
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
7
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
8
Quote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {
9
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
0
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
1
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
2
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
3
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
4
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
5
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
6
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
7
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
8
Quote:
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
9
Quote:
camera->getOrCreateStateSet()->setGlobalDefaults();
0
Quote:
camera->getOrCreateStateSet()->setGlobalDefaults();
1
Quote:
camera->getOrCreateStateSet()->setGlobalDefaults();
2
Quote:
camera->getOrCreateStateSet()->setGlobalDefaults();
3
Quote:
Quote:
Quote:
camera->getOrCreateStateSet()->setGlobalDefaults();
4 camera->getOrCreateStateSet()->setGlobalDefaults();
5

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12094

PostPosted: Wed Jun 27, 2018 2:05 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

HI Werner,

The code looks OK. I don't see any reason why attaching an image to
both the colour and depth attachments wouldn't work, it's not
something I have tested out though.

There is chance it's an OSG bug, but perhaps there is something in
your setup that isn't quite right. It's impossible to know from what
info I have. Could you create a small test program that tests out
assigning an image to colour and depth buffers and if this fails then
share this so others like myself can have a look at it and either spot
an error on the OSG side or in your code. If it works then this
simple case might shine a light on what you are doing differently.

Robert.
On Wed, 27 Jun 2018 at 14:52, Werner Modenbach
<> wrote:
Quote:

Hi Robert,

I'm sorry, I thougth it's OK like that.
Find the definition of the "unknown" method below.
I think this shrinks the code to be just OSG, except createScreenQuad() but that should not really matter.

Thanks

- Werner -

Am 27.06.2018 um 15:44 schrieb Robert Osfield:

Hi Werner,

You appear to be included reference to calls and classes that aren't
in the OpenSceneGraph, are you using a 3rd party library that is
providing these?

At this point I can't see a way of helping you as there bit doing the
set up are unknown to us.

Robert.
On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
<> wrote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {

osg::ref_ptr<osg::Camera> camera = new osg::Camera;

camera->getOrCreateStateSet()->setGlobalDefaults();

camera->setClearColor(osg::Vec4());

camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

camera->setRenderOrder(osg::Camera::PRE_RENDER, _orderNumber);

if (_image1) {

camera->setViewport(0, 0, _image1->s(), _image1->t());

camera->attach(_bufferType1, _image1);

}

if (_image2) {

camera->setViewport(0, 0, _image2->s(), _image2->t());

camera->attach(_bufferType2, _image2 );

}

if (_image3) {

camera->setViewport(0, 0, _image3->s(), _image3->t());

camera->attach(_bufferType3, _image3);

}

if (_isAbsolute) {

camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);

camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0));

camera->setViewMatrix(osg::Matrix::identity());

if (_withScreenQuad) {

camera->addChild(createScreenQuad(1.0f, 1.0f));

}

}

return camera.release();

}

When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

Many thanks in advance.





--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail:



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
wernerM
Appreciator


Joined: 06 Feb 2013
Posts: 101

PostPosted: Wed Jun 27, 2018 2:15 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

Hi Robert,

I'd really like doing that. Unfortunately I'm on Windows and the only development environment is Qt.
So I cannot even create a small project outside Qt.
But honestly I tend to believe it's something in OSG.
Really the only difference in the 2 versions is the additional attachment of the depth image.

I'm sorry.

- Werner -

Am 27.06.2018 um 16:04 schrieb Robert Osfield:

Quote:
Quote:
HI Werner,

The code looks OK. I don't see any reason why attaching an image to
both the colour and depth attachments wouldn't work, it's not
something I have tested out though.

There is chance it's an OSG bug, but perhaps there is something in
your setup that isn't quite right. It's impossible to know from what
info I have. Could you create a small test program that tests out
assigning an image to colour and depth buffers and if this fails then
share this so others like myself can have a look at it and either spot
an error on the OSG side or in your code. If it works then this
simple case might shine a light on what you are doing differently.

Robert.
On Wed, 27 Jun 2018 at 14:52, Werner Modenbach
<> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) wrote:
Quote:

Hi Robert,

I'm sorry, I thougth it's OK like that.
Find the definition of the "unknown" method below.
I think this shrinks the code to be just OSG, except createScreenQuad() but that should not really matter.

Thanks

- Werner -

Am 27.06.2018 um 15:44 schrieb Robert Osfield:

Hi Werner,

You appear to be included reference to calls and classes that aren't
in the OpenSceneGraph, are you using a 3rd party library that is
providing these?

At this point I can't see a way of helping you as there bit doing the
set up are unknown to us.

Robert.
On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
<> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) wrote:

Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color channel in one image and the depth channel in another image.When
What I do:

if (!renderImage.valid()) {

renderImage = new osg::Image;

renderImage->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if (includeDepth && !depthImage.valid()) {

depthImage = new osg::Image;

depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if (!includeDepth)
renderCamera = view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), true);
else
renderCamera = view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
osg::Camera::COLOR_BUFFER1, 0, 0, true);

The definition of createRTT...

osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent _bufferType1, osg::Image *_image1,
osg::Camera::BufferComponent _bufferType2, osg::Image *_image2,
osg::Camera::BufferComponent _bufferType3, osg::Image *_image3,
int _orderNumber, bool _isAbsolute, bool _withScreenQuad = true) {

osg::ref_ptr<osg::Camera> camera = new osg::Camera;

camera->getOrCreateStateSet()->setGlobalDefaults();

camera->setClearColor(osg::Vec4());

camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

camera->setRenderOrder(osg::Camera::PRE_RENDER, _orderNumber);

if (_image1) {

camera->setViewport(0, 0, _image1->s(), _image1->t());

camera->attach(_bufferType1, _image1);

}

if (_image2) {

camera->setViewport(0, 0, _image2->s(), _image2->t());

camera->attach(_bufferType2, _image2 );

}

if (_image3) {

camera->setViewport(0, 0, _image3->s(), _image3->t());

camera->attach(_bufferType3, _image3);

}

if (_isAbsolute) {

camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);

camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0));

camera->setViewMatrix(osg::Matrix::identity());

if (_withScreenQuad) {

camera->addChild(createScreenQuad(1.0f, 1.0f));

}

}

return camera.release();

}

When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

Many thanks in advance.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12094

PostPosted: Wed Jun 27, 2018 2:30 pm    Post subject:
Strange behaviour on GBufferCamera with 2 attached osg::Image
Reply with quote

Hi Werner,

On Wed, 27 Jun 2018 at 15:14, Werner Modenbach
<> wrote:
Quote:
I'd really like doing that. Unfortunately I'm on Windows and the only development environment is Qt.
So I cannot even create a small project outside Qt.
But honestly I tend to believe it's something in OSG.
Really the only difference in the 2 versions is the additional attachment of the depth image.

Can you not even build the OSG? All I'm asking for a a tiny osgViewer
based example like the rest found in OpenSceneGraph/examples.

I'm afraid I'm way too busy to go creating test programs that *might*
reproduce a problem that an end user is having in their own code, even
if I wan't really busy there is real limit in what others can do to
help without you putting some effort in helping them help you.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Image containing floats ivar General 2 Thu Sep 20, 2018 9:18 am View latest post
No new posts minor change: move assumeSizedInterna... mp3butcher General 9 Wed Aug 15, 2018 10:07 pm View latest post
No new posts strange behaviour with osgText::Text christoph General 0 Wed Jul 18, 2018 12:06 pm View latest post
No new posts Drawing a partially transparent image... Jose Pedro Canilho General 6 Mon Jul 02, 2018 9:28 am View latest post
No new posts Image getColor not implemented for GL... Tare General 3 Fri May 18, 2018 11:24 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP