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 

Show part of geometry which intersects a specific area

Goto page 1, 2  Next
 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
aozdin
Newbie


Joined: 28 Feb 2018
Posts: 16

PostPosted: Mon Mar 26, 2018 2:38 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

I draw a complex geometry. I am changing the position of that geometry with a nodecallback by giving random position values on the screen. There is no problem until here.

I dont want to show whole geometry to the user. I want to define a rectangle and I want to show only the geometry's specific part inside a rectangle on the screen. In other words, I want to show only geometry's specific part intersects that rectangle.

How can I achieve this?

Thanks,
Back to top
View user's profile Send private message
hartwigw
Appreciator


Joined: 20 Mar 2009
Posts: 128

PostPosted: Mon Mar 26, 2018 9:40 pm    Post subject:
Reply with quote

Hi,

you may use a PolytopeIntersector to get all items intersecting the rectangle. Afterwards, you may modify the node mask of the found items: set a specific bit of the node mask to one if it is found by the PolytopeIntersector and to zero if not (by implementing a visitor inspecting the scene). The camera will then cull all items that have a zero in the node mask.

You may also write your own visitor that is doing this checking and sets the node mask of the visited drawables at the same time.

Cheers,
Hartwig
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Tue Mar 27, 2018 7:40 am    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali,

One way of constraining rendering is to use osg::ClipNode - this
allows you to place one or more osg::ClipPlane (wrapper around
glClipPlane). Have a look at the osgclip example, to run it use:

osgclip cow.osgt

Robert.

On 26 March 2018 at 15:39, Ali Ozdin <> wrote:
Quote:
I draw a complex geometry. I am changing the position of that geometry with a nodecallback by giving random position values on the screen. There is no problem until here.

I dont want to show whole geometry to the user. I want to define a rectangle and I want to show only the geometry's specific part inside a rectangle on the screen. In other words, I want to show only geometry's specific part intersects that rectangle.



How can I achieve this?

Thanks,

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73173#73173








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


Joined: 28 Feb 2018
Posts: 16

PostPosted: Tue Mar 27, 2018 12:55 pm    Post subject:
Re: Show part of geometry which intersects a specific area
Reply with quote

Dear Hartwig and Robert,

Thanks for your answer. I have solved the problem with Robert's advice by using clipNode. However in my geometry, there are a lot of osgText. ClipNode does not effect on the osgText; so all the text in my geometry is still seen on the screen although the text is not inside the clipBox.

How can I solve this ?

robertosfield wrote:
Hi Ali,

One way of constraining rendering is to use osg::ClipNode - this
allows you to place one or more osg::ClipPlane (wrapper around
glClipPlane). Have a look at the osgclip example, to run it use:

osgclip cow.osgt

Robert.


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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Tue Mar 27, 2018 4:01 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali,

On 27 March 2018 at 13:55, Ali Ozdin <> wrote:
Quote:
Thanks for your answer. I have solved the problem with Robert's advice by using clipNode. However in my geometry, there are a lot of osgText. ClipNode does not effect on the osgText; so all the text in my geometry is still seen on the screen although the text is not inside the clipBox.

How can I solve this ?

I haven't tested this specific combination of features, but in
principle it should be just a case of enabling the GL_CLIP_PLANEi mode
for the text subgraphs.

Which version of the OSG are you using and what GL versions?

The new osgText implementation in master/OSG-3.6 branch uses shaders
so out of the box, looking at the shader I don't see any setting of
the gl_ClipVertex so this could be a problem. I will look into this.

Robert.


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


Joined: 28 Feb 2018
Posts: 16

PostPosted: Wed Mar 28, 2018 7:46 am    Post subject:
Re: Show part of geometry which intersects a specific area
Reply with quote

Hi Robert,

Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but all geometry in geodeForgeomRight works well except osgText geometries. Sample code is below:

Code:

osg::ClipNode* clipped_subgraph;
osg::ref_ptr<osg::Geode> geodeForgeomRight;

osg::ref_ptr<osgText::Text> bottomAltitudeText = new  osgText::Text;
osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 0.0f);
std::string timesFont("fonts/arial.ttf");
bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
bottomAltitudeText->setFont(timesFont);
bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
bottomAltitudeText->setPosition(position);
bottomAltitudeText->setText("hello world" );
bottomAltitudeText->setCharacterSize(15.0);
geodeForgeomRight->addDrawable( bottomAltitudeText.get() );


osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
mt->addChild(geodeForgeomRight.get());

clipped_subgraph = new osg::ClipNode;
double xMin,yMin, zMin, xMax, yMax, zMax;
xMin = (SCREEN_WIDTH * 0.64);
yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
zMin = 0.0f;
xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
yMax = SCREEN_HEIGHT*0.6;
zMax = 0.0f;
osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
clipped_subgraph->createClipBox(bb);
clipped_subgraph->addChild(mt);

clipped_subgraph->setCullingActive(true);
mt->setUpdateCallback(new AltitudeCallBack());


Best regards,

robertosfield wrote:
Hi Ali,
I haven't tested this specific combination of features, but in
principle it should be just a case of enabling the GL_CLIP_PLANEi mode
for the text subgraphs.

Which version of the OSG are you using and what GL versions?

The new osgText implementation in master/OSG-3.6 branch uses shaders
so out of the box, looking at the shader I don't see any setting of
the gl_ClipVertex so this could be a problem. I will look into this.

Robert.


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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Wed Mar 28, 2018 9:21 am    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali,

When you put nodes underneath a ClipNode those nodes should inherit
the required GL_CLIP_PLANEi, so in theory it should work right,
however, as I've never mixed osgText with clipping I can only say I
don't see a reason in principle when it wouldn't work. If you put the
subgraphs you want to clip in a different subgraph you'll need to set
the GL_CLIP_PLANEi.

Robert.

On 28 March 2018 at 08:46, Ali Ozdin <> wrote:
Quote:
Hi Robert,

Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but all geometry in geodeForgeomRight works well except osgText geometries. Sample code is below:


Code:

osg::ClipNode* clipped_subgraph;
osg::ref_ptr<osg::Geode> geodeForgeomRight;

osg::ref_ptr<osgText::Text> bottomAltitudeText = new osgText::Text;
osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 0.0f);
std::string timesFont("fonts/arial.ttf");
bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
bottomAltitudeText->setFont(timesFont);
bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
bottomAltitudeText->setPosition(position);
bottomAltitudeText->setText("hello world" );
bottomAltitudeText->setCharacterSize(15.0);
geodeForgeomRight->addDrawable( bottomAltitudeText.get() );


osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
mt->addChild(geodeForgeomRight.get());

clipped_subgraph = new osg::ClipNode;
double xMin,yMin, zMin, xMax, yMax, zMax;
xMin = (SCREEN_WIDTH * 0.64);
yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
zMin = 0.0f;
xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
yMax = SCREEN_HEIGHT*0.6;
zMax = 0.0f;
osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
clipped_subgraph->createClipBox(bb);
clipped_subgraph->addChild(mt);

clipped_subgraph->setCullingActive(true);
mt->setUpdateCallback(new AltitudeCallBack());




Best regards,


robertosfield wrote:
Quote:
Hi Ali,
I haven't tested this specific combination of features, but in
principle it should be just a case of enabling the GL_CLIP_PLANEi mode
for the text subgraphs.

Which version of the OSG are you using and what GL versions?

The new osgText implementation in master/OSG-3.6 branch uses shaders
so out of the box, looking at the shader I don't see any setting of
the gl_ClipVertex so this could be a problem. I will look into this.

Robert.
_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

------------------
Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73188#73188








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


Joined: 28 Feb 2018
Posts: 16

PostPosted: Wed Mar 28, 2018 10:40 am    Post subject:
Re: Show part of geometry which intersects a specific area
Reply with quote

Hi Robert,

Did you examine my sample code?
I dont set mode GL_CLIP_PLANEi to my subgraph in the sample. I am only using createClipBox function like in the osgClip example.

Do you think sample code I have sent to you seems to work right?

If the sample code I have sent to you seems right; what is your advice?





robertosfield wrote:
Hi Ali,

When you put nodes underneath a ClipNode those nodes should inherit
the required GL_CLIP_PLANEi, so in theory it should work right,
however, as I've never mixed osgText with clipping I can only say I
don't see a reason in principle when it wouldn't work. If you put the
subgraphs you want to clip in a different subgraph you'll need to set
the GL_CLIP_PLANEi.

Robert.

On 28 March 2018 at 08:46, Ali Ozdin <> wrote:
Quote:
Hi Robert,

Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but all geometry in geodeForgeomRight works well except osgText geometries. Sample code is below:


Code:

osg::ClipNode* clipped_subgraph;
osg::ref_ptr<osg::Geode> geodeForgeomRight;

osg::ref_ptr<osgText::Text> bottomAltitudeText = new osgText::Text;
osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 0.0f);
std::string timesFont("fonts/arial.ttf");
bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
bottomAltitudeText->setFont(timesFont);
bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
bottomAltitudeText->setPosition(position);
bottomAltitudeText->setText("hello world" );
bottomAltitudeText->setCharacterSize(15.0);
geodeForgeomRight->addDrawable( bottomAltitudeText.get() );


osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
mt->addChild(geodeForgeomRight.get());

clipped_subgraph = new osg::ClipNode;
double xMin,yMin, zMin, xMax, yMax, zMax;
xMin = (SCREEN_WIDTH * 0.64);
yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
zMin = 0.0f;
xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
yMax = SCREEN_HEIGHT*0.6;
zMax = 0.0f;
osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
clipped_subgraph->createClipBox(bb);
clipped_subgraph->addChild(mt);

clipped_subgraph->setCullingActive(true);
mt->setUpdateCallback(new AltitudeCallBack());




Best regards,


robertosfield wrote:
Quote:
Hi Ali,
I haven't tested this specific combination of features, but in
principle it should be just a case of enabling the GL_CLIP_PLANEi mode
for the text subgraphs.

Which version of the OSG are you using and what GL versions?

The new osgText implementation in master/OSG-3.6 branch uses shaders
so out of the box, looking at the shader I don't see any setting of
the gl_ClipVertex so this could be a problem. I will look into this.

Robert.
_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

------------------
Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73188#73188








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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Wed Mar 28, 2018 10:53 am    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali.

On 28 March 2018 at 11:40, Ali Ozdin <> wrote:
Quote:
Did you examine my sample code?

I looked over you code but I have already replied to you on this. I
can't keep following you up on this, I have LOTS of other stuff to get
on with than just provide you with personal free support. I have
tried to help, pointed you in what I think is the right direction, but
this is all I have time for.

Robert.


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


Joined: 28 Feb 2018
Posts: 16

PostPosted: Wed Mar 28, 2018 11:08 am    Post subject:
Re: Show part of geometry which intersects a specific area
Reply with quote

Thank you Robert. Sorry for taking your time.

I think there is a bug in osg framework related to clipNode with osgText. Is there any issue tracking system that users can create a bug issue for this?

robertosfield wrote:
Hi Ali.

On 28 March 2018 at 11:40, Ali Ozdin <> wrote:
Quote:
Did you examine my sample code?

I looked over you code but I have already replied to you on this. I
can't keep following you up on this, I have LOTS of other stuff to get
on with than just provide you with personal free support. I have
tried to help, pointed you in what I think is the right direction, but
this is all I have time for.

Robert.


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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Wed Mar 28, 2018 3:47 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali,

On 28 March 2018 at 12:08, Ali Ozdin <> wrote:
Quote:
I think there is a bug in osg framework related to clipNode with osgText. Is there any issue tracking system that users can create a bug issue for this?

There is a chance that it's an OSG bug, but also still quite likely
something has gone astray at your end, it's hard to spot subtle errors
from looking at copy and pasted code rather than a full application
code.

The best way forward is to create an small test program that
reproduces the issue you have and the post this along with a
CMakeLists.txt to compile it easily - this will allow others to build
and run the test on their system to see if they can reproduce it. If
we can reproduce it then we should be able either spot an error in the
test code or use this as a unit test for hunting down the bug on the
OSG side.

Information on hardware, OS and build tools used at your end are also
useful when hunting down bugs (often bugs only appear on particular
hardware/OS/build combinations.)

You could post the example here on this thread, or post it to the
Issue tracker on our github repository.

https://github.com/openscenegraph/OpenSceneGraph/issues

Robert


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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Fri Mar 30, 2018 3:25 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Ali,

I had some time for looking into bugs this afternoon so I have
modified the osgclip example to allow one to pass in a osgText::Text
as the subgraph for clipping and this confirmed that clipping isn't
working for osgText::Text in the 3.4 branch.

osgclip --text MY_TEST

Is sufficient to run the new test. You'll need update to 3.4 banch,
3.6 branch or master to get this example. The commit that provides
the new test code is:

https://github.com/openscenegraph/OpenSceneGraph/commit/ddce3e0079e934bce13fd5350d9380a19ec15de2

I have done a review of the osgText::Text implementation in the 3.4
branch and can't see any where when clipping is explicitly disabled so
I'm surprised it's not functioning OK. Unfortunately I couldn't spot
any good lead to investigate, I can only guess that there is some
interaction with the way the the old osgText 3.4 code renders text
using a multi-pass approach where is toggles on/off the color mask and
depth writes. Without an obvious reason for failure I can't see a way
of resolving the problem for the 3.4 branch.

The test also failed with OSG master and the new OpenScenGraph-3.6
branch, but this was easy to fix as osgText implementation has been
almost completely rewritten since 3.4, and now uses shaders. The fix
was simply the add setting of the gl_ClipVertex into the shader and
then the everything works fine. The new osgText implementation
doesn't implement using lots of toggling of state or is saddled with
multi-pass approach so is cleaner, as well as provides better visual
quality and some new approaches such as using Signed Distance Function
(you need to enable this on osgText::Font to use it.)

The fix to the OpenSceneGraph-3.6 branch is:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

I also updated the OpenSceneGraph-Data as this contains the
shaders/text.vert this is embedded in the source of the osgText
library - which the above commit modifies.

As the OpenSceneGrpah-3.6.0 stable release is imminent, I would
suggest just moving to the 3.6 branch or the release candidate 3
branch I'll be making this afternoon, as this should resolve the
problem you are seeing.

Cheers,
Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Daniel Emminizer, Code...
Guest





PostPosted: Mon Apr 02, 2018 2:04 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Robert,

This morning I tried the OSG 3.6.0-rc3 tag and started getting errors. I tracked down the problem to the commit you reference in this email below:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

Specifically the shader lines:

#ifndef GL_ES
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
#endif


We're trying to target the graphics cards that are supporting OpenGL Core profile, but not a compatibility profile. When I run anything with text, I get awkward quads on the screen with various colors because this shader no longer compiles on the card. It was working with the 3.6.0-rc2.

My general configuration is configuring OSG with OPENGL_PROFILE="GLCORE", then running with environment variable "OSG_GL_CONTEXT_VERSION=3.3".

Unfortunately I do not have any suggestions on what to do in this case; I do not know offhand if there is a #ifdef that you can natively use to test, but I can say that GL_ES is not defined in this configuration. But I hope this email is helpful at least for testing the RC3 tag. If you have any ideas I'm happy to test out on my side.

Thanks,

- Dan


-----Original Message-----
From: osg-users [mailto:] On Behalf Of Robert Osfield
Sent: Friday, March 30, 2018 11:21 AM
To: OpenSceneGraph Users
Subject: Re: Show part of geometry which intersects a specific area

Hi Ali,

I had some time for looking into bugs this afternoon so I have modified the osgclip example to allow one to pass in a osgText::Text as the subgraph for clipping and this confirmed that clipping isn't working for osgText::Text in the 3.4 branch.

osgclip --text MY_TEST

Is sufficient to run the new test. You'll need update to 3.4 banch,
3.6 branch or master to get this example. The commit that provides the new test code is:

https://github.com/openscenegraph/OpenSceneGraph/commit/ddce3e0079e934bce13fd5350d9380a19ec15de2

I have done a review of the osgText::Text implementation in the 3.4 branch and can't see any where when clipping is explicitly disabled so I'm surprised it's not functioning OK. Unfortunately I couldn't spot any good lead to investigate, I can only guess that there is some interaction with the way the the old osgText 3.4 code renders text using a multi-pass approach where is toggles on/off the color mask and depth writes. Without an obvious reason for failure I can't see a way of resolving the problem for the 3.4 branch.

The test also failed with OSG master and the new OpenScenGraph-3.6 branch, but this was easy to fix as osgText implementation has been almost completely rewritten since 3.4, and now uses shaders. The fix was simply the add setting of the gl_ClipVertex into the shader and then the everything works fine. The new osgText implementation doesn't implement using lots of toggling of state or is saddled with multi-pass approach so is cleaner, as well as provides better visual quality and some new approaches such as using Signed Distance Function (you need to enable this on osgText::Font to use it.)

The fix to the OpenSceneGraph-3.6 branch is:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

I also updated the OpenSceneGraph-Data as this contains the shaders/text.vert this is embedded in the source of the osgText library - which the above commit modifies.

As the OpenSceneGrpah-3.6.0 stable release is imminent, I would suggest just moving to the 3.6 branch or the release candidate 3 branch I'll be making this afternoon, as this should resolve the problem you are seeing.

Cheers,
Robert.



------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Mon Apr 02, 2018 3:18 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

Hi Dan,

I think an addition of the __VERSION__ check to the text.vert shader
should be sufficient. I am doing a GL3 build to see if I can reproduce
the issue, once I have I'll figure out a fix in the shader.

Robert.

On 2 April 2018 at 14:58, Daniel Emminizer, Code 5773
<> wrote:
Quote:
Hi Robert,

This morning I tried the OSG 3.6.0-rc3 tag and started getting errors. I tracked down the problem to the commit you reference in this email below:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

Specifically the shader lines:

#ifndef GL_ES
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
#endif


We're trying to target the graphics cards that are supporting OpenGL Core profile, but not a compatibility profile. When I run anything with text, I get awkward quads on the screen with various colors because this shader no longer compiles on the card. It was working with the 3.6.0-rc2.

My general configuration is configuring OSG with OPENGL_PROFILE="GLCORE", then running with environment variable "OSG_GL_CONTEXT_VERSION=3.3".

Unfortunately I do not have any suggestions on what to do in this case; I do not know offhand if there is a #ifdef that you can natively use to test, but I can say that GL_ES is not defined in this configuration. But I hope this email is helpful at least for testing the RC3 tag. If you have any ideas I'm happy to test out on my side.

Thanks,

- Dan


-----Original Message-----
From: osg-users [mailto:] On Behalf Of Robert Osfield
Sent: Friday, March 30, 2018 11:21 AM
To: OpenSceneGraph Users
Subject: Re: Show part of geometry which intersects a specific area

Hi Ali,

I had some time for looking into bugs this afternoon so I have modified the osgclip example to allow one to pass in a osgText::Text as the subgraph for clipping and this confirmed that clipping isn't working for osgText::Text in the 3.4 branch.

osgclip --text MY_TEST

Is sufficient to run the new test. You'll need update to 3.4 banch,
3.6 branch or master to get this example. The commit that provides the new test code is:

https://github.com/openscenegraph/OpenSceneGraph/commit/ddce3e0079e934bce13fd5350d9380a19ec15de2

I have done a review of the osgText::Text implementation in the 3.4 branch and can't see any where when clipping is explicitly disabled so I'm surprised it's not functioning OK. Unfortunately I couldn't spot any good lead to investigate, I can only guess that there is some interaction with the way the the old osgText 3.4 code renders text using a multi-pass approach where is toggles on/off the color mask and depth writes. Without an obvious reason for failure I can't see a way of resolving the problem for the 3.4 branch.

The test also failed with OSG master and the new OpenScenGraph-3.6 branch, but this was easy to fix as osgText implementation has been almost completely rewritten since 3.4, and now uses shaders. The fix was simply the add setting of the gl_ClipVertex into the shader and then the everything works fine. The new osgText implementation doesn't implement using lots of toggling of state or is saddled with multi-pass approach so is cleaner, as well as provides better visual quality and some new approaches such as using Signed Distance Function (you need to enable this on osgText::Font to use it.)

The fix to the OpenSceneGraph-3.6 branch is:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

I also updated the OpenSceneGraph-Data as this contains the shaders/text.vert this is embedded in the source of the osgText library - which the above commit modifies.

As the OpenSceneGrpah-3.6.0 stable release is imminent, I would suggest just moving to the 3.6 branch or the release candidate 3 branch I'll be making this afternoon, as this should resolve the problem you are seeing.

Cheers,
Robert.




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


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Mon Apr 02, 2018 3:29 pm    Post subject:
Show part of geometry which intersects a specific area
Reply with quote

On 2 April 2018 at 16:13, Robert Osfield <> wrote:
Quote:
Hi Dan,

I think an addition of the __VERSION__ check to the text.vert shader
should be sufficient. I am doing a GL3 build to see if I can reproduce
the issue, once I have I'll figure out a fix in the shader.

I have checked in a fix to master and 3.6 branch:

/https://github.com/openscenegraph/OpenSceneGraph/commit/6c055e34003312d54ffde87b881d71080361041b

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
Goto page 1, 2  Next
Page 1 of 2

 
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 osg::Drawable vs osg::Geometry NoeMurr General 2 Sun Oct 21, 2018 2:45 pm View latest post
No new posts [HELP] Properly using osg::VertexAttr... ppsychrite General 3 Wed Aug 01, 2018 12:17 pm View latest post
No new posts [Crash issue] How to add&remove d... pwang General 2 Thu Jul 26, 2018 10:10 am View latest post
No new posts How to setup Msvcp2013 so that header... peter_k General 1 Tue Jul 03, 2018 3:14 pm View latest post
No new posts Draw geometry on demand sergio2k18 General 5 Sun Jun 10, 2018 7:53 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