[osg-users] Floating point FBO Instancing texture

2014-04-02 Thread Paul Pocock

Hi all,

I'm instancing geometry using a floating point texture containing 
worldspace positions. The position texture and instancing work. 
Resolution is constant at 1024x768



Now I'm trying to use a FBO (pre-render) to write to a position texture 
and use that in the instancing shader (It will later be used for 
updating positions)

It doesn't work..
I'm using the exact same data in the FBO texture cos I'm passing the 
original floating point texture into the fbo shader and setting 
gl_FragData[0]. The instance shaders are simple and take the FBO texture.



I am not familiar with fbo's. Should I set the RTT camera with a scene? 
is there another way to write to images using shaders without fbo's?


I'm calling dirty() on the image with a callback (not sure if necessary 
with FBO)


Have included code below for the main setup and important shader fbo pass.

Thanks for any help..
P


vertex
--


passthrough vert shader



fragment


#version 400 compatibility

uniform sampler2D positionTexture;
uniform float time;

void main(void)
{
vec4 position = texture2D(positionTexture, gl_TexCoord[0].xy);
gl_FragData[0] = position;
}



Main setup:
---

positionimage = create2DImage(Positions.tiff);
updatepositionimage = create2DImage(Positions.tiff);

//Textures used in
positionTexture = createFloatTexture(positionimage-s(), 
positionimage-t());
newPositionTexture = createFloatTexture(updatepositionimage-s(), 
updatepositionimage-t());



rttCamera = createRTTCamera( positionimage-s(), positionimage-t());
//Textures sent to the instancing shader
rttCamera-attach( osg::Camera::COLOR_BUFFER0, positionTexture );
rttCamera-attach( osg::Camera::COLOR_BUFFER1, directionTexture);


rttCamera-addChild( scene );


Creating RTT Camera:
-



osg::Camera* createRenderTTCamera( int width, int height )
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setClearColor( osg::Vec4(0.5,0.5,0.5,1.0) );
camera-setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
camera-setRenderTargetImplementation( 
osg::Camera::FRAME_BUFFER_OBJECT );

camera-setRenderOrder( osg::Camera::PRE_RENDER );

camera-setViewport( 0, 0, width, height);


  return camera.release();
}



Creating FBO texture:
-



osg::Texture2D* createFBOFloatTexture(unsigned int width, unsigned int 
height)

{
osg::ref_ptrosg::Texture2D texture = new osg::Texture2D;
texture-setTextureSize( width, height );
texture-setDataVariance(osg::Object::DYNAMIC);
texture-setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT);
texture-setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT);
texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
texture-setInternalFormat( GL_RGBA32F_ARB );
texture-setSourceFormat( GL_RGBA );
texture-setSourceType( GL_FLOAT );
texture-setResizeNonPowerOfTwoHint(false);
return texture.release();
}




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


Re: [osg-users] Composite Viewer framerate multiple cameras on large data

2014-04-02 Thread Robert Osfield
HI Nick,

What type of frame rate do you get when running on a single window vs
multiple windows?

What do the frame stats suggest for what is the bottleneck?

Sharing context won't help as it'll force you to use single threaded
viewer.  There might be other routes though, so as just using one context
with mulitple viewports on it so you can still have your multiple views.

Robert.


On 1 April 2014 19:05, Nick Modly modly.n...@gmail.com wrote:

 Hi,

 I have a scene graph set up with a large dataset ( A Geocentric Earth from
 osgEarth). In my composite viewer, I want to have multiple viewpoints (with
 separate camera manipulators/projection matrices; ie. an Orthographic,
 perspective, etc) each within a QT widget.

 I got this set up the way I wanted it by following the osgViewerQt
 example, using the CullDrawThreadPerContext threading model, but the
 framerate is pretty low.

 Are there any tricks I can do to improve the performance? Sharing graphics
 contexts, etc?


 Thank you!

 Cheers,
 Nick

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





 ___
 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] Easy blur effect with HUD Camera?

2014-04-02 Thread Petr Svoboda
Hi,

I would like to make something like menu using overlaying HUD Camera with 
background blurred.

Code:
http://rk.md/wp-content/uploads/2012/08/2012-08-18_4.jpg


- something like this but with sharp / focused scoreboard but everything 
else blurred

How to do it?


I tried osgmotionblur example with  these opengl hacks but the problem is 
that if I don't use dedicated GPU (Nvidia) and using integrated Intel GPU then 
there is no blur effect but many OpenGL errors.

So, Is there any easier method/hack to make the background blurry or 
blurry-like?

Pictures:
before

Code:
http://imgur.com/EII7vZG,IUz5wAa



after (using Photoshop Gaussian blur )

Code:
http://imgur.com/EII7vZG,IUz5wAa#1





 

Thank you!

Cheers,
Petr

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





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


Re: [osg-users] Easy blur effect with HUD Camera?

2014-04-02 Thread Sebastian Messerschmidt

Hi Petr,

You will have to render your scene to texture (RTT) and perform a 
shader-blur pass before displaying it in the viewer.
Look at the render to texture example and the shader examples. Finding a 
blur shader should be easy with most search websites, or in the osgPPU 
examples.


So effectively:

1. Render scene to Texture1
2. Run blur pass on Texture1 and display Result in Framebuffer or write 
to Texture2
3. If Framebuffer - draw hud above, else draw Fullscreen-Quad with 
Texture2 and draw HUD afterwards




This will also work on Intel cards with OpenGL 2.0 (i even think it is 
possible on 1.5)




Hi,

I would like to make something like menu using overlaying HUD Camera with 
background blurred.

Code:
http://rk.md/wp-content/uploads/2012/08/2012-08-18_4.jpg


- something like this but with sharp / focused scoreboard but everything 
else blurred

How to do it?


I tried osgmotionblur example with  these opengl hacks but the problem is that if I 
don't use dedicated GPU (Nvidia) and using integrated Intel GPU then there is no blur 
effect but many OpenGL errors.

So, Is there any easier method/hack to make the background blurry or 
blurry-like?

Pictures:
before

Code:
http://imgur.com/EII7vZG,IUz5wAa



after (using Photoshop Gaussian blur )

Code:
http://imgur.com/EII7vZG,IUz5wAa#1





  


Thank you!

Cheers,
Petr

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





___
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] GeometryTechnique and texture coordinates

2014-04-02 Thread Sebastian Messerschmidt

Hi,

I have geocentric dataset (which is already compiled with osgDEM) and 
I'm facing an issue.
In my shaders I rely on valid texture coordinates for tangentSpace 
generation and various other effects like detail-splatting.
Unfortunately (and quite obvious due to performance restrictions) the 
GeometryTechnique will not create texture coordinates for Terrain tiles 
without textures.
Due to missing LandSat-data at this areas, there are no images for those 
areas.


(see around line 484 in GeometryTechnique.cpp)

I wonder if there are any other options than
a) modifying the VertexNormalGenerator::populateCenter function to 
create texture coordinates anyways
b) Overriding the GeometryTechnique to use a custom 
VertexNormalGenerator which clones the functionality of the original one 
+ adding texture coordinates for tiles without ImageLayer.


Since the dataset is quite big, so recompiling it is out of the question 
right now.
Also it would be a performance killer to traverse the TerrainTile 
manually and re-add some fake image layer.


My idea would be to change the vertexNormalGenerator to optionally 
create texture coordinates. But I don't have an idea yet how to get this 
option into it.


Any hints, ideas?


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


Re: [osg-users] GeometryTechnique and texture coordinates

2014-04-02 Thread Robert Osfield
Hi Sebastian,

osgTerrain is designed to allow you to override the TerrainTechnique
attached to the TerrainTile via the Terrain node that can be used to
decorate the terrain.  The
Terrain::setTerrainTechniquePrototype(TerrainTechinque*) is used to set the
TerrainTechnique that tiles should use.

By default osgTerrain will use the GeometryTechnique but you provide your
own implementation or subclass from GeometryTechnique.

Robert.


On 2 April 2014 15:38, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de wrote:

 Hi,

 I have geocentric dataset (which is already compiled with osgDEM) and I'm
 facing an issue.
 In my shaders I rely on valid texture coordinates for tangentSpace
 generation and various other effects like detail-splatting.
 Unfortunately (and quite obvious due to performance restrictions) the
 GeometryTechnique will not create texture coordinates for Terrain tiles
 without textures.
 Due to missing LandSat-data at this areas, there are no images for those
 areas.

 (see around line 484 in GeometryTechnique.cpp)

 I wonder if there are any other options than
 a) modifying the VertexNormalGenerator::populateCenter function to create
 texture coordinates anyways
 b) Overriding the GeometryTechnique to use a custom VertexNormalGenerator
 which clones the functionality of the original one + adding texture
 coordinates for tiles without ImageLayer.

 Since the dataset is quite big, so recompiling it is out of the question
 right now.
 Also it would be a performance killer to traverse the TerrainTile manually
 and re-add some fake image layer.

 My idea would be to change the vertexNormalGenerator to optionally create
 texture coordinates. But I don't have an idea yet how to get this option
 into it.

 Any hints, ideas?


 ___
 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] GeometryTechnique and texture coordinates

2014-04-02 Thread Sebastian Messerschmidt

Hi Robert,

Thanks for the quick response. This means a lot of code duplication and 
I guess I will have to traverse every tile for Terrain nodes.


I'll check it and see how it works out.

cheers
Sebastian

Hi Sebastian,

osgTerrain is designed to allow you to override the TerrainTechnique 
attached to the TerrainTile via the Terrain node that can be used to 
decorate the terrain.  The 
Terrain::setTerrainTechniquePrototype(TerrainTechinque*) is used to 
set the TerrainTechnique that tiles should use.


By default osgTerrain will use the GeometryTechnique but you provide 
your own implementation or subclass from GeometryTechnique.


Robert.


On 2 April 2014 15:38, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de 
mailto:sebastian.messerschm...@gmx.de wrote:


Hi,

I have geocentric dataset (which is already compiled with osgDEM)
and I'm facing an issue.
In my shaders I rely on valid texture coordinates for tangentSpace
generation and various other effects like detail-splatting.
Unfortunately (and quite obvious due to performance restrictions)
the GeometryTechnique will not create texture coordinates for
Terrain tiles without textures.
Due to missing LandSat-data at this areas, there are no images for
those areas.

(see around line 484 in GeometryTechnique.cpp)

I wonder if there are any other options than
a) modifying the VertexNormalGenerator::populateCenter function to
create texture coordinates anyways
b) Overriding the GeometryTechnique to use a custom
VertexNormalGenerator which clones the functionality of the
original one + adding texture coordinates for tiles without
ImageLayer.

Since the dataset is quite big, so recompiling it is out of the
question right now.
Also it would be a performance killer to traverse the TerrainTile
manually and re-add some fake image layer.

My idea would be to change the vertexNormalGenerator to optionally
create texture coordinates. But I don't have an idea yet how to
get this option into it.

Any hints, ideas?


___
osg-users mailing list
osg-users@lists.openscenegraph.org
mailto: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] GeometryTechnique and texture coordinates

2014-04-02 Thread Robert Osfield
On 2 April 2014 15:55, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de wrote:

  Hi Robert,

 Thanks for the quick response. This means a lot of code duplication and I
 guess I will have to traverse every tile for Terrain nodes.


No, the design is meant that your just assign your custom TerrainTechnique
to the Terrain node that decorates the terrain scene graph.

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


Re: [osg-users] osgLeap Leap Motion Integration

2014-04-02 Thread Johannes Scholz
Hi Mathieu,

nice to hear you find osgLeap useful.

Please make a zip of all osgLeap files you checked out including all changed. I 
will make a diff to check for changes.

What version/revision did you check out and what were the difficulties you had?

Thank you!

Cheers,
Johannes

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





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


Re: [osg-users] Easy blur effect with HUD Camera?

2014-04-02 Thread Paul Martz
If you're not picky about the blur quality, just render to a texture that
is 1/16th the size of your screen (1/4 width x 1/4 height), then apply the
texture to a fullscreen quad with GL_LINEAR filtering. This can be
accomplished with OpenGL v1.0 functionality and should be fast and
well-supported on all graphics cards.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org