Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-11-02 Thread stefan nortd
I think I have solved the issue. It turns out that if I simply set a render bin 
index on all my nodes that contain an osgText, things work as expected. 
Surprisingly I don't need to set the osg::StateSet::OVERRIDE_RENDERBIN_DETAILS.

I would assume this is normal behavior. I think my main error was to assume 
that osg preserves the order of nodes when depth testing is switched off.

At the moment I have a unique z-value/render bin index on all of my nodes. It's 
a bit inelegant because I need to do reassign this z value to all my nodes 
whenever I add or remove nodes. 

I think I will try to assign this z value only within each geode. I think this 
is possible because render bins are nested. Not sure yet how this will work 
then with my ray intersection--how I can determine the order my widgets are hit 
by the ray ... anyhow i will try to report back if I have a good solution for 
making this a bit more elegant.

Thanks for the help,
Thanks for the hint that I might be missing a plugin for writing out text 
drawables to the osg file,

/stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-26 Thread Paul Martz

stefan nortd wrote:
> How does this look like ...

I would put the StateSet with the override flag all the way at the 
topmost Group in your UI, above all the Text and above all the other 
geometry you're drawing with the text.


> The one drawable is the osgText. I am also :O  new to writing osg 
files ... couldn't get it to write the drawable to file.


You don't need to do anything special to get the Drawable output. The 
fact that you are not getting the Drawable output would indicate that 
OSG can't find the .osg plugin for osgText. Perhaps you have a bad install.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ 
+1 303 859 9466




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-26 Thread stefan nortd
How does this look like ...


Code:

PositionAttitudeTransform {
  UniqueID PositionAttitudeTransform_15
  nodeMask 0x
  cullingActive TRUE
  StateSet {
UniqueID StateSet_16
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_LIGHTING OFF
GL_DEPTH_TEST OFF
  }
  referenceFrame RELATIVE
  position 0 0 0
  attitude 0 0 0 1
  scale 1 1 1
  pivotPoint 0 0 0
  num_children 1
  Geode {
UniqueID Geode_17
UserData {
  NodeCallback {
name "MyTextfield"
  }
}
nodeMask 0x
cullingActive TRUE
StateSet {
  UniqueID StateSet_18
  rendering_hint DEFAULT_BIN
  renderBinMode OVERRIDE
  binNumber 1
  binName RenderBin
}
num_drawables 1
  }
}




The one drawable is the osgText. I am also :O  new to writing osg files ... 
couldn't get it to write the drawable to file.

(Paul, I am still working on the minimal example)
Thank you!

Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-26 Thread Paul Martz
Better idea -- Write out the subgraph that draws your text -- and also 
contains the override render bin bit, to a .osg file and post here or 
email me. I'll take a look to see if the render bin details are set 
correctly.

   -Paul



Paul Martz wrote:
Are you setting this StateSet on the parent Group or Geode above all 
your Text? If so, it should work. If it's not working, then this should 
be investigated and resolved. I'd advise creating a very simple scene 
graph that appears to reproduce the behavior, and stepping through the 
CullVisitor to find out why it is changing RenderBins even though a 
parent scene graph has set the override bit.


(For more information on RenderBins in general, search the mail list. I 
almost hate to advise this, as the info is scattered all over the place, 
and you'll need to do a lot of digging and reading. But it has been 
discussed multiple times in the past, and I don't have the cycles to 
regurgitate the salient info at the moment.)


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ 
+1 303 859 9466



stefan nortd wrote:

Thanks Paul, Jeremy,

So after some contemplation I am pretty sure I want to use the 
painter's layering. The reason is that if  for example I want to 
rotate a panel in front of another one I don't want it to intersect 
with panals behind it. I could use orthographic projection and 
dynamically change the z distances
 based on bounding box but this just seems overkill if I could just 
disable depth testing.  I just want it 2.5D--looking 3D but layering 2D.
So I tried forcing the osgText in a the opaque render bin with the 
following

 but without much luck.

 mytextstateset->setRenderBinDetails(0, "RenderBin", 
osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);


Is there something else I need to do other than that?  If I understand 
correctly there are two default bins--"RenderBin" and 
"DepthSortedBin". Former is sorted based on the binNum, latter based 
on the depth.


I guess what I don't understand is how does the binNum realate to the 
other items in the default bin. I know they are rendered in the order 
they are added to the scene. How to they relate to the binNum? Still a 
bit confused.
Will read some more of the osg source code but let me know if you guy 
know what I am doing wrong.


Thank you!

Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-26 Thread Paul Martz
Are you setting this StateSet on the parent Group or Geode above all 
your Text? If so, it should work. If it's not working, then this should 
be investigated and resolved. I'd advise creating a very simple scene 
graph that appears to reproduce the behavior, and stepping through the 
CullVisitor to find out why it is changing RenderBins even though a 
parent scene graph has set the override bit.


(For more information on RenderBins in general, search the mail list. I 
almost hate to advise this, as the info is scattered all over the place, 
and you'll need to do a lot of digging and reading. But it has been 
discussed multiple times in the past, and I don't have the cycles to 
regurgitate the salient info at the moment.)


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ 
+1 303 859 9466



stefan nortd wrote:

Thanks Paul, Jeremy,

So after some contemplation I am pretty sure I want to use the painter's 
layering. The reason is that if  for example I want to rotate a panel in 
front of another one I don't want it to intersect with panals behind it. I 
could use orthographic projection and dynamically change the z distances
 based on bounding box but this just seems overkill if I could just disable 
depth testing.  I just want it 2.5D--looking 3D but layering 2D. 


So I tried forcing the osgText in a the opaque render bin with the following
 but without much luck.

 mytextstateset->setRenderBinDetails(0, "RenderBin", 
osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);

Is there something else I need to do other than that?  If I understand 
correctly there are two default bins--"RenderBin" and "DepthSortedBin". 
Former is sorted based on the binNum, latter based on the depth.


I guess what I don't understand is how does the binNum realate to the 
other items in the default bin. I know they are rendered in the order they 
are added to the scene. How to they relate to the binNum? Still a bit 
confused. 

Will read some more of the osg source code but let me know if you guy 
know what I am doing wrong.


Thank you!

Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-26 Thread stefan nortd
Thanks Paul, Jeremy,

So after some contemplation I am pretty sure I want to use the painter's 
layering. The reason is that if  for example I want to rotate a panel in 
front of another one I don't want it to intersect with panals behind it. I 
could use orthographic projection and dynamically change the z distances
 based on bounding box but this just seems overkill if I could just disable 
depth testing.  I just want it 2.5D--looking 3D but layering 2D. 

So I tried forcing the osgText in a the opaque render bin with the following
 but without much luck.

 mytextstateset->setRenderBinDetails(0, "RenderBin", 
osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);

Is there something else I need to do other than that?  If I understand 
correctly there are two default bins--"RenderBin" and "DepthSortedBin". 
Former is sorted based on the binNum, latter based on the depth.

I guess what I don't understand is how does the binNum realate to the 
other items in the default bin. I know they are rendered in the order they 
are added to the scene. How to they relate to the binNum? Still a bit 
confused. 

Will read some more of the osg source code but let me know if you guy 
know what I am doing wrong.

Thank you!

Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-25 Thread Paul Martz

stefan nortd wrote:
It would mean to layer the panels 
close together so their size is not affected and still far enough away from

 each other to not run into depth buffer resolution issues.


Is there a reason you are using a perspective projection? This would not 
be an issue with an orthographic projection.


Any ideas about doing the z position assignments with nested 
panels/widgets?


The better way to go is to override the render bin so that the Text 
stays in the same render bin as the rest of your geometry.

   -Paul
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-25 Thread stefan nortd
Hey Paul, Jeremy,

So, text is in the transparent RenderBin. Hmm that makes sense. I was 
hoping there is simple explanation. I guess I could use depth testing. The 
main problem I had with this was to come up with a fairly simple 
algorithm to determine the z position. It would mean to layer the panels 
close together so their size is not affected and still far enough away from
 each other to not run into depth buffer resolution issues. An added 
complication is that any panel may nest other panel/widgets on the fly 
further making it harder to get the z distances right. I tried to roll my own 
algo for this but it became it gathered too many uncertainties. So I opted 
for the painter's algo.

Any ideas about doing the z position assignments with nested 
panels/widgets?


Jeremy, osgWidget looks cool. I might end up using once I have a good 
grip on it. Usually implementing my own is a way for me to learn. 

Do you think it would be easy to adapt it for multi pointer/touch, doing 
non-axis aligned windowing, and extending it for custom/experimental 
widgets like two finger painting brushes?


Best,
stefan


stefan hechenberger

http://linear.nortd.com

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-24 Thread Paul Martz
osgText::Text uses a font texture map with alpha values to encode the 
glyph, and text is drawn as a textured quad with blending enabled.


Because of the use of alpha and blending, osgText::Text implicitly 
places text quad geometry in the transparent RenderBin. This is what you 
typically want for any kind of translucent rendering -- unless you've 
disabled depth and are using painter's algorithm, like you are doing.


You could turn depth test on and let depth handle the layering.

If you want to continue to use painter's algorithm, then you need to 
force the Text into the opaque bin. See StateSet::setRenderBinDetails 
for the various options; you should find a flag there that tells the 
CullVisitor to not switch to another bin as it traverses the subgraph 
during cull. You'd just need to set the render bin to the default bin, 
and add this override flag, at some Group node above your Text. If you 
do this correctly, the Text request to be placed in the transparent bin 
will be ignored by the CullVisitor.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ 
+1 303 859 9466



stefan nortd wrote:

Hi,

I am working on a widget system and have problems with how osgText:Text
 is layered. My text always ends up above the geometry. 

I have a root node that has depth testing disabled. Under it is a hierachy 
of rectangle-like panels. Some of them have text labels. All my geometry 
layers as expected but the text always stays in front of everything else.


Text with text layers correctly too.

Any ideas why this happens?


Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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










___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] layering of text and geometry in a 2.5D setup

2009-10-24 Thread Jeremy Moles
On Sat, 2009-10-24 at 20:59 +, stefan nortd wrote:
> Hi,
> 
> I am working on a widget system and have problems with how osgText:Text
>  is layered. My text always ends up above the geometry. 
> 
> I have a root node that has depth testing disabled. Under it is a hierachy 
> of rectangle-like panels. Some of them have text labels. All my geometry 
> layers as expected but the text always stays in front of everything else.
> 
> Text with text layers correctly too.
> 
> Any ideas why this happens?

osgWidget failed to be sufficient?

I can help you with this, of course (since I solved it in osgWidget),
but I'd be interested in knowing what it's missing that you wanted to
write you own. :)

> Cheers,
> stefan
> 
> 
> stefan hechenberger
> 
> http://linear.nortd.com
> 
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=18661#18661
> 
> 
> 
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-- 
Follow us on Twitter! http://twitter.com/emperorlinux

+-+
| Jeremy Moles |  Phone:1-888-651-6686|
| Research & Development   |  in GA:(770)-612-1205|
|EmperorLinux, Inc.|  Fax:  (770)-612-1210|
|900 Circle 75 Pkwy.   |  web:  www.EmperorLinux.com  |
|Suite 1380|  support:  supp...@emperorlinux.com  |
|Atlanta, GA 30339 |  email:jer...@emperorlinux.com   |
+-+

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] layering of text and geometry in a 2.5D setup

2009-10-24 Thread stefan nortd
Hi,

I am working on a widget system and have problems with how osgText:Text
 is layered. My text always ends up above the geometry. 

I have a root node that has depth testing disabled. Under it is a hierachy 
of rectangle-like panels. Some of them have text labels. All my geometry 
layers as expected but the text always stays in front of everything else.

Text with text layers correctly too.

Any ideas why this happens?


Cheers,
stefan


stefan hechenberger

http://linear.nortd.com

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



<>___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org