Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Where is CreateContextAttribs() being used?

2019-04-11 Thread Sebastian Messerschmidt
Merlin,

 

As Chris already mentioned the complete application needs to run on 
core-profile. That means there is no fixed function pipeline and no 
backward-compatibility features.

In order to get your application running in core-profile you need to write 
shaders for everything and IIRC compile OSG with GL3 enabled. I haven’t used 
OSG in a while now, but I think there is mechanism to decorate the scene graph 
with shaders automatically. 

 

I started to refactor my project some years ago to fully support core-only 
scenarios, but I gave up due to a lot features no longer working out-of-the-box.

Can you maybe try to explain what you’re trying to debug? There might be some 
more options for you. 

 

 

Cheers

Sebastian 

 

From: osg-users  On Behalf Of 
Rowley, Marlin R
Sent: Donnerstag, 11. April 2019 16:24
To: OpenSceneGraph Users 
Subject: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

 

Sebastian,

 

What does “core OpenGL profile” mean with regards to the graphics context?  I’m 
still not getting it to work.  

 

Here is my code structure:

 

…

osg::ref_ptr traits = new 
osg::GraphicsContext::Traits;

traits->x = aXPosition;

traits->y = aYPosition;

traits->width  = aWidth;

traits->height = aHeight;

traits->stencil = 8;

traits->doubleBuffer = true;

traits->windowDecoration = false;

#if defined(WIN32)

traits->inheritedWindowData = new 
osgViewer::GraphicsWindowWin32::WindowData( aWindow );

#elif defined(__linux__)

   traits->inheritedWindowData = new 
osgViewer::GraphicsWindowX11::WindowData( aWindow );

#endif

// gl graphics context version and profile mask

traits->glContextVersion = "3.3";

traits->glContextProfileMask = 0x1;

 

// create the graphics window from the context

osgViewer::GraphicsWindow* gw = 
dynamic_cast(osg::GraphicsContext::createGraphicsContext(traits.get()));

 

…

 

// set the main camera to use the window

mainCamera->setGraphicsContext( gw );

 

…

 

I assume here that setting the traits variable with the major/minor version of 
OpenGL and setting the profile mask to 1 (‘core’??) would be all I need.  But 
that’s obviously not the case.

 

-M

 



Marlin Rowley

Software Engineer, Staff



Missiles and Fire Control

972-603-1931 (office)

214-926-0622 (mobile)

  marlin.r.row...@lmco.com

 

From: osg-users mailto:osg-users-boun...@lists.openscenegraph.org> > On Behalf Of 
sebastian.messerschm...@gmx.de  
Sent: Thursday, April 11, 2019 9:01 AM
To: 'OpenSceneGraph Users' mailto:osg-users@lists.openscenegraph.org> >
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

 

Hi Marlin,

 

In order for RenderDoc (and most tools I’m aware of) you’re application needs 
to run on core OpenGL profile.

You might want to look here for some debugging options: 
https://www.khronos.org/opengl/wiki/Debugging_Tools

I personally used Nvidia Nsight for quite a while, as it at least helps with 
framebuffer debugging etc.

 

Cheers

Sebastian 

 

 

From: osg-users mailto:osg-users-boun...@lists.openscenegraph.org> > On Behalf Of Rowley, 
Marlin R
Sent: Donnerstag, 11. April 2019 14:52
To: OpenSceneGraph Users mailto:osg-users@lists.openscenegraph.org> >
Subject: Re: [osg-users] EXTERNAL: Re: Where is CreateContextAttribs() being 
used?

 

We are using Win10-x64.

 

We are trying to get RenderDoc to be able to see our application so we can do 
some graphics debugging.  It’s shouting back that the current device context 
wasn’t created using CreateContextAttrib, so I started looking. So since we are 
using Win64, doesn’t look like osg will go the WindowWin32 route. Hmm…

 

How are you debugging the GPU?  It’s incredibly difficult trying to solve 
realtime pipeline problems without the use of a graphics debugger.

 



Marlin Rowley

Software Engineer, Staff



Missiles and Fire Control

972-603-1931 (office)

214-926-0622 (mobile)

  marlin.r.row...@lmco.com

 

From: osg-users mailto:osg-users-boun...@lists.openscenegraph.org> > On Behalf Of Robert 
Osfield
Sent: Thursday, April 11, 2019 7:16 AM
To: OpenSceneGraph Users mailto:osg-users@lists.openscenegraph.org> >
Subject: EXTERNAL: Re: [osg-users] Where is CreateContextAttribs() being used?

 

Hi Marlin,

 

A great for CreateContextttribs in the OSG shows:

 

$ grep -r CreateContextAttribs .
Binary file ./lib/libosgViewer.so.3.6.4 matches
Binary file ./src/osgViewer/CMakeFiles/osgViewer.dir/GraphicsWindowX11.cpp.o 
matches
./src/osgViewer/GraphicsWindowX11.cpp:typedef GLXContext 
(*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, 
const int*);

Re: [osg-users] Value of a variable in shaders?

2018-09-28 Thread Sebastian Messerschmidt

Hi,

Usually you can use the output-colors in case of a fragment shader to 
inspect the values per fragment. Rendering to a texture and inspecting 
the values in the image is also an option.


Another approach to display incoming/per state values is this nifty shader:

http://mew.cx/drawtext/drawtext.html

Appart from this, in case you're using a modern Nvidia-GPU and 
Visual-Studio:


https://developer.nvidia.com/nsight-visual-studio-edition

Cheers
Sebastian



Am 27.09.2018 um 20:14 schrieb Rowley, Marlin R:

All,

Is there a way to examine variable values in shader code? I can’t figure 
out this problem that we are having unless I can see the values in the 
shaders.


Any help would be appreciated



Marlin Rowley

Software Engineer, Staff

cid:image002.jpg@01D39374.DEC5A2E0

/Missiles and Fire Control/

972-603-1931 (office)

214-926-0622 (mobile)

marlin.r.row...@lmco.com 



___
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] [forum] My questions are stuck on [Topic is awaiting approval]?

2018-07-28 Thread Sebastian Messerschmidt
Hi,

As mentioned in this thread 
http://forum.openscenegraph.org/viewtopic.php?t=2525 you need to change your 
username to something human-readable. Unfortunately many people including 
yourself don't register with a email address they don't check on a regular 
base. Else they would get my emails reminding them to change their names before 
getting approved. 


... 


Thank you!

Cheers[ur,
Sebastian[/url]

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





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


Re: [osg-users] [forum] Disable auto rotating

2018-07-16 Thread Sebastian Messerschmidt

Hi Lin,

Your question is simply to vague to make any sense. Can you elaborate, 
what you mean by "auto-rotate"? Do you mean the mouse-interaction via 
controller? In this case you might want to take a look into the 
implementation of the controller you use (Trackball?)


Cheers
Sebastian

Am 10.07.2018 um 08:25 schrieb lin hui:

Hi,

A small question.The model may auto rotate after I rotate it, how could I
disable it?

Thank you!

Cheers,
lin

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





___
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] Graphics context issues

2018-07-10 Thread Sebastian Messerschmidt

Windows tells me:

Screen 0:
Windows Error #170: [Screen #0] 
GraphicsWindowWin32::makeCurrentImplementation() - Unable to set current 
OpenGL rendering context. Reason: The requested resource is in use.


If I move your code into the callback it displays the correct 
information however. Tested on Windows7:


Vendor: NVIDIA Corporation
Renderer: GeForce GTX TITAN Black/PCIe/SSE2
GL Version: 4.5.0 NVIDIA 372.90


Tested on Windows 10 (Nvidia Optimus) as well. The output in the console 
is fine, but I see invalid rendering too.
Intel drivers aren't known to be a good reference for OpenGL 
implementations, so I'd stick to Robert's advice and go for a 
shader-based approach.


Cheers
Sebastian



Am 10.07.2018 um 10:39 schrieb Ryan Thoryk:


SMesserschmidt wrote:

Hi Ryan,
Can you create a minimal _compilable_ example, so more people might
check what is wrong?




Sure - I've attached an osglight-derived example.  Compile with:

Code:

g++ -o osglight osglight.cpp -losg -lOpenThreads -lGL -losgUtil -losgViewer 
-losgDB




Ryan
[/code]

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




Attachments:
http://forum.openscenegraph.org//files/osglight_161.cpp


___
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] Graphics context issues

2018-07-10 Thread Sebastian Messerschmidt

Hi Ryan,

Your code works when my laptop is using Intel graphics, but when I switch to 
Nvidia graphics, the glGetString calls fail for some reason (maybe the GL 
context isn't switching?).  Strange.
Switching the whole app to single-threaded works for both.


That's indeed strange. The snippet I provided might not do all the 
necessary checks however. I use a similar piece of code in my projects 
to ensure compatibility and it worked on a wide range of GPU/driver 
combinations at least on Windows and Mac-Platforms.


Can you create a minimal _compilable_ example, so more people might 
check what is wrong?


Cheers
Sebastian




Ryan

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





___
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] Graphics context issues

2018-07-09 Thread Sebastian Messerschmidt



Hi Ryan,

I guess your interfering with the currently set context. You're not 
explaining where/when you call your snippet, but usually this would be 
done inside a "realizeOperation".


A small example operation:


class TestSupportOperation: public osg::GraphicsOperation
{
public:

TestSupportOperation()
: osg::GraphicsOperation("TestSupportOperation",false){}

virtual void operator () (osg::GraphicsContext* gc)
{
OpenThreads::ScopedLock lock(mMutex);
unsigned int contextID =gc->getState()->getContextID(); 
  

osg::GLExtensions* glext = osg::GLExtensions::Get(contextID, 
true);
if (!glext->isOpenGL20Supported)
{
std::cerr << No 2.0++ suppport available\n";
}
}
OpenThreads::Mutex  mMutex;
};


In your viewer you simply add:

viewer->setRealizeOperation(new TestSupportOperation);


Hope that helps,
Sebastian





Hi,

I'm trying to query GL parameters such as GL_VENDOR, which require an active 
graphics context to work.  I looked another thread on this forum which explains 
how to do it, but it only works for a single-threaded viewer.  I'm running the 
viewer in multithreaded mode, and am getting crashes due to context issues.  
Does anyone have an idea on how to do this?
Thanks

Example code.  Usually crashes at the makeCurrent() line:

Code:

//get renderer information
osgViewer::ViewerBase::Contexts contexts;
viewer->getContexts(contexts, true);
contexts[0]->makeCurrent();
std::string vendor = (const char*)glGetString(GL_VENDOR);
Report("Vendor: " + vendor);
contexts[0]->releaseContext();




Ryan

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





___
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] [forum] Android can't build osgdb_png

2018-07-05 Thread Sebastian Messerschmidt

Hi lin,

It would  be useful for others encountering a similar problem to know 
what your problem was and how you solved it.


Cheers
Sebastian

Am 05.07.2018 um 09:30 schrieb lin hui:

Hi,

Thank you for your Reply ! I have sloved the issue.


Thank you!

Cheers,
lin

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





___
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] Constructor parameters of osg::Uniform

2018-06-28 Thread Sebastian Messerschmidt




Hi Werner,



Hi all,

I recently discovered a strange case in creation of a Uniform:

farRadiusRescaleUniform=newosg::Uniform("farRadiusRescale",2.0f);

The only constructor I could find is like that:

Uniform(Typetype,conststd::string,intnumElements=1);

The wrong construction sometimes leads to unexpected results.
Why is the compiler not reclaming about this mismatch in parameters?


This is called implicit conversion and is totally legal.
In order to make to compiler avoid implicit conversion it can be tagged 
as explicit. As i've tumbled over this one more than once it might 
acutally be a good idea to change the uniform constructors which take 
only the name and "numElements".


@Robert:
Any insights?

Cheers
Sebastian



- Werner -


___
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] Antialising for text

2018-06-26 Thread Sebastian Messerschmidt

Hi Igor,

you might want to explicitly set the font resolution to get smoother fonts.

text->setFontResolution(128,128);

And make sure you're using an appropriate true type font.
E.g.
text->setFont("/fonts/arial.ttf");


hth,
Sebastian


Hi.
I tried to set sampling traits->samples = 4 but I don't see any improvement.

I use text this way:


Code:
osg::ref_ptr text = new osgText::Text;
text->setFont(m_font);
text->setAxisAlignment(osgText::Text::SCREEN);
text->setDrawMode(osgText::Text::TEXT);
text->setAlignment(osgText::Text::LEFT_BOTTOM);
text->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
text->setCharacterSize(11.0);




What do I need to do to make font smoother?

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





___
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] C++11 for next stable release of OpenSceneGraph?

2018-06-12 Thread Sebastian Messerschmidt



Hi Daniel,

Sorry I was mixing up VSG and OSG here. For OSG you're totally right 
with your concerns.


Cheers
Sebastian > Hi Daniel, > Hi Sebastian,



I'd rather target C++14/17 though since almost all modern compilers
are good at keeping up with the new features (even Microsoft is doing
a good job here).


you just have to consider that switching compilers isn't that easy for
everyone, because they've constraints that aren't completely under their
control.


But VSG is a fresh start and there are no existing projects that use it 
a this point. So "switching" compilers is not an issue, right? I mean if 
someone is planning on using it, using a modern compiler is simply a 
prerequisite. Since the project just started I think it won't be used in 
production before 2019. Until then most environments should be up2date 
with C++14 conforming compilers.




So going for C++11 should be fine at this point in time, but I wouldn't
go beyond.


Most C++11 compilers I've encountered support a subset of C++14 anyways, 
which is why I also pointed out, that defining a set of features might 
be possible too.



Cheers
Sebastian
___
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] C++11 for next stable release of OpenSceneGraph?

2018-06-12 Thread Sebastian Messerschmidt

Hi Daniel, > Hi Sebastian,



I'd rather target C++14/17 though since almost all modern compilers
are good at keeping up with the new features (even Microsoft is doing
a good job here).


you just have to consider that switching compilers isn't that easy for
everyone, because they've constraints that aren't completely under their
control.


But VSG is a fresh start and there are no existing projects that use it 
a this point. So "switching" compilers is not an issue, right? I mean if 
someone is planning on using it, using a modern compiler is simply a 
prerequisite. Since the project just started I think it won't be used in 
production before 2019. Until then most environments should be up2date 
with C++14 conforming compilers.




So going for C++11 should be fine at this point in time, but I wouldn't
go beyond.


Most C++11 compilers I've encountered support a subset of C++14 anyways, 
which is why I also pointed out, that defining a set of features might 
be possible too.



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


Re: [osg-users] C++11 for next stable release of OpenSceneGraph?

2018-06-12 Thread Sebastian Messerschmidt

Hi,

I totally support the step to use a more modern feature set of C++. It 
really makes code easier to read, maintain and coding more fun. I'd 
rather target C++14/17 though since almost all modern compilers are good 
at keeping up with the new features (even Microsoft is doing a good job 
here).  If you consider this too much of a stretch, you might consider 
to simply constrain the set of features allowed for now (excluding not 
so well supported ones).


Another word on coding style: Lambdas, especially when the get more 
complex should follow a consistent style. Else they tend to increase the 
parsing effort for the human brain beyond most people's limit.


From my experience the should always be defined and named before use in 
a function. This way the function of the lambda is stated by the name 
which saves a lot of guesswork.


E.g.

 the "auto" inside the lambda params is a C++14 feature btw.
auto find_name= [](const auto& elem){return token==elem.name;};

std::find_if(std::begin(elements), std::end(elements), find_name);

instead of:
std::find_if(std::begin(elements), std::end(elements), [](const 
auto& elem){return token==elem.name;});



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


Re: [osg-users] OSG in Gtk3 GLArea

2018-06-05 Thread Sebastian Messerschmidt

Hi,


Am 04.06.2018 um 21:00 schrieb Mean Taipan:

Again, my apologies but I can't delete this account.  Moderators, please do it 
ASAP, no problem for me.  (I won't try creating a new account until then, since 
I need to use the same email).



Simply tell me the name you need your profile changed to or write me a 
forum-message and I will do so.


Cheers
Sebastian



But in the meantime, if you'll bear with me, I recompiled osg with 
-DOPENGL_PROFILE=GLCORE but it triggers


Code:
Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)



if there is any geometry.  Vastly fewer errors than before, in fact only one, 
but still a black screen.  So I'm probably missing something.  The sequence of 
events is:

- when constructing the Viewer subclass, when the window is realized, it calls 
setUpViewerAsEmbeddedInWindow().
- when it is time to render, Gtk has already made the GL context 'current', so 
the draw callback just calls Viewer::frame().

So, if it's not too much trouble, someone please point out how I can get some 
finer debug granularity so I can chase down the error myself, or advise on what 
needs to precede the frame() call.

Regards,
SJH

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





___
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] Problems with MRT

2018-05-16 Thread Sebastian Messerschmidt

Hi Romulo,

Have you debugged into the writeImage functionality of the png-plugin? 
Have you tried using tiff etc.?


I suspect that either the read-back image is either empty or has the 
wrong image format, so the plugin cannot write it. Not all formats that 
you can use for images can be written by the plugins.


Cheers
Sebastian


Hi,

just updating my progress:

What have I got so far?
[ ✓ ] Allow rendering for color or depth buffers on the same camera;
[ ✓ ] Display only the color buffer in the post render camera;
[ ✓ ] Read color or depth buffer in the final draw callback;
[ ✗ ] Write collected image (color or depth) in disk - only images as 
GL_UNSIGNED_BYTE, instead of GL_FLOAT.

I changed the buffer reader in my callback (readImageFromCurrentTexture() 
instead of readPixels()), however I still got problems when I render floating 
textures...

This is my current code:


Code:
// OSG includes
#include 
#include 
#include 
#include 
#include 
#include 
#include 

struct SnapImage : public osg::Camera::DrawCallback {
 SnapImage(osg::GraphicsContext* gc, osg::Texture2D* tex1, osg::Texture2D* 
tex2 ) {
 if (gc->getTraits()) {
 _texColor = tex1;
 _texDepth = tex2;
 }
 }

 virtual void operator () (osg::RenderInfo& renderInfo) const {
 // color buffer
 renderInfo.getState()->applyTextureAttribute(0, _texColor);
 osg::ref_ptr mColor = new osg::Image();
 mColor->readImageFromCurrentTexture(renderInfo.getContextID(), true, 
GL_UNSIGNED_BYTE);
 osgDB::ReaderWriter::WriteResult wrColor = 
osgDB::Registry::instance()->writeImage(*mColor, "./Test-color.png", NULL);
 if (!wrColor.success()) {
 osg::notify(osg::WARN) << "Color image: failed! (" << wrColor.message() << 
")" << std::endl;
 }

 // depth buffer
 renderInfo.getState()->applyTextureAttribute(0, _texDepth);
 osg::ref_ptr mDepth = new osg::Image();
 mDepth->readImageFromCurrentTexture(renderInfo.getContextID(), true, 
GL_UNSIGNED_BYTE);
 osgDB::ReaderWriter::WriteResult wrDepth = 
osgDB::Registry::instance()->writeImage(*mDepth, "./Test-depth.png", NULL);
 if (!wrDepth.success()) {
 osg::notify(osg::WARN) << "Depth image: failed! (" << wrDepth.message() << 
")" << std::endl;
 }
 }
 osg::ref_ptr _texColor;
 osg::ref_ptr _texDepth;
};

osg::Camera* setupMRTCamera( osg::ref_ptr camera, 
std::vector& attachedTextures, int w, int h ) {
 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, 0 );
 camera->setViewport( 0, 0, w, h );

 osg::Texture2D* tex = new osg::Texture2D;
 tex->setTextureSize( w, h );
 tex->setInternalFormat( GL_RGB );
 tex->setSourceFormat( GL_RGBA );
 tex->setSourceType( GL_UNSIGNED_BYTE );
 tex->setResizeNonPowerOfTwoHint( false );
 tex->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
 tex->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
 attachedTextures.push_back( tex );
 camera->attach( osg::Camera::COLOR_BUFFER, tex );

 tex = new osg::Texture2D;
 tex->setTextureSize(w,h);
 tex->setSourceFormat(GL_DEPTH_COMPONENT);
 tex->setInternalFormat(GL_DEPTH_COMPONENT);
 tex->setSourceType(GL_UNSIGNED_BYTE);
 attachedTextures.push_back( tex );
 camera->attach( osg::Camera::DEPTH_BUFFER, tex );

 return camera.release();
}


int main() {
 osg::ref_ptr< osg::Group > root( new osg::Group );
 root->addChild( osgDB::readNodeFile( 
"/home/romulo/Tools/OpenSceneGraph-Data/cow.osg" ) );
 unsigned int winW = 800;
 unsigned int winH = 600;

 osgViewer::Viewer viewer;
 viewer.setUpViewInWindow( 0, 0, winW, winH );
 viewer.setSceneData( root.get() );
 viewer.realize();

 // setup MRT camera
 std::vector attachedTextures;
 osg::Camera* mrtCamera ( viewer.getCamera() );
 setupMRTCamera( mrtCamera, attachedTextures, winW, winH );

 // set RTT textures to quad
 osg::Geode* geode( new osg::Geode );
 geode->addDrawable( osg::createTexturedQuadGeometry(
 osg::Vec3(-1,-1,0), osg::Vec3(2.0,0.0,0.0), osg::Vec3(0.0,2.0,0.0)) );
 geode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, 
attachedTextures[0] );
 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );
 geode->getOrCreateStateSet()->setMode( GL_DEPTH_TEST, 
osg::StateAttribute::OFF );

 // configure postRenderCamera to draw fullscreen textured quad
 osg::Camera* postRenderCamera( new osg::Camera );
 postRenderCamera->setClearMask( 0 );
 postRenderCamera->setRenderTargetImplementation( 
osg::Camera::FRAME_BUFFER, osg::Camera::FRAME_BUFFER );
 

Re: [osg-users] Getting the combined matrix from a Node?

2018-05-08 Thread Sebastian Messerschmidt


Hi Marlin,

you need to get the appropriate parent-node paths:

osg::NodePathList parent_node_list = mat.getParentalNodePaths();
Now if you know the path you want to retrieve, you can call
e.g.:
node_path = parent_node_list[1];

osg::Matrix mat = osg::computeLocalToWorld(node_path);

Also the getParentalNodePaths() function lets you specify the node in 
the parent path where to stop traversal (e.g. to get transformations in 
a local model reference-frame)


The reason is, that the scene-graph is a DAG where nodes can have 
multiple parents.
Another possibility is to use the per-instance transform inside an 
update callback:


void MyUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv)
{
osg::NodePath& node_path = nv->getNodePath() ;
osg::Matrix mat = osg::computeLocalToWorld(node_path);
///...
traverse(node,nv);
}



Cheers
Sebastian


Am 07.05.2018 um 20:58 schrieb Rowley, Marlin R:

Hello,

I’m trying to figure out how to retrieve the combined matrix from a node 
that is of a PositionAttitudeTransform node type.  I can get it 
converted to a Transform() class, but there is no clear way of getting 
the combined matrix from local to world.  For example,


Osg::PositionAttitudeTransform trans;

Trans.setScale(2,2,2);

Trans.setPosition(0,10,0);

Osg::Matrixd temp = getCombinedTransform(trans);

Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)

{

   Auto m = mat->asTransform();

   Return m->computeLocalToWorldMatrix (m, ???); << == 
why use a node visitor on yourself?


   Or

   Return m->getCombinedMatrix()?? <<  = is there such a 
thing?


}



Marlin Rowley

Software Engineer, Staff

cid:image002.jpg@01D39374.DEC5A2E0

/Missiles and Fire Control/

972-603-1931 (office)

214-926-0622 (mobile)

marlin.r.row...@lmco.com 



___
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] OpenSceneGraph-3.6.1 release candidate 2 tagged

2018-05-03 Thread Sebastian Messerschmidt

Hi,

I've been testing the current build and just discovered, that there are 
some things that are different.


To point out one specifically:
I'm using calls to
osgDB::Registry::addEntryToObjectCache(file_name, result_node) ommitting 
the options parameter which defaults to nullptr.

This gives me a lot of warnings from this line (~336 in osg/Object)

OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) passed 
null object to clone, returning NULL."<<std::endl;


Basically the "addEntryToObjectCache" explicitely clones the options:

  _objectCache[FileNameOptionsPair(filename, osg::clone(options))] = 
ObjectTimeStampPair(object,timestamp);)


leading to the above warning.

Any hints? If I'm supposed to pass options, it should not default to a 
nullptr. In case the nullptr is ok, the clone shouldn't be issued IMHO.


Cheers
Sebastian




Am 02.05.2018 um 10:22 schrieb Robert Osfield:

Hi All,

I have tagged the second 3.6.1 release candidate.

I have merged a PR that removed so un-implemented functions in
osgParticle, this technically changes the ABI for osgParticle so I've
bumped the SO version for 3.6.1-rc2.  The rest of the changes are
fixes.


https://github.com/openscenegraph/OpenSceneGraph/tree/OpenSceneGraph-3.6.1-rc2

I'm ready to tag 3.6.1, all need from the community is testing and
feedback on whether things are working on all the main platforms.  Let
us know of success or failures here on this thread.

Cheers,
Robert.

-- ChangeLog since 3.6.0

Wed, 2 May 2018 09:10:54 +0100
Author : Robert Osfield
Updates for the 3.6.1-rc2

Mon, 30 Apr 2018 11:55:17 +0100
Author : Robert Osfield
Updated SO version to reflect change in ABI

Mon, 30 Apr 2018 11:44:02 +0100
Author : OpenSceneGraph git repository
Merge pull request #542 from psyinf/fix_particle_system_headerFIX:
 removed unimplemented functions from header

Mon, 30 Apr 2018 11:16:02 +0200
Author : Sebastian Messerschmidt
FIX:  removed unimplemented functions from header

Fri, 27 Apr 2018 11:23:07 +0100
Author : Robert Osfield
Fixed particle update bug where a ParticleSystem wouldn't start when
loaded during the frame loop due to the _last_frame value not being
set.

Thu, 26 Apr 2018 10:21:53 +0100
Author : Robert Osfield
Updated ChangeLog, README.md and rc number for 3.6.1-rc1

Thu, 26 Apr 2018 09:49:35 +0100
Author : Robert Osfield
Split up #pragma so that there only three parameters per line to aovid
Intel driver bug crash

Thu, 26 Apr 2018 09:36:52 +0100
Author : Robert Osfield
Renamed text.vert and text.frag to osgText_Text.vert and .frag to
avoid name overlapping with user shaders.

Wed, 25 Apr 2018 09:48:02 +0100
Author : Julien Valentin
add wrapper for osg::DrawIndirectBufferObject

Tue, 24 Apr 2018 17:05:03 +0100
Author : Robert Osfield
Renamed CMake variable + C++ #define to OSG_GL_CONTEXT_VERSION

Tue, 24 Apr 2018 16:22:13 +0100
Author : Robert Osfield
Added OSG_GL_CONTEXT_STRING cmake variable to set include/osg/GL
headers that sets Traits::glContextVersion.

Tue, 24 Apr 2018 15:38:02 +0100
Author : OpenSceneGraph git repository
Merge pull request #537 from
openscenegraph/revert-536-default-gl3-contextRevert "When GL3 build is
enabled, default context requested is version 3.3, …"

Tue, 24 Apr 2018 15:37:44 +0100
Author : OpenSceneGraph git repository
Revert "When GL3 build is enabled, default context requested is version 3.3, …"

Tue, 24 Apr 2018 15:36:11 +0100
Author : OpenSceneGraph git repository
Merge pull request #536 from emminizer/default-gl3-contextWhen GL3
build is enabled, default context requested is version 3.3, …

Tue, 24 Apr 2018 15:33:03 +0100
Author : Robert Osfield
Refactored the handling of glyph and shadow alpha values to make the
text and shadow clearer for fonts with narrow glyphs

Tue, 24 Apr 2018 13:52:53 +0100
Author : Robert Osfield
Refactored the handling of text bounding box to provide more stable
bounding box computation

Tue, 24 Apr 2018 06:31:32 -0400
Author : Daniel Emminizer
When GL3 build is enabled, default context requested is version 3.3,
enabling core profile by default.

Fri, 20 Apr 2018 21:16:46 +0200
Author : Alberto Luaces
Small fix for uncaught typo.

Fri, 20 Apr 2018 18:18:22 +0200
Author : Alberto Luaces
Fix typos and spelling.

Mon, 23 Apr 2018 11:02:03 +0100
Author : OpenSceneGraph git repository
Merge pull request #534 from emminizer/fix-msvc-includesFix includes
for MSVC 2015 build.

Fri, 20 Apr 2018 13:16:43 -0400
Author : Daniel Emminizer
Fix includes for MSVC 2015 build.

Fri, 20 Apr 2018 15:58:27 +0100
Author : Robert Osfield
Updated ChangeLog

Fri, 20 Apr 2018 14:32:34 +0100
Author : Robert Osfield
Replaced osgUtil::IntersectVisitor usage with osgUtil::InteresectionVisitor

Fri, 20 Apr 2018 10:24:17 +0100
Author : Robert Osfield
Removed TriStripVisitor for default set of Optimizer passes as it
doesn't generate efficient scene graphs

Fri, 20 Apr 2018 09:57:04 +0100
Author : Robert Osfield
Added osgUtil::optimizeMe

Re: [osg-users] Help on multitexturing..

2018-04-20 Thread Sebastian Messerschmidt

Hi Marlin,


Re-phrasing Roberts advice:

osg::Uniform* sampler = new osg::Uniform(osg::Uniform::SAMPLER_2D, 
"NameOfTheSamplerInGLSL");

sampler->set(0); //assign unit
ss->addUniform(sampler);
ss->setTextureAttribute(0/*unit*/, texture0 ,osg::StateAttribute:ON );

osg::Uniform* sampler_1 = new osg::Uniform(osg::Uniform::SAMPLER_2D, 
"NameOfTheSamplerInGLSL_1");

sampler->set(1); //assign unit
ss->addUniform(sampler);
ss->setTextureAttribute(1/*unit*/, texture1 ,osg::StateAttribute:ON );

This works fine with two sampler2D objects in GLSL.


HTH & Cheers
Sebastian

Am 19.04.2018 um 20:06 schrieb Rowley, Marlin R:

Hello,

I’ve been wracking my brain all day on trying to figure out how to do 
this with no clear examples found online.


I have this set of calls in my C++:

mGroupState = mBoundGeometry->getOrCreateStateSet();

   
mGroupState->getOrCreateUniform("BaseTexSampler",osg::Uniform::SAMPLER_2D)->set(mBaseColor);


   
mGroupState->getOrCreateUniform("BaseWeight",osg::Uniform::FLOAT)->set(mBaseWeight);


   
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor,osg::StateAttribute::ON);


I’ve bound this base texture to texture unit (BASE_TEXTURE_UNIT = 1).

Later in the code, I have this in another function if I create another 
layer with another texture:


mGroupState->getOrCreateUniform("TexLayerSampler0",osg::Uniform::SAMPLER_2D)->set(tex);

 
mGroupState->setTextureAttribute(BASE_TEXTURE_UNIT+1,tex,osg::StateAttribute::ON);


Where I’ve created a second texture and want it to reside in texture unit 2.

However, in my shader code when indexing the TexLayerSampler0, I only 
get base texture.


finalColor = texture(TexLayerSampler0, LayeredTexCoords[0].st);

Which is wrong.  I’m stil trying to figure out OpenGL and how it works 
along with OSG so sorry for the inexperience.


-M



Marlin Rowley

Software Engineer, Staff

cid:image002.jpg@01D39374.DEC5A2E0

/Missiles and Fire Control/

972-603-1931 (office)

214-926-0622 (mobile)

marlin.r.row...@lmco.com 



___
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] Read frame buffer back into main memory

2018-03-01 Thread Sebastian Messerschmidt

Hi Antoine,

set a postDrawCallback to the pass/camera that writes to the texture.


In the callback:

virtual void operator () (osg::RenderInfo& render_info) const
{
osg::State* state=render_info.getState();
state->apply(render_info.getCurrentCamera()->getStateSet());
state->applyTextureAttribute(0, mTexture);
mTexture->apply(*state);

mImage->readImageFromCurrentTexture(render_info.getContextID(),true, 
GL_FLOAT ); //change the GL_FLOAT to your needs

}

the mTexture is passed to the callback using the original texture 
attached to the MRT.




Cheers
Sebastian

Am 28/02/2018 um 19:05 schrieb Antoine Rennuit:

Hi all,

I need to read the frame buffer back into the main memory. I know this will 
kill performance but I only need to do it once.

Is there a way to do that? I could not find clear answers on the internet.

Thanks,

Antoine.

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





___
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] Normal Mapping using Dynamic Cubemap

2018-02-03 Thread Sebastian Messerschmidt



Hi,

Hi Sebastian,

I have managed the normal and depth using MRT-FBO. I changed the osgdeferred 
example to display the normal (blue) and depth (green). Now I need to repeat 
this process for each six faces of cubemap.

Nice to see that you're making progress.


I have a question: to capture the normal/depth data, as seen in Figure, I used 
the eye space. For dynamic cubemap, I need to use the eye space or world space?
Usually cubemaps are in world-space as they represent the view from a 
certain world-coordinate.


Cheers
Sebastian

...

Thank you!

Cheers,
Rômulo

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




Attachments:
http://forum.openscenegraph.org//files/screenshot_from_2018_02_02_23_11_17_990.png


___
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] Normal Mapping using Dynamic Cubemap

2018-01-30 Thread Sebastian Messerschmidt

I'll try a last time:



Hi,

I still have problems to manage the normal view from reflected objects (using 
dynamic cubemaps technique). Please any tip here?



Have you managed to render your normals, colors, depth etc to a MRT-FBO?
If so, the next step is to render to do this 6 times, where each time 
you're FBO-attachments are the images of your cube-maps. You will need 
separate cubemaps for the normals, colors etc.


Simply tell us where you're stuck. Last time it sounded like you're on a 
good way, but I personally don't have much time to help you with the 
detailed problems you encountered.


Cheers
Sebastian.


...

Thank you!

Cheers,
Rômulo

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





___
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] Shaders with multiple views, possible?

2018-01-22 Thread Sebastian Messerschmidt

Hi Antoine,

the gl_ built-ins are not part of the core-profile and thus are not 
available in every version of GLSL.


Cheers
Sebastian


Hello Robert,

Actually I don't get why OSG doubles the gl predefined variables 
gl_ModelViewMatrix, gl_ModelViewProjectionMatrix... with osg equivalents. 
Aren't the gl ones good enough?

Kind regards,

Antoine.

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





___
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] Help! New to OSG

2018-01-08 Thread Sebastian Messerschmidt

Hi Julie,

can you provide a sample set for us to take a look at?

Cheers
Sebastian > Hi!


I'm not sure if this goes here so please let me know.

I'm having trouble making textures and animation appear in my OSG and IVE 
files. A client of mine is trying to use OSG to create some AR.

I've created geometry in 3ds max and output it as an obj. Now I know that 
animation doesn't carry over with an obj, but the texture definitely should. 
I'm using a 256 texture of a flat color CMYK square for testing. 3ds max spits 
out an MTL file which ive tried to load into my OSG conversion folder with the 
obj but that seems to mess the obj conversion up, so I only load in the jpeg 
texture.

Next I tried to use a 3ds file, but that came out terribly.

Is there any way I can animate and texture using 3ds max and export all of that 
and successfully convert to an osg/ive? I've tried everything, and DAE and FBX 
files sound promising but I can't figure out how to convert them over.

Please help!

Thanks!
Julie

...

Thank you!

Cheers,
Julie

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





___
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] Normal Mapping using Dynamic Cubemap

2017-12-27 Thread Sebastian Messerschmidt


Hi Rômulo,

I already tried to describe the building-blocks for the way:

1. Render to FBO with MRT (see osgmultiplerendertargets example for 
this). The MRT/FBO-attachments should be your color, normal and depth.
You'll need to use a shader that writes the correct information to the 
correct buffers. That's all in the example. Basically that's deferred 
rendering's approach. An example by Michael Kapelko can be found here: [0].


2. Once you understand how to render to one FBO you can use your 
approach to render to the individual faces of your cubemap.


You need to learn the basics. Pasting source code might not attract a 
lot of attention, so please try to follow my hints before asking the 
question over and over.



[0] 
https://bitbucket.org/kornerr/osg-deferred-shading/src/5b8555059707?at=default



Cheers
Sebastian



Am 26.12.2017 um 18:17 schrieb Rômulo Cerqueira:

Hi Roberto and Sebastian,

sorry for my duplicated post. I need to render the depth/normal surface to 
texture of reflected objects by cube maps.

Until this moment, I got the depth data. Could you help me to get the normal 
data too (as single channel data). My current code follows below:

C++ code:

Code:

// OSG includes
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

// C++ includes
#include 

#define SHADER_PATH_FRAG "normal_depth_map/shaders/normalDepthMap.frag"
#define SHADER_PATH_VERT "normal_depth_map/shaders/normalDepthMap.vert"

#define BOOST_TEST_MODULE "DynamicCubeMap_test"

using namespace osg;

unsigned int numTextures = 6;

enum TextureUnitTypes {
 TEXTURE_UNIT_DIFFUSE,
 TEXTURE_UNIT_NORMAL,
 TEXTURE_UNIT_CUBEMAP
};

osg::ref_ptr _create_scene() {
 osg::ref_ptr scene = new osg::Group;

 osg::ref_ptr geode = new osg::Geode;
 scene->addChild(geode.get());

 const float radius = 0.8f;
 const float height = 1.0f;
 osg::ref_ptr shape;

 // sphere
 shape = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(-3.0f, 0.0f, 
0.0f), radius));
 shape->setColor(osg::Vec4(0.6f, 0.8f, 0.8f, 1.0f));
 geode->addDrawable(shape.get());

 // box
 shape = new osg::ShapeDrawable(new osg::Box(osg::Vec3(3.0f, 0.0f, 0.0f), 2 
* radius));
 shape->setColor(osg::Vec4(0.4f, 0.9f, 0.3f, 1.0f));
 geode->addDrawable(shape.get());

 // cone
 shape = new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(0.0f, 0.0f, 
-3.0f), radius, height));
 shape->setColor(osg::Vec4(1.0f, 0.3f, 0.3f, 1.0f));
 geode->addDrawable(shape.get());

 // cylinder
 shape = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f, 0.0f, 3.0f), 
2* radius));
 shape->setColor(osg::Vec4(0.8f, 0.8f, 0.4f, 1.0f));
 geode->addDrawable(shape.get());

 return scene;
}

osg::NodePath createReflector() {
 Geode* node = new Geode;
 const float radius = 0.8f;
 ref_ptr hints = new TessellationHints;
 hints->setDetailRatio(2.0f);
 ShapeDrawable* shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 
0.0f), radius * 1.5f), hints.get());
 shape->setColor(Vec4(0.8f, 0.8f, 0.8f, 1.0f));
 node->addDrawable(shape);

 osg::NodePath nodeList;
 nodeList.push_back(node);

 return nodeList;
}

class UpdateCameraAndTexGenCallback : public osg::NodeCallback
{
 public:

 typedef std::vector< osg::ref_ptr >  CameraList;

 UpdateCameraAndTexGenCallback(osg::NodePath& reflectorNodePath, 
CameraList& Cameras):
 _reflectorNodePath(reflectorNodePath),
 _Cameras(Cameras)
 {
 }

 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
 {
 // first update subgraph to make sure objects are all moved into 
position
 traverse(node,nv);

 // compute the position of the center of the reflector subgraph
 osg::Matrixd worldToLocal = 
osg::computeWorldToLocal(_reflectorNodePath);
 osg::BoundingSphere bs = _reflectorNodePath.back()->getBound();
 osg::Vec3 position = bs.center();

 typedef std::pair ImageData;
 const ImageData id[] =
 {
 ImageData( osg::Vec3( 1,  0,  0), osg::Vec3( 0, -1,  0) ), // 
+X
 ImageData( osg::Vec3(-1,  0,  0), osg::Vec3( 0, -1,  0) ), // 
-X
 ImageData( osg::Vec3( 0,  1,  0), osg::Vec3( 0,  0,  1) ), // 
+Y
 ImageData( osg::Vec3( 0, -1,  0), osg::Vec3( 0,  0, -1) ), // 
-Y
 ImageData( osg::Vec3( 0,  0,  1), osg::Vec3( 0, -1,  0) ), // 
+Z
 ImageData( osg::Vec3( 0,  0, -1), osg::Vec3( 0, -1,  0) )  // 
-Z
 };

 for(unsigned int i = 0; i < 6 && i < _Cameras.size(); ++i) {
 osg::Matrix localOffset;
 
localOffset.makeLookAt(position,position+id[i].first,id[i].second);

 osg::Matrix viewMatrix = worldToLocal*localOffset;

   

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2017-12-19 Thread Sebastian Messerschmidt

Hi Rômulo,

Repeating the question won't magically solve it.

If you're after rendering normals and depth into textures (it doesn't 
matter if you are rendering to cubemap-faces IMHO) then see the multiple 
rendering target (MRT) example. Basically you need to attach a depth and 
normal target to your FBO and in a custom shader write the information 
to it (basically that's the first step in deferred rendering). There are 
some deferred-rendering/shading examples based on OSG around in the web. 
If you're unable to find them, I can help you to retrieve them.


In the resolving pass, you need to bind the textures you've rendered to, 
to get the normals/depths.


Beware that there will be issues concerning filtering (since depth and 
normals cannot be lineary interpolated in every case)



Cheers

Sebastian



Am 19.12.2017 um 03:10 schrieb Rômulo Cerqueira:

Hi,

is it possible to generate dynamic cubemaps (with normal mapping textures)?

...

Thank you!

Cheers,
Rômulo

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





___
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] Tiny normals: osgviewer vs osgcompositeviewer

2017-12-04 Thread Sebastian Messerschmidt



Hi Per,

Just a thought:
Maybe the Optimizer simply applies normal-rescaling?

Cheers
Sebastian

Hi all,

I came across something strange recently;
the attached model is a red triangle scaled down by a factor 1000.
The normals are squashed and I see some rendering problems in my app,
which uses osgcompositeviewer.

Confirmed with
osgcompositeviewer red.osgt  - renders with white color (incorrect)
BUT
osgviewer red.osgt - renders with red color (correct)

I did some digging in the OSG code, it seems the difference is that 
osgviewer always

optimizes the scene graph, something that osgcompositeviewer never does.
Adding an optimizer to osgcompositeviewer fixes the rendering.

So first question; would it be better if the two viewers applied same 
optimizer settings?

Since users would expect them to display things in the exact same way.

Second and more interesting; how can optimizer correct a "broken" model?

Thank you!

/Per



___
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] Displaying the normals of your models

2017-12-01 Thread Sebastian Messerschmidt

Hi,

alternatively you can setup a geometry shader to run a second pass [1]:

layout(triangles) in;
layout(line_strip, max_vertices=6) out;

// (projection * view * model) matrix
uniform mat4 proj_view_model;

// length of the normal (object space)
uniform float normal_length;

in vec3 normal;

out NDData {
vec3 normal;
} nd_out;

void main() {
   for (int i = 0; i < 3; i++) {
   gl_Position = gl_in[i].gl_Position;
   nd_out.normal = normal;
   EmitVertex();
   gl_Position = gl_in[i].gl_Position +
   proj_view_model * vec4(normal * normal_length, 0.f);
   nd_out.normal = normal;
   EmitVertex();
   EndPrimitive();
   }
}

[1] from: https://wiki.delphigl.com/index.php/shader_normal_debug_330

Cheers
Sebastian


Hi everyone,

I have to debug a normal issue with my model, so I made a code to display them 
(transform normals in a bunch of gl_lines and create a resulted geometry).

I share the gist in case it may help:
https://gist.github.com/fulezi/95a9ac319fd1cbeca1b18a4cde3986dc



Have a nice day,
Florian

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





___
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] Migration to a new forum/ML server and technology

2017-11-20 Thread Sebastian Messerschmidt

Hi,
On Mon, Nov 20, 2017 at 1:36 PM, Robert Osfield 
> wrote:


On 20 November 2017 at 19:52, Chris Hanson > wrote:
> For purposes of discussion, do you believe the Google forum
would improve on
> this in any way?
One issue we'd need to resolve is who is the current owner of the
"OpenSceneGraph Users".  I can't see a why of finding out who that is
from the web interface right now.


  I'm not sure I understand that issue.

  My understanding was that this list was being run by some listserv 
software on a computer controlled by you -- probably the dreamhost 
server. So, i'm not clear on what ownership means here.


An open issue would be whether we'd need to do the same moderation
that is done on the forum right now.  One of the reasons for having
moderation is catching bots, policing poor etiquette and encouraging
users not to inhuman names.


  Probably will require some moderation, yes. I moderate a small 
google groups list for glslDebugger, and this is a necessary task. I'd 
be willing to help moderate Google Groups signups, but there should be 
others who step up too.


Skipping the bulk of the conversation:
I'd be willing to invest time into moderation as well if there is a new 
system to handle it. The old forum is simply cluttered with ten 
thousands of dead/old/spam accounts. So a fresh start is welcome.


Cheers
Sebastian


Robert.


--
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/

Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • 
OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP •Forensics •Imaging •UAVs • GIS • GPS • 
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • 
Mobile • iPhone/iPad/iOS • Android
@alphapixel  facebook.com/alphapixel 
 (775) 623-PIXL [7495]



___
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] Get RGB Values from Textrue

2017-11-13 Thread Sebastian Messerschmidt


Hi Maxim,


Hi,

I have a osg::Texture2D that I'm using as a render to texture target.
I can see that it is working on the screen, but I need to have access to the 
RGB values of the texture itself so I can also copy them to another API.

How can I access the RGB values?


set a postDrawCallback to the pass/camera that writes to the texture.


In the callback:

virtual void operator () (osg::RenderInfo& render_info) const
{
osg::State* state=render_info.getState();
state->apply(render_info.getCurrentCamera()->getStateSet());
state->applyTextureAttribute(0, mTexture);
mTexture->apply(*state);
	mImage->readImageFromCurrentTexture(render_info.getContextID(),true, 
GL_FLOAT ); //change the GL_FLOAT to your needs

}

the mTexture is passed to the callback using the original texture 
attached to the MRT.


Cheers
Sebastian






After rendering a frame, if I access _image in the texture2D class, it is null, 
but I do see that the Texture of texture2D has an array size of 1.
How and where are the RGB values stored?

Thank you!

Maxim


Thank you,
--Maxim

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





___
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] TBN Matrix for Normal Mapping - OSG and GLSL

2017-11-08 Thread Sebastian Messerschmidt



Hi Rômulo,


Hi,

I have used normal mapping using GLSL and OSG for my application (an imaging 
sonar simulation) and I got problems by calculating the TBN matrix on shaders. 
The normal vectors contain lower resolution on border in comparison with the 
center of image.


You cannot get a valid Co-TangentSpace by taking only the normal into 
account considering arbitrary geometries. There are multiple ways to 
tackle this however:
First is to calculate the mesh's tangentspace beforehand and pass the 
tangent and binormal via vertex attributes.
See the osgUtil::TangentSpaceGenerator (example in the osg::CookBook 
AFAIK).


Second one is to calculate it in the view-space. Beware of dragons, 
since the precision will be awful for big coordinates:


http://www.thetenthplanet.de/archives/1180

hth
Sebastian



Follows my vertex code:

Code:

#version 130

out vec3 pos;
out vec3 normal;
out mat3 TBN;

void main() {
 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
 normal = gl_NormalMatrix * gl_Normal.xyz;

 vec3 n = normalize(normal);
 vec3 t = normalize(cross(normal, vec3(-1,0,0)));
 vec3 b = cross(t, n) + cross(n, t);
 TBN = transpose(mat3(t,b,n));

 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
 gl_TexCoord[0] = gl_MultiTexCoord0;
}




Part of my fragment code:

Code:

#version 130

in vec3 pos;
in vec3 normal;
in mat3 TBN;
uniform sampler2D normalTexture;

void main() {
 vec3 newNormal = (texture2D(normalTexture, gl_TexCoord[0].st).rgb * 2.0 - 
1) * TBN;
 newNormal = normalize(newNormal);
...
}




The resulting figure is attached.

How can I calculate the TBN matrix to compute the normal mapping properly?

Thanks in advance,


...

Thank you!

Cheers,
Rômulo[/img]

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




Attachments:
http://forum.openscenegraph.org//files/screenshot_from_2017_11_06_23_00_48_832.png


___
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] Call for assistance: Migrating and updating tutorials

2017-10-19 Thread Sebastian Messerschmidt



Hi Eon,

Hi,

Slightly off-topic, I started learning and using OpenSceneGraph end of last 
year, by using OpenSceneGraph 3.0 Beginner's Guide and OpenSceneGraph 3 
Cookbook as my tutorial sources. It has been 5 years since the books were 
published. It will be nice if there are updated version of the books (to 
coincide with OpenSceneGraph 4.0 release, maybe ?). But I have a feeling that 
the authors are not really available anymore.

Do you have issues with any of the tutorials inside the books?
The only structural changes I recall is the promotion of the 
geode/drawable hierarchy and some changes regarding the callbacks. But 
maybe Robert can shed some light on the potential breaking changes.


The repository coming with the Cookbook [0] seems to get some updates 
now and there are quite some forks.




Anyway, I am wondering how useful the books are for people starting using the 
latest OpenSceneGraph (e.g. me), or how much of its content are still relevant ?


I'd say 99% of the stuff is still relevant, as those books cover the 
basic API and concepts. There are some topics like pragmatic shader 
compositon and GL3 shaders the are not really covered.


Cheers
Sebastian


[0]
https://github.com/xarray/osgRecipes


Thank you!

Cheers,
Eon

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





___
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] Textuiring a simple quad

2017-10-18 Thread Sebastian Messerschmidt

Hi Jochen,

can you please provide a minimal compiling example, or at least the 
vertex shader you use.

The

Cheers
Sebastian

Hi, all :)

I have so a simple quastion but I can solve the problem.

I want to draw a quad attach a simple Shader with a simple texture operation.
But I only get a black quad. The shader works when a color each fragmnent with 
the color red, but wen I want to get texture-colors... its only got black.

Some Code:

Code:

osg::Vec2Array* textureCoordinates = new osg::Vec2Array;
osg::Vec3Array* quadVertices = new osg::Vec3Array;
osg::Geometry* quadGeometry = new osg::Geometry();

// *** Vertices ***
quadVertices->push_back(osg::Vec3(x - rad, y - rad, 0.0));
quadVertices->push_back(osg::Vec3(x + rad, y - rad, 0.0));
quadVertices->push_back(osg::Vec3(x + rad, y + rad, 0.0));
quadVertices->push_back(osg::Vec3(x - rad, y + rad, 0.0));

quadGeometry->setVertexArray(quadVertices);
// *** Vertices - Ende ***

// *** Texturkorrdinaten ***
textureCoordinates->push_back(osg::Vec2(0, 0));
textureCoordinates->push_back(osg::Vec2(1, 0));
textureCoordinates->push_back(osg::Vec2(1, 1));
textureCoordinates->push_back(osg::Vec2(0, 1));

quadGeometry->setTexCoordArray(0, textureCoordinates, 
osg::Array::BIND_PER_VERTEX);
// *** Texturkorrdinaten-Ende ***


// *** Faces-Idizes ***
osg::DrawElementsUInt* gridFace = new 
osg::DrawElementsUInt(osg::PrimitiveSet::QUADS, 0);
gridFace->push_back(0);
gridFace->push_back(1);
gridFace->push_back(2);
gridFace->push_back(3);

quadGeometry->addPrimitiveSet(gridFace);
// *** Faces-Idizes - Ende ***

//  Logo - Texture 
{
std::string path("Grafik\\");
std::string fileName = path + std::string("Skull.tga");

osg::Image *image = osgDB::readImageFile(fileName);
if (!image)
{
exit;
}

osg::TextureRectangle* texture = new 
osg::TextureRectangle(image);

osg::TexMat* texmat = new osg::TexMat;
texmat->setScaleByTextureRectangleSize(true);

// setup state
osg::StateSet* state = new osg::StateSet();
state->addUniform(new osg::Uniform("skull_Texture", 
SKULL_TEXTURE));
state->setTextureAttributeAndModes(SKULL_TEXTURE, texture, 
osg::StateAttribute::ON);
state->setTextureAttributeAndModes(SKULL_TEXTURE, texmat, 
osg::StateAttribute::ON);

state->setMode(GL_BLEND, osg::StateAttribute::ON);


quadGeometry->setStateSet(state);
}




Here I attech the shader

Code:

// Shader-Logo
{
osg::StateSet* stateSet = quadGeometry->getOrCreateStateSet();

mShaderProgramLogo = new osg::Program;
mShaderProgramLogo->setName("ProgramLogo");
mVertexShaderLogo = new osg::Shader(osg::Shader::VERTEX);
mFragmentShaderLogo = new osg::Shader(osg::Shader::FRAGMENT);

mShaderProgramLogo->addShader(mFragmentShaderLogo);
mShaderProgramLogo->addShader(mVertexShaderLogo);


mVertexShaderLogo->loadShaderSourceFromFile("Shader\\vertLogo.txt");

mFragmentShaderLogo->loadShaderSourceFromFile("Shader\\fragmentLogo.txt");
stateSet->setAttributeAndModes(mShaderProgramLogo, 
osg::StateAttribute::ON);

quadGeometry->setStateSet(stateSet);
}





and here the fragment-shader code:

Code:

#version 330

uniform sampler2D skull_Texture;

varying vec2 textCoord;

void main(void)
{
 vec4 colSkull = texture2D(skull_Texture, textCoord);

//gl_FragColor = vec4(1.0,0,0,1.0); // => this works fine
gl_FragColor = colSkull;// => every fragment is black!!!
}




Can anybody help my.
OSG is such a nice library...but why it doesn't work? :(

Thank you!

Cheers,
JoseMan[/code]

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





___
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] [osgPlugins] Multiple video textures using ffmpeg plugin

2017-10-06 Thread Sebastian Messerschmidt

Hi Guys,

Maybe this [1] might help to increase performance.
I'm not sure which ffmpeg is supported now, but maybe that's a good 
argument to upgrade.


Cheers
Sebastian

[1] https://developer.nvidia.com/ffmpeg


Hi Michael,
we use a modified version of the ffmpeg plugin with changes in
OpenSceneGraph\src\osgPlugins\ffmpeg\FFmpegDecoderVideo.cpp
to move the threads to different processors. (full modified file 
attached) It's a crude bit of code,

but it allows us to decode and show 2  1920x1080 movies at 30 fps.
I've pulled out just the code for cpu affinity, this should work with 
osg 3.4.2 as well as git master.

Regards, Laurens.


+ #define RESERVERD_CORES 2
+ static int next_cpu = RESERVERD_CORES;

void FFmpegDecoderVideo::decodeLoop()
{
     FFmpegPacket packet;
     double pts;
+     {
+         int num_cpus = OpenThreads::GetNumberOfProcessors();
+         if (num_cpus > RESERVERD_CORES + 1) {
+             int cpu = next_cpu;
+             ++next_cpu;
+             if (next_cpu >= num_cpus) next_cpu -= num_cpus - 
RESERVERD_CORES;

+             if (cpu >= num_cpus) cpu -= num_cpus - RESERVERD_CORES;
+             OpenThreads::SetProcessorAffinityOfCurrentThread(cpu);
+             OSG_WARN << "FFmpegDecoderVideo::run : 
OpenThreads::SetProcessorAffinityOfCurrentThread" << cpu << std::endl;

+         }
+     }

On Thu, Oct 5, 2017 at 4:54 PM, Robert Osfield > wrote:


Hi Michael,

On 5 October 2017 at 15:41, Michael Maurus > wrote:

This was actually a nice hint.
Only one of my CPUs was working at full capacity.


I haven't looked at the code recently so I'm a bit cold on the
ffmpeg implementation side.  I don't recall any external way to
control the threads that the ffmpeg creates.

 From what it sounds like is the threads that the ffmpeg plugin is
creating is inheriting the affinity of the thread that created
them.  In OSG master there is finer grained control over the
affinity setting behaviour, in your case it might be appropriate to
disable the default setting of affinity.

In an ideal world you want to decided which threads you want to run
on what threads, but this reques knowledge of all the threads, their
needs, and the hardware you are working on.

FYI, the OSG by default tries to make a best guess based on your the
number of CPU cores the OS says the machine has and the
configuration of your viewer, this scheme doesn't know about any
extra threads that plugins might create though.  This scheme is more
hardwired in OSG-3.4 and prior releases, so master might be the
thing to use if you do end up needing more control.

Robert.


___
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] Transform matrix as Uniform to shaders

2017-10-05 Thread Sebastian Messerschmidt

Hi Nickolai,

In case you're really after the ModelMatrix you need to use the 
osg_ViewMatrixInverse and multiply it with your current 
osg_ModelViewMatrix.


As Robert already mentioned you need to set the 
osg::State::setUseModelViewAndProjectionUniforms(true) in order to make 
this work.


Cheers
Sebastian


Hi,

I need a matrix for the transform from root scene node to the node where the 
mesh the shaders currently are operating on is in.

Does OSG pass such a matrix automatically to the shaders?
If yes, is there other uniforms passed and is there a list of them somewhere?

Sorry if my question is dumb, I am new to shaders.

Thank you!

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





___
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] [forum] How to set field of view of second slave camera?

2017-10-05 Thread Sebastian Messerschmidt



Hi Milos,

Hi,

I have problem to set field of view od second slave camera. I used it like lens, but when 
I on lens camera, distance of my "grapf" is incorect. My lens camera is smaler 
as you can see in the pic.



Lens option:
osg::ref_ptr lensCamera = new osg::Camera;
lensCamera->setCullMask(0x2);
lensCamera->setGraphicsContext(viewerWidget >getGraphicsWindow());
lensCamera->setViewport(new 
osg::Viewport((viewerWidget->width()/4),(viewerWidget->height()/4),viewerWidget->width()/2,viewerWidget->height()/2));
lensCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
viewerWidget->addSlave(lensCamera.get(), osg::Matrix(), osg::Matrix(), true);

I tried something like this : viewerWidget->addSlave(lensCamera.get(), 
osg::Matrix::scale(2,2,2),osg::Matrixd()); but scale doesnt work. Anyone help me?


The second parameter of the addSlave is the translation offset. You need 
to change your slave's frustum by scaling the projection:


viewerWidget->addSlave(lensCamera.get(),osg::Matrixd(),osg::Matrix::scale(2,2,1.0))

Cheers
Sebastian






Thank you!

Cheers,
Milos

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




Attachments:
http://forum.openscenegraph.org//files/goal_129.png
http://forum.openscenegraph.org//files/withlens_141.png
http://forum.openscenegraph.org//files/nolens_743.png


___
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] 3.4.1 bug in CMakeLists?

2017-09-25 Thread Sebastian Messerschmidt


Hi,

wow
It seams you're clearly overthinking required command line arguments..
try using
Code:
cmake-gui %OSG_ROOT%

  instead
..and don't forget to delete CMakeCache.txt..

No, he's building it. Not configuring the project. The syntax is correct.


Cheers

Rollastre Prostrit wrote:

Hi list.
I am not such an expert in CMake to say it for sure. In fact, I basically only know how 
to use it. Never did a sophisticated script myself. But it looks to me that some 
CMakeLists.txt in OSG v3.4.1 has a problem when building for MSVC in debug (and in my 
particular case in 64 bit but I think this is not relevant).  In short, it 
"fails" when installing with this command

  cmake --build . --target install --config Debug -- /p:Platform=x64 /m:8
  
And the problem is that the installation script looks for pdb files of OSG applications (e.g. osgviewerd.exe and whatnot) which are not created. This happens after all the usable files have been installed. So one could disregard this error value returned. After all, what it is partially installed seems to be usable. But if you are building OSG in an automated fashion this flags the build as failed and it stops all the build system.

However if the solution files are generated with the 
-DBUILD_OSG_APPLICATIONS=no parameter, the build and installation works 
smoothly (though of course you won't have the applications built but maybe that 
is ok for some).
So, the solution here seems to be that either the .pdb files are created for 
the applications too, or the install target for the applications doesn't try to 
install them. What happens now (in my machines at least) is exactly the 
opposite. Applications don't generate the .pdb files and the install script is 
trying to install them.
As I said before, I am not that cmake-skilled to spot where the problem is 
within all the scripts and provide a solution. But it would be nice if someone 
could.
Thanks.

  --
Post generated by Mail2Forum


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





___
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] Display one scene, pick from another one

2017-09-15 Thread Sebastian Messerschmidt



Hi Antoine,

Hello Sebatian,

I was finally able to test your suggestion and it does work fine except that it 
does return the primitives, not the vertices composing the primitives 
(triangles for me).

Of course you can retrieve the vertices from the primitives (which I am 
currently doing), but selecting primitives and selecting vertices is not 
exactely the same.
Simply use the Intersection::indexList. It contains the vertex 
indices.The intersection has really all you'll ever need to select the 
contributing vertices. See the osg-CookBook for a reference example.


What I understand is that if I want to draw triangles but select exact vertices 
then I need to handle 2 different geometries, one with triangles for drawing 
and one with points for selection (and using your suggested technique with 
masks). Is that right?


No, you can use one graph and use a Polytope-intersector since 
point-line collisions are rare to practically impossible. I simply 
wanted to show an alternative, when using different pick/render-geometries.


Cheers
Sebastian



PS: at the time being I can live with the primitives / vertices approximation, 
but I want to get to the bottom of it eventually.

Kind regards,

Antoine.

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





___
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] Is it possible to clear just certain textures in a framebuffer with multi target rendering?

2017-09-13 Thread Sebastian Messerschmidt

Hi Amudhan,

Hi Sebastian,
Thanks for your reply.
It worked using 2 cameras passes to achieve the result. I was wondering to 
achieve the same result with single pass. I will be working huge models and i 
didn't want to run 2 passes.
Since you're doing MRT and multiple passes anyway, can't you simply add 
an otherwise empty pass that only clears? So basically binding the 
rendertarget you need to clear and do  nothing but clear.





Is there any plan to add this extension to OSG?
OpenSceneGraph is community driven anyone is invited to contribute. In 
my opinion adding extensions is usually a relatively complicated 
process, since there are a lot of side effects to be taken into account, 
but we're glad to help if you want to try.


Cheers
Sebastian


Thank you!

Thanks and Regards,
Amudhan

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





___
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] Is it possible to clear just certain textures in a framebuffer with multi target rendering?

2017-09-13 Thread Sebastian Messerschmidt

Hi,

This can usually done by setting the explicit drawbuffer and a 
consecutive call to glClear with the appropriate color set.
In OSG-terms I'd use a separate camera pass with the appropriate buffers 
bound. Another option, if you need to selectively write to a certain 
color buffer only is to use the ColorMaski to select the buffers you 
need to write to.


Last option is to add the extension to OSG.

Cheers
Sebastian



Hi,
Is it possible to clear just certain textures in a framebuffer with multi 
target rendering?

i am searching for equivalent functionality for glClearBufferfv.

Any help would be greatly appreciated.

example shader code:

out vec4 fragcolor1; // first target
out vec4 fragcolor2; // second target
void main()
{
   fragcolor1 = vec4(1.0,0.0,0.0,1.0);
   fragcolor2.g = 1.0;
}
  basically i want to initialize first target as osg::Vec4(0.0,0.0,0.0,0.0);
and i want to initialize my second target to osg::Vec4(1.0,0.0,0.0,0.0).

I tried calling setClearColor in osg::Camera, but this initializes both targets 
to same value.

Thanks & Regards,
amudhan

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





___
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] Problem blending multiple render passes

2017-09-09 Thread Sebastian Messerschmidt



Am 09.09.2017 um 14:42 schrieb antiro black:

Hi,

1. I enabled blending on the root node of the subtree containing the camera's, 
I'm assuming this is carried over to the camera nodes.
I'd rather enable it under the camera. Camera's have a default state set 
when created IIRC. So start by enabling blending in the camera itself.


2. I am using deferred rendering, all lighting calculations are based on the 
information in the GBuffer. I tried to get it to work with one camera and a 
subtree containing the lightvolumes with uniforms set per volume. However I 
couldn't get that to work, hence I thought I'd first try the simpler approach 
without writing to the stencil buffer.
You don't need the stencil buffer for this in any case. The stencil 
approach simply helps to improve performance here. Running a new camera 
per light basically is a full-screen pass per light! ...


3. I get that it is hard to help without example code and I am really grateful 
that you are trying anyways! The problem is that I have a pretty advanced 
rendering engine written in pure openGL. I decided that I wanted to port this 
to use OSG for improved cross platform compatibility (slowly starting to regret 
that decision...). This means that I'm working in a project of ~20k lines of 
code, which makes it really hard to isolate things into minimal examples. I 
never expected it to be this hard to restructure the project to work with OSG. 
The previous code is rather straight forward / low level: first run this 
shader, then run than shader etc. Now everything is attached to nodes in the 
scene graph and it is harder to for me wrap my head around the order things are 
happening in and how the openGL state is modified. If I ever get to the end of 
this, I might write a tutorial on porting pure openGL code to OSG. It will be 
the tutorial I wish I had right now :P


You can still, for the sake of understanding the problem, set up a small 
example doing two pass on one geometry.


In order to keep the mailing list pollution down you can also contact me 
on a private channel.


Cheers
Sebastian


Thank you!

Cheers,
antiro

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





___
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] Problem blending multiple render passes

2017-09-09 Thread Sebastian Messerschmidt

Hi Antiro,> Hi Sebastian,


So I screwed up on both the color clearing and the depth writing, I tried to 
disable both is follows.
On the cameras:

Code:

//Disable depth buffer writing
osg::ref_ptr depth = new osg::Depth(osg::Depth::LESS,0,1,false);
camera->getOrCreateStateSet()->setAttribute(depth);

//Disable writing to color buffer
GLbitfield mask = 0;
camera->setClearMask(mask);



The result was that (as expected) the geometry became extremely bright within a 
few frames (as I had forgotten to clear the output texture in between frames), 
but unexpectedly still from only a single light source. After I had fixed the 
texture clearing in between frames the result was the same as before: Only the 
result of a single lighting pass is visible.
I verified that this is the LAST pass, so it seems like the results of previous 
passes are overwritten instead of blended?


If you're using multiple passes the first pass needs to clear the buffer 
and all consecutive passes need to simply blend into it. Did you enable 
blending in the camera state set?




The reason I am using multiple passes is because I want to support an arbitrary 
(run time determined) number of light sources. Hence I can not just load a 
bunch of light sources into the uniforms of a single shader
So you're not doing deferred lighting? Usually one does blend all the 
lighting contributions to one texture by rendering all lights as boxes, 
spheres etc to limit the area in the lighting texture the light can 
contribute to using viewspace-calculations. There are tons of papers and 
blogs on how to do this.


Each light therefore is rendered in the same camera adding its 
contribution by simply rendering its hull-volume and carrying the light 
information in a bunch of uniforms per light. Since you have the 
depth-buffer (and therefore the viewspace/worldspace geometry 
coordiantes per fragment) you can calculate the light-geometry distance 
per fragment and therefore the light contribution.




If you have any other ideas of why my problems persist (or if I messed up with 
disabling color clearing/depth writing) please let me know!


Again: Try to create a minimal example! It's rather tedious to pull 
information out of someone's head in order to get the possible problems.


Cheers
Sebastian



Thank you!

Cheers,
antiro[/code]

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





___
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] Problem blending multiple render passes

2017-09-09 Thread Sebastian Messerschmidt

Hi Antiro,

Without the complete code it is hard to guess, but some things to check:

1. Are the consecutive cameras set up _not_ to clear the color buffer?
2. Have you disabled depth writes?


Hi,

I'm trying to compute the effect of multiple lights in a deferred shading 
setup. The subgraph of my scenegraph which is supposed to take care of this 
consists of a root node with a number of RTT cameras as children. All cameras 
are configured to write the effect of a single light to the exact same output 
texture.
On the root node I have (tried to) enable blending so the output texture will 
contain a combination of all the lighting that is computed, however, when I run 
the code, it only contains the lighting information of the last child camera 
(i.e. It is overwriting the output texture instead of blending it)

I have set up blending at the root node as follows:

Code:
auto passState=m_pointLightRoot->getOrCreateStateSet();
passState->setMode(GL_BLEND, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);
passState->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
osg::BlendFunc *blendFunc = new osg::BlendFunc(GL_ONE,GL_ONE);
osg::BlendEquation *blendEqn = new 
osg::BlendEquation(osg::BlendEquation::Equation::FUNC_ADD);
passState->setAttributeAndModes(blendFunc,osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);
passState->setAttributeAndModes(blendEqn,osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);




Is there something wrong with the way I set up blending? Or with my approach of 
having the different cameras as children of the root?
I would put all lights using the same shader under one group and one 
camera (e.g. one pass).


Cheers
Sebastian


Thank you!

Cheers,
antiro

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





___
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] Display one scene, pick from another one

2017-09-08 Thread Sebastian Messerschmidt

Hi Antoine,



I handle a scene which is very dense (~4M triangles) and displayed with 
triangles only (no line, nor points). I would like to select the vertices of 
this scene though (not the displayed triangles).

I thought of reusing the same osg::Geometry twice in the graph and with 
different states (PolygonMode::FILL and PolygonMode::POINT to name them).

1) This does not seem to work, as I seem to still have triangles returned by 
the pick, not points
2) I need to swap osg::Geometry, just for the pick and I have not managed to 
find a way through


From what you describe you don't need two scenes. The pick-reply will 
give you all information on the picked face (which vertex-indices, the 
intersection point) from which you can determine the vertex near to the 
picking point. (Picking vertices is almost impossible with a 
line-intersector anyways)


If you absolutely need two scene representations, you might consider 
using the TraversalMask and NodeMask, where you give the two scenes 
different NodeMasks at their roots and set the camera's and 
intersection-visitors traversal mask respectively.


HtH
Sebastian








Any idea?

Thanks a lot for reading (and if you can help, it is even better ;)).

Antoine.

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





___
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] Adapting a height field with a triangle/polygon?

2017-09-06 Thread Sebastian Messerschmidt

Hi Raymond,

If you're okay with having a regular mesh after your editing operation 
you can either use a vertex-texture that you modify or you can adapt a 
osgTerrain::GeometryTechnique to generate modified geometry patches. 
I've done this once for a game that used SimCity-style terrain 
sculpting. I can share portions of the code with you privately.


Cheers
Sebastian

Hi everyone,

I have a question about the implementation of an idea: I would like to 
adapt the vertices in a height field based on a triangle/polygon. So I 
would like to start with a height field and push/pull vertices with a 
triangle/polygon so that the height field is flattened according to the 
triangle/polygon.


This is a pretty new area for me so does someone have pointers to 
example code? I have browsed the examples but cannot find pointers at 
the moment. I am probably looking in the wrong places at the moment...


Thanks a lot, cheers,
Raymond

___
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] Efficient way to swap colors

2017-09-06 Thread Sebastian Messerschmidt

Hi Antoine,

Hello all

I have a mesh (a osg::Geometry) which I would like to change color depending on 
the mode it s in:

 osg::Geometry all white by default

 osg::Geometry all blue when selected



In order to achieve this I thought of using the BIND_OVERALL mode with 2 
Vec3Arrays (one array for the white color and the other one for the blue color) 
and simply swapping arrays to change the color (with 
osg::Geometry::setColorArray()), and calling dirtyDisplayList() to update.


Don't use display lists if you're planning on updating geometry on a 
regular base (since rebuilding a display list can be a rather costly 
operation). Use vertex buffer objects instead. In case you're modifying 
the complete geometry but no individual faces, you might consider using 
osg::Material or if you're using shaders anyways, simply set a uniform 
describing your color and specify it in the geometries state set.






Is this the most efficient way of changing the osg::Geometry color?

Depends ;-)

There usually isn't one most efficient way. In your case, swapping might 
be efficient, but you simply need to benchmark and decide for yourself 
which fits the bill.


Cheers
Sebastian


Thanks a lot,

Antoine[/list][/list]

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





___
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] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread Sebastian Messerschmidt
Hi. Sorry I don't on my computer right now, but it seems you are not providing vertex shaders. I'm not sure, but that might cause trouble. I'll get back to the issue tommorow or on Monday. 

Cheers
Sebastian
-- 
Sent from my Android phone with GMX Mail. Please excuse my brevity.On 9/2/17, 21:36 antiro black  wrote:
Hi Sebastian,
I'm compiling under debian jessie 64 bits and am running a NVIDIA GTX 970. The drivers have been updates recently and I am running version 384.69 now.
I included a compilable minimal example based on the osgmultiplerendertargets example. Without VertexAttributeAliasing it generates two texture using MRT, a red and a green one, it then combines these in a second pass to generate the final texture (yellow). (The red and green intermediate textures are shown in small quads to the side.)
When I enable the attribute aliasing (as in the included code), the two textures generated in the MRT pass turn into gradients, as if something has gone wrong with the mapping.
Screenshots:
The expected result (which I get without attribute aliasing): https://ibb.co/kHEogv
The result with aliasing: https://ibb.co/d9cfuF
Code:
/* OpenSceneGraph example, osgmultiplerendertargets.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//#include "RenderingUtility.h" //to easily view intermediate textures
//
// Below is relatively straight forward example of using the OpenGL multiple render targets (MRT) extension
// to FrameBufferObjects/GLSL shaders.
//
// Another, more sophisticated MRT example can be found in the osgstereomatch example.
//
osg::Geode *createScreenQuad(float width,
		 float height,
		 float scale,
		 osg::Vec3 corner)
{
		osg::Geometry* geom = osg::createTexturedQuadGeometry(
corner,
osg::Vec3(width, 0, 0),
osg::Vec3(0, height, 0),
0,
0,
scale,
scale);
		osg::ref_ptr quad = new osg::Geode;
		quad->addDrawable(geom);
		int values = osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED;
		quad->getOrCreateStateSet()->setAttribute(
new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK,
		 osg::PolygonMode::FILL),
values);
		quad->getOrCreateStateSet()->setMode(GL_LIGHTING, values);
		return quad.release();
}
osg::Camera *createHUDCamera(double left=0,
		 double right=1,
		 double bottom=0,
		 double top=1)
{
		osg::ref_ptr camera = new osg::Camera;
		camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
		camera->setClearMask(GL_DEPTH_BUFFER_BIT);
		camera->setRenderOrder(osg::Camera::POST_RENDER);
		camera->setAllowEventFocus(false);
		camera->setProjectionMatrix(osg::Matrix::ortho2D(left, right, bottom, top));
		camera->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
		return camera.release();
}
osg::ref_ptr createTextureDisplayQuad(
		const osg::Vec3 ,
		osg::StateAttribute *tex,
		float scale,
		float width=0.3,
		float height=0.2)
{
		osg::ref_ptr hc = createHUDCamera();
		hc->addChild(createScreenQuad(width, height, scale, pos));
		hc->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex);
		return hc;
}
// The callback modifies an input image.
struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback
{
MyCameraPostDrawCallback(osg::Image* image):
_image(image)
{
}
virtual void operator () (const osg::Camera& /*camera*/) const
{
if (_image && _image->getPixelFormat()==GL_RGBA && _image->getDataType()==GL_UNSIGNED_BYTE)
{
// we'll pick out the center 1/2 of the whole image,
int column_start = _image->s()/4;
int column_end = 3*column_start;
int row_start = _image->t()/4;
int row_end = 3*row_start;
// and then halve their contribution
for(int r=row_start; rdirty();
}
else if 

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread Sebastian Messerschmidt


Hi,

Unfortunately your example doesn't compile. If you provide a minimal 
(i.e. compileable ) example showing the problem we could take a look 
into it.

Due to copyright reasons I cannot give you an example from my code base.

Cheers
Sebastian

Hi,

I'm still struggling with getting setUseVertexAttributeAliasing(true) to 
combine rendering to textures.

To this end, I made made a tiny change to the osgmultiplerendertargets example 
to see if I could adapt that example to work with 
setUseVertexAttributeAliasing(true).

Aside from adding some lines to view the intermediate textures, my only change 
was enabling VertexAttributeAliasing as follows:


Code:
viewer.realize();
viewer.getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);




Given that the code only uses some fragment shaders, which use fixed colors and 
don't rely on things like gl_Vertex or gl_Normal I assumed no changes to them 
would be needed. Yet enabling VertexAttribute shaders breaks rendering, 
disabling it again fixes it.

Maybe I'm completely misunderstanding the idea behind VertexAttributeAliasing, 
all I want is to reuse the shaders from my other project, which requires 
control over the vertex attribute layout...
If anyone can tell me what I'm doing wrong or has a working example of MRT with 
setUseVertexAttributeAliasing(true), that would be highly appreciated.

For reference, here is the entire modified code:

Code:

/* OpenSceneGraph example, osgmultiplerendertargets.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 

#include 

#include 
#include 

#include "RenderingUtility.h" //to easily view intermediate textures
//
// Below is relatively straight forward example of using the OpenGL multiple 
render targets (MRT) extension
// to FrameBufferObjects/GLSL shaders.
//
// Another, more sophisticated MRT example can be found in the osgstereomatch 
example.
//


// The callback modifies an input image.
struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback
{
 MyCameraPostDrawCallback(osg::Image* image):
 _image(image)
 {
 }

 virtual void operator () (const osg::Camera& /*camera*/) const
 {
 if (_image && _image->getPixelFormat()==GL_RGBA && 
_image->getDataType()==GL_UNSIGNED_BYTE)
 {
 // we'll pick out the center 1/2 of the whole image,
 int column_start = _image->s()/4;
 int column_end = 3*column_start;

 int row_start = _image->t()/4;
 int row_end = 3*row_start;

 // and then halve their contribution
 for(int r=row_start; rdata(column_start, r);
 for(int c=column_start; cdirty();
 }
 else if (_image && _image->getPixelFormat()==GL_RGBA && 
_image->getDataType()==GL_FLOAT)
 {
 // we'll pick out the center 1/2 of the whole image,
 int column_start = _image->s()/4;
 int column_end = 3*column_start;

 int row_start = _image->t()/4;
 int row_end = 3*row_start;

 // and then halve their contribution
 for(int r=row_start; rdata(column_start, r);
 for(int c=column_start; cdirty();

 //print 

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread Sebastian Messerschmidt

Hi Chris,

I'm also transitioning a legacy GL OSG project with a mix of custom shaders to 
modern GL bit by bit. And I've also had lots of trouble and headache with the 
built-in modern GL vertex attrib aliasing setting.

It seems crazy that the official advice is to write shaders and use OSG just like legacy GL, and 
OSG will then change your shader code and reinterpret deprecated calls to make it work via 
"modern" GL: Obviously in years to come when GL newcomers want to use OSG the official 
line can't be "learn how GL was 20 years ago, write your OSG code like that, and the system 
will make it work".

So I'm afraid this isn't as simple as it could be, but of course it's still 
easier than converting raw GL calls..
Who told you something like this? OSG is totally capable of using modern 
GLSL. For some legacy support you might need to write appropriate 
visitors, but there is nothing stopping you using modern approaches.



Here is my only advice since I'm not yet finished myself:
My recommendation is just leave that attrib aliasing setting alone; you can use 
modern GL anyway. Just make sure that you use the setVertexAttribute() calls 
instead of setTextureCoords() / setNormals() / etc, and use the same attrib 
location numbering convention as OSG (I believe NVidia's drivers enforce those 
conventions, so you can get the vertex positions at loc=0).
Basically you're duplicating the vertexAttributeAliasing mechanism. 
There might be problems with non-conforming drivers, but in general the 
mapping is fixed on all conforming OpenGL drivers I've used (And the 
mechanism works on a lot of heterogeneous machines)





Then you'll want to get a copy of the ShaderGen class so you can customize  
because you'll likely want to modify it yourself. You can use this code to hook 
into osgDB::readNode()'s behavior to setup your shaders/attribs/etc the way you 
want.
I don't see how this is related to ShaderGen (I suppose you're talking 
about the old class). I strongly suggest to write your own shaders and 
use the setDefine (#pragmatic shader composition) mechanism to create 
shader variations.


Cheers
Sebastian

You then need to set useModelViewUniforms, which seems to be less harmful than 
useVertexAttribAliasing and will make sure osg_ModelViewMatrix is set.


Interested to compare notes on how you go anyway


http://www.hrwallingford.com/facilities/ship-simulation-centre 
(http://www.hrwallingford.com/facilities/ship-simulation-centre)

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





___
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] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread Sebastian Messerschmidt


Hi Antiro,

Hi,

I'm still struggling with getting setUseVertexAttributeAliasing(true) to 
combine rendering to textures.

To this end, I made made a tiny change to the osgmultiplerendertargets example 
to see if I could adapt that example to work with 
setUseVertexAttributeAliasing(true).

Aside from adding some lines to view the intermediate textures, my only change 
was enabling VertexAttributeAliasing as follows:


Code:
viewer.realize();
viewer.getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);
That's interesting. I've just checked my code-base and I definitively 
set up the aliasing very early before adding anything to the scene graph.




Given that the code only uses some fragment shaders, which use fixed colors and 
don't rely on things like gl_Vertex or gl_Normal I assumed no changes to them 
would be needed. Yet enabling VertexAttribute shaders breaks rendering, 
disabling it again fixes it.

Maybe I'm completely misunderstanding the idea behind VertexAttributeAliasing, 
all I want is to reuse the shaders from my other project, which requires 
control over the vertex attribute layout...
If anyone can tell me what I'm doing wrong or has a working example of MRT with 
setUseVertexAttributeAliasing(true), that would be highly appreciated.
Enabling the aliasing will also replace all gl_ things in the shaders 
you pass to the scene graph and it will simple add vertex attributes for 
all default attributes. See the State.cpp resetVertexAttributeAlias for 
reference.
There is no magic involved. Unfortunately I don't have any spare time to 
check your code sample, but I can promise that this definitively working 
without trouble. I've been using MRT with modern shaders for years in my 
deferred pipeline, and I don't recall having any problems at all. If 
you're using NVidia under windows you might consider using NSight to 
check your bindings.

What kind of GPU are you using? I experienced a lot of trouble using Intel.

Cheers
Sebastian


For reference, here is the entire modified code:

Code:

/* OpenSceneGraph example, osgmultiplerendertargets.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 

#include 

#include 
#include 

#include "RenderingUtility.h" //to easily view intermediate textures
//
// Below is relatively straight forward example of using the OpenGL multiple 
render targets (MRT) extension
// to FrameBufferObjects/GLSL shaders.
//
// Another, more sophisticated MRT example can be found in the osgstereomatch 
example.
//


// The callback modifies an input image.
struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback
{
 MyCameraPostDrawCallback(osg::Image* image):
 _image(image)
 {
 }

 virtual void operator () (const osg::Camera& /*camera*/) const
 {
 if (_image && _image->getPixelFormat()==GL_RGBA && 
_image->getDataType()==GL_UNSIGNED_BYTE)
 {
 // we'll pick out the center 1/2 of the whole image,
 int column_start = _image->s()/4;
 int column_end = 3*column_start;

 int row_start = _image->t()/4;
 int row_end = 3*row_start;

 // and then halve their contribution
 for(int r=row_start; rdata(column_start, r);
 for(int c=column_start; cdirty();
 }
 else if (_image && _image->getPixelFormat()==GL_RGBA && 
_image->getDataType()==GL_FLOAT)
 {
 // we'll pick out the center 1/2 of the whole image,
 int column_start = _image->s()/4;
 int column_end = 3*column_start;

 int 

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread Sebastian Messerschmidt

Hi Antiro,

I don't have an idea why it is not working.
For which camera's state set did you enable it?
Have you tried to check this with a simplistic non-MRT/FBO setup?
Which OSG-Version do you use (its working with 3.4.x definitively)

I've been using this for years, so there must be some error somewhere else.

Cheers
Sebastian

Hi Sebastian,

I was under the impression that the "layout(...) in ..." command was 
essentially a variable declaration and that hence only the location and type needed to 
match. I now also changed the name, this does not seem to have any effect though..

new vertex shader code:

Code:
#version 330 core
layout(location = 0) in vec4 osg_Vertex;
layout(location = 1) in vec3 osg_Normal;
layout(location = 2) in vec4 osg_Color;
layout(location = 3)in vec4 osg_MultiTexCoord0;
layout(location = 4)in vec4 osg_MultiTexCoord1;
layout(location = 5)in vec4 osg_MultiTexCoord2;
layout(location = 6)in vec4 osg_MultiTexCoord3;
layout(location = 7)in vec4 osg_MultiTexCoord4;
layout(location = 8)in vec4 osg_MultiTexCoord5;
layout(location = 9)in vec4 osg_MultiTexCoord6;
layout(location = 10)in vec4 osg_MultiTexCoord7;

out vec3 Normal;
out vec2 TexCoords;
out vec3 WorldPos;

uniform mat4 osg_ModelViewMatrix;
uniform mat3 osg_NormalMatrix;
uniform mat4 osg_ProjectionMatrix;


void main()
{
 gl_Position = osg_ProjectionMatrix * osg_ModelViewMatrix * osg_Vertex;
 WorldPos = (osg_ModelViewMatrix * osg_Vertex).xyz;
 Normal = osg_NormalMatrix * osg_Normal;
 TexCoords = osg_MultiTexCoord0.xy;

}



If I use the shader without the UseVertexAttributeAliasing enabled I see red 
silhouettes for the different models, when looking at the normals texture output (as 
if all normals are <1,0,0> ), which I expect is caused by the shader reading 
wrong  on unitialized attributes.

with UseVertexAttributeAliasing enabled I get no output.



Thank you!

Cheers,
antiro

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





___
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] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread Sebastian Messerschmidt

Hi Antiro,> Hi Sebastian,


Thanks for the quick response. The osg_XXX matrices work perfectly. The 
setUseVertexAttributeAliasing() however does not seem to work. Where I had some 
output before, now don't get anything with it enabled

Does osg always give the exact layout which you posted? or is this dependent on 
the data that is loaded?

for refence, here is a stripped down version of a geometry pass which I'm 
currently testing with (all 3 outputs are black with the attributeAliasing 
turned on):




Your code doesn't use the osg_ prefixed aliases at all. You really need 
to make the name and slot match...


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


Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread Sebastian Messerschmidt


Hi Antiro,


Hi,

I am converting a project written in pure opengl to use OSG to improve 
compatibility and reduce maintenance.  The original project used a deferred 
rendering pipeline with a pretty big set of custom shaders. I would like to 
reuse these shaders with minimum adjustments.

In order to do this I want to use the same uniform names and the same layout 
for the VAO. I figured out that I can add callbacks to set the ModelView / 
Projection / etc matrices to uniforms with the same names as used in in the 
shaders, so that is taken care of.

I do however not know how to specify the vertex attribute layout. My shaders 
all start with the following:
#version 330 core //so can't use gl_Normal etc
layout(location = 0) in vec3 position
layout(location = 1) in vec3 normal
layout(location = 2) in vec2 texCoords
layout(location = 

I'm currently just using osgDB::readNodeFile() to read in the geometry and I'm 
assuming I need to do something more sophisticated to control how the vertex 
attributes are organized, but have been unable to figure out what.

If anyone could point me in the right direction, that would be most helpful!


The easiest way is to convert the shaders to use the osg_ -prefix and to 
turn on the vertex attribute aliasing (basically all OSG will provide 
all gl_ inputs)


A list:

//OSG inputs
layout(location = 0) in vec4 osg_Vertex;
layout(location = 1) in vec3 osg_Normal;
layout(location = 2) in vec4 osg_Color;
layout(location = 3)in vec4 osg_MultiTexCoord0;
layout(location = 4)in vec4 osg_MultiTexCoord1;
layout(location = 5)in vec4 osg_MultiTexCoord2;
layout(location = 6)in vec4 osg_MultiTexCoord3;
layout(location = 7)in vec4 osg_MultiTexCoord4;
layout(location = 8)in vec4 osg_MultiTexCoord5;
layout(location = 9)in vec4 osg_MultiTexCoord6;
layout(location = 10)in vec4 osg_MultiTexCoord7;


In order to turn on aliasing:

viewer->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
viewer->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);

Note, that the first line will set up the gl_XYZMatrix aliases, so no 
need for a custom callback for this (at least for the std-matrices)


So you get these:
uniform mat4 osg_ModelViewProjectionMatrix;
uniform mat4 osg_ModelViewMatrix;
uniform mat4 osg_ViewMatrixInverse;
uniform mat3 osg_NormalMatrix;
uniform mat4 osg_ViewMatrix;
etc.

Cheers
Sebastian





Thank you!

Cheers,
antiro

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





___
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] Setting the transform matrices

2017-08-30 Thread Sebastian Messerschmidt

Hi Chris,> Hi Robert,


For now it'd be too time consuming to isolate a test case. Supporting modern 
OpenGL does seem like it would be more natural if you had some way of hooking 
into the setting of the model matrix and vertex attributes so that you could 
assign / name / alter them yourself.


You can use any matrix you like. Simply set it up as uniform and use it 
in the shader. Since there is underlying scenegraph you need to consider 
disabling culling for the node or set its matrix accordingly.


Your hooking can be done by simply adding a transform-group over your 
element and set the the desired matrix from there.
A minimal example explaining what you want to achieve might be very 
helpful.



Cheers
Sebastian



Cheers,
Chris


http://www.hrwallingford.com/facilities/ship-simulation-centre 
(http://www.hrwallingford.com/facilities/ship-simulation-centre)

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





___
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] Please test OpenSceneGraph-3.4 in prep for 3.4.1

2017-08-18 Thread Sebastian Messerschmidt

Hi Nickolai,

Robert wants something like this:

https://i.stack.imgur.com/SjnI9.png

It is called "Call stack" in VisualStudio.

Cheers
Sebastian


Do you mean this stack?



ntdll.dll!779315ee()

[Указанные ниже фреймы могут быть неверны и (или) отсутствовать, 
символы для ntdll.dll не загружены]
ntdll.dll!779315ee()
ntdll.dll!7792015e()
nvoglv32.dll!5e627fed() 
nvoglv32.dll!5dc2ea9d() 
osg.dll!54882912()  
osg.dll!5482aa94()  
osg.dll!5482fac2()  
osgViewer.dll!54bf6f3a()
kernel32.dll!755d14dd() 
osg.dll!547f3901()  
osgUtil.dll!54a3d27e()  
osgUtil.dll!54a399a5()  
osgUtil.dll!54a3d8a3()  
osgUtil.dll!54a3ab9f()  
osgUtil.dll!54a3dc76()  
osgUtil.dll!54a4112c()  
osg.dll!5483ec8b()  
OpenThreads.dll!5529218b()  
msvcr100.dll!7226c556() 
msvcr100.dll!7226c600() 
kernel32.dll!755d33ca() 
ntdll.dll!77949ed2()
ntdll.dll!77949ea5()




Did forcing the recreation of GL work?



I did not understand this question.

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





___
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] Dynamical loading of resources

2017-08-14 Thread Sebastian Messerschmidt


Hi Joachim,

Hi,

I was tasked with writing a visualizer for large 3D areas, the kind of areas 
that may not fit into RAM, either because they are too large, or because the 
RAM on the machine is not large enough ;).

I am new to OSG, this is my first post to the forum (hello, guys :)!). I was 
wondering how to perform out-of core handling of the 3D resources I intent to 
render. Its not possible for me to load everything and then start rendering, i 
need to constantly load new parts of the environment and unload geometry that 
is out of view.
That is where PagedLOD comes into play. It allows for background loading 
of tiles.


So I would like to know, is there any mechanism in OSG (or OSG Earth) which 
already supports this? Or would I have to implement it myself? Either way, I 
would be very happy if one of you could give me a rough explanation of how to 
approach this problem with OSG.


See the osgPagedLod example for reference.
If you need a resolution-pyramid approach, VPB(VirtualPlanetBuilder) can 
generate multiscale data for paging from various sources.
Sorry for just giving you pointers, but a short answer might be better 
than none ;-)


Thank you, I appreaciate yout help!

Cheers,
Jey

Cheers
Sebastian

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





___
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] Setting the transform matrices

2017-08-09 Thread Sebastian Messerschmidt

Hi Chris,


Why are you trying to override the default behavior in the first place?
Simply set the node's matrices by adding a transform node with absolute 
reference frame as parent/modify the camera's projection matrix. If you 
need it per graphics context you might consider using different scene 
graphs per camera(thus context).


Rather than asking for on obscure seeming approach, you might get more 
ideas by describing what you are after.


Cheers
Sebastian



Hi,

What is the proper way to set the view/projection matrix to a uniform yourself? 
I've found that trying to deal with the osg_ built-in uniforms which do all 
sorts of renaming etc is unreliable and would like to be able to just set 
everything myself manually.

At the moment I'm setting the view / projection matrix uniforms within the 
camera's initialdrawcallback, but I'm not sure if this is the right way to do 
it that will ensure the uniform value will only be used within that camera and 
not within other cameras (since it needs to work across multiple screens and 
render stages).

Is there some code within OSG that ensures that a uniform assigned to a camera 
will only apply to the graphics context for the thread that set it?


Thank you!

Cheers,
Chris


http://www.hrwallingford.com/facilities/ship-simulation-centre 
(http://www.hrwallingford.com/facilities/ship-simulation-centre)

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





___
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] RenderBin vs. SlaveCamera

2017-08-07 Thread Sebastian Messerschmidt


Hi Werner,

I'm using slave cameras only for certain multi-channel setups where I 
need multiple viewports rendering the same content with different 
frusta. For multipass applications (and I simply consider HUD to be a 
separate pass) I always use normal cameras (with absolute reference 
frame for fullscreen passes and relative for composing passes).


You can assign an explicit number to the camera order by using.

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

I use the PRE_RENDER scheme, since all passes of my offscreen rendering 
need to complete before the output is presented. Given your scenario you 
could of course simply set the render order of your HUD camera to 
something high.


Setting up rendering order with the Geometry RenderBin seems akward, 
since the HUD geometry is supposed to be rendered by the HUD-camera 
only. So a slave camera might not be the best option (apart from the 
fact, that the HUD is supposed to have its own projection and 
transform-matrix).


hth
Sebastian


Hi all,

I'm restructuring my project because I want to implement some multi pass 
effects.
I have some problems understanding the different approaches for example 
when

creating HUD displays.
The approach I used so far is attaching a SlaveCamera and puttung it in 
PostRender pass.
On the other hand I found an approach of just attaching the matrices to 
the root node and

assigning the HUD geometry to a RenderBin with high number.

I'd like to understand the difference of the approaches and the pros and 
cons.


Is there any one who can help me with that?

Thanks

- Werner -

___
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] OSG-GLSL triangle adjacency

2017-07-21 Thread Sebastian Messerschmidt

Hi Nabil,


Thank you Sebastian. So If i set the DrawArrays mode of the 
PrimitiveSet, does it suffice?

Otherwise, is it easy to implement? Sorry but i'm newby in OSG.

Can you elaborate on this?

Usually you need to set the program-parameter for output: 
GL_GEOMETRY_INPUT_TYPE and simply pass you geometry.


So when using triangles for instance, you need to pass 3 additional 
vertices per triangle (the neighboring ones). You can get the 
appropriate order from the openGL spec or various examples.
I'd start with a minimal example with a fixed vertex set to see what 
needs to be set in the state and program.



The osggeometryshader example might help here to get started.

Cheers
Sebastian


On 21 July 2017 at 09:36, Sebastian Messerschmidt 
<sebastian.messerschm...@gmx.de <mailto:sebastian.messerschm...@gmx.de>> 
wrote:




Hi Nabil,

Hello,
I'm using geometry shader with OSG to do some operations on mesh
using GPU.
When i use /triangles_adjacency/  in the input layout, my shader
crashes.
I tried with /layout(triangles) in/  and it's running well.

Is there any configuration in OSG that i should use, or a
pre-processing on the mesh to understand triangle adjacency?

You need to pre-process the mesh to get the adjacency information.
There is no facility in OSG that I know of, wich does this for you.


Cheers
Sebastian


Regards,
Nabil


___
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

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




--
Nabil Khalifa

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


Re: [osg-users] OSG-GLSL triangle adjacency

2017-07-21 Thread Sebastian Messerschmidt



Hi Nabil,

Hello,
I'm using geometry shader with OSG to do some operations on mesh using GPU.
When i use /triangles_adjacency/  in the input layout, my shader crashes.
I tried with /layout(triangles) in/  and it's running well.

Is there any configuration in OSG that i should use, or a pre-processing 
on the mesh to understand triangle adjacency?
You need to pre-process the mesh to get the adjacency information. There 
is no facility in OSG that I know of, wich does this for you.



Cheers
Sebastian


Regards,
Nabil


___
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] GLBeginEndAdapter

2017-07-21 Thread Sebastian Messerschmidt



Hi John,



Hi,

I am compiling some code with the current git repository version of OSG and found that 
State's "getGLBeginEndAdapter" has been removed.  Looking through the history, 
I see this happened at: commit e11e45a2e36de91bbe956223c43e8c5a50f9b72b.

The comment is only "Removed GLBeginEndAdapter as it is no longer needed".  
Well, my code seems to need it.  What do I need to do to update my code to not need it?  
(I realize this is fixed pipeline code, but it's old code and it works.  So a complete 
re-write is not desirable.)
The glBegin/End stuff is deprecated since OpenGL 2.0, which was released 
almost 13 Years ago, so it is long due.


The modern way is to use drawarrays. In your case it might be as simple 
as putting all the vertices into a vertex buffer and render it via a 
PimitiveSet using QUAD.


Take a look at the osggeometry-example. It covers all you need.
If you have detailed questions, feel free to consult the 
forum/mailing-list again.



Cheers
Sebastian




Code:
osg::GLBeginEndAdapter& gl = (state.getGLBeginEndAdapter());

gl.Color4fv(_surfaceColor.ptr());

bool drawBackSide = true;
bool drawFrontSide = true;

// draw back side.
if(drawBackSide)
{
   for(int i = 0; i + 1 <= _density; i++)
   {
 const auto az1 = _azMin + (i*azIncr);
 const auto az2 = _azMin + ((i + 1)*azIncr);

 gl.Begin(GL_QUAD_STRIP);
 for(int j = 0; j <= _density; j++)
 {
   ...



Thank you!

Cheers,
John
Code:




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





___
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] Escape Key

2017-07-19 Thread Sebastian Messerschmidt


Hi,

I've just checked. My osg-3.4.0 based code uses

"
else if (osgGA::GUIEventAdapter::KEY_Escape == ea.getKey())
"

so it obviously works ..
The Eventhandler is the first however (since it is a console), so maybe 
this might be worth a shot.


Cheers
Sebastian

Hello,

I am using an event handler for catching keyboard's escape key.

However, my osgGA::GUIEventAdapter::getKey() returns 0x1B, when it 
should be returning osgGA::GUIEventAdapter::KEY_Escape (which is 0xFF1B).


What's wrong here? the Osg's enum, or my code?


___
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] RTT + shaders example

2017-07-12 Thread Sebastian Messerschmidt


Hi Michael,


As a side note:
In order to get your matrices to your shaders simply use the osg_ 
equivalents to the gl_-Matrices and setup aliasing:


Viewer->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
Viewer->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);


In general you need to create the render-target textures and bind them 
to the FBO of your RTT-Camera. Basically there is the 
osgmultiplerendertargets example which shows you how to achieve this.


Once you have a working example rendering the gbuffer, you can simply 
add more absolute cameras to the graph to do the screenspace calculations.


Also take a look at osgPPU, which might offer some insight.

Cheers
Sebastian




Hi all,

I am trying to figure out RTT in combination with shaders for 
implementing a gbuffer but I can't get the different examples to work 
together.
This is a working example for using my shaders, but without RTT and also 
for setting the StateSet for the model and not the camera.


const char* vertSource =

 "#version 400\n"

 "uniform mat4 MV;\n"

 "uniform mat4 N;\n"

 "uniform mat4 P;\n"

 "layout(location = 0) in vec4 Vertex;\n"

 "layout(location = 1) in vec3 Normal;\n"

 "smooth out vec3 p;\n"

 "smooth out vec3 n;\n"

 "void main(void) {\n"

 "p = (MV * Vertex).xyz;\n"

 "n = normalize(N * vec4(Normal, 0)).xyz;\n"

 "gl_Position = P * vec4(p, 1);\n"

 "}\n";

const char* fragSource =

 "#version 400\n"

 "in vec3 p;\n"

 "in vec3 n;\n"

 "layout(location = 0) out vec4 position;\n"

 "layout(location = 1) out vec4 normal;\n"

 "layout(location = 2) out float depth;\n"

 "void main(void) {\n"

 "position = vec4(p,1);\n"

 "normal = vec4(n,0);\n"

 "depth = gl_FragCoord.z;\n"

 //"gl_FragColor = vec4(n,1);\n"

 "}\n";

#define Test1

struct ProjectionMatrixCallback: public osg::Uniform::Callback {

ProjectionMatrixCallback(osg::Camera* camera) :

_camera(camera) {

}

virtual void operator()(osg::Uniform* uniform, osg::NodeVisitor* nv) {

uniform->set(_camera->getProjectionMatrix());

}

osg::Camera* _camera;

};

struct NormalMatrixCallback: public osg::Uniform::Callback {

NormalMatrixCallback(osg::Camera* camera) :

_camera(camera) {

}

virtual void operator()(osg::Uniform* uniform, osg::NodeVisitor* nv) {

osg::Matrixd viewMatrix = _camera->getViewMatrix();

osg::Matrixd normalMatrix = osg::Matrix::inverse(viewMatrix);

uniform->set(normalMatrix);

}

osg::Camera* _camera;

};

struct ModelViewMatrixCallback: public osg::Uniform::Callback {

ModelViewMatrixCallback(osg::Camera* camera) :

_camera(camera) {

}

virtual void operator()(osg::Uniform* uniform, osg::NodeVisitor* nv) {

osg::Matrixd viewMatrix = _camera->getViewMatrix();

osg::Matrixd modelMatrix = 
osg::computeLocalToWorld(nv->getNodePath());

osg::Matrixd modelViewMatrix = modelMatrix * viewMatrix;

uniform->set(modelViewMatrix);

}

osg::Camera* _camera;

};

int main(int, char**) {

 osgViewer::Viewer viewer;

 osg::Node* model = osgDB::readNodeFile("cow.osgt");

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

 //create camera

 osg::Camera* camera = viewer.getCamera();

 // create shader

 osg::ref_ptr program = new osg::Program;

 program->setName("shader");

 program->addShader(new osg::Shader(osg::Shader::VERTEX, vertSource));

 program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragSource));

 osg::StateSet* state = model->getOrCreateStateSet();

 state->setAttributeAndModes(program.get(), osg::StateAttribute::ON);

 // add uniforms

 osg::Uniform* modelViewMatrix = new osg::Uniform(osg::Uniform::FLOAT_MAT4, 
"MV");

 modelViewMatrix->setUpdateCallback(new ModelViewMatrixCallback(camera));

 state->addUniform(modelViewMatrix);

 osg::Uniform* normalMatrix = new osg::Uniform(osg::Uniform::FLOAT_MAT4, 
"N");

 normalMatrix->setUpdateCallback(new NormalMatrixCallback(camera));

 state->addUniform(normalMatrix);

 osg::Uniform* projectionMatrix = new osg::Uniform(osg::Uniform::FLOAT_MAT4, 
"P");

 projectionMatrix->setUpdateCallback(new ProjectionMatrixCallback(camera));

 state->addUniform(projectionMatrix);

 // turn lights off

 state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

 // scene state run

 root->addChild(model);

 viewer.setSceneData(root.get());

 viewer.setUpViewOnSingleScreen(0);

 return viewer.run();

}

Another working example with RTT camera but without shaders can be found 

Re: [osg-users] EXTERNAL: Forum

2017-07-12 Thread Sebastian Messerschmidt

Hi,

Could you point to a specific post? The ones I checked at glance seem to 
be mirrored correctly.


Cheers
Sebastian


I could be wrong, but I don't think the link between the mail list and forum is 
working any more. I see quite a few new posts on the forums, and have not 
gotten them through the mail list.

-Original Message-
From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Sebastian Messerschmidt
Sent: Monday, July 10, 2017 4:10 AM
To: OpenSceneGraph Users
Subject: EXTERNAL: [osg-users] Forum

Hi folks,

The forum seems up and running again. My best guess is, that Art Tevs (who is 
hosting the forum) has fixed the issue.

Cheers
Sebastian
___
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


[osg-users] Forum

2017-07-10 Thread Sebastian Messerschmidt

Hi folks,

The forum seems up and running again. My best guess is, that Art Tevs 
(who is hosting the forum) has fixed the issue.


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


Re: [osg-users] OSG forum error: phpBB : Critical Error - Could not connect to the database

2017-06-30 Thread Sebastian Messerschmidt


Hi Chris,> If Art can't be found, AlphaPixel could take over hosting. 
But we'd
presumably need Art's assistance to get the web media and database 
copied to our server, which makes it sort of a chicken and egg problem. :(


Thank you for the offer.
If we take this step we should update the forum software anyways. I'm 
not terribly experienced with this kind of stuff, but I guess importing 
the posts should be possible. I'm not quite sure what to do about the 
accounts. There are literally 10.000 of them, 9000 not active 
postersMaybe we should discuss this with Robert.


Maybe someone in community has experiences setting up, up2date forums.


Cheers
Sebastian






On Thu, Jun 29, 2017 at 9:22 AM, Sebastian Messerschmidt 
<sebastian.messerschm...@gmx.de <mailto:sebastian.messerschm...@gmx.de>> 
wrote:


Hi Glenn,

We are aware the forum is down. We're still waiting for some contact
with Art Tevs.

Cheers
Sebastian > Greetings!

Subject OSG forum error:
Got message:

phpBB : Critical Error

Could not connect to the database

That is all!

David Glenn
Senior Graphics Software Engineer
TARIF Lab!
david.e.glenn@navy.mil <mailto:david.e.glenn@navy.mil>
760-939-3291 



___
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

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

___
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
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>




--
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/

Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 
4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP •Code Forensics •Digital Imaging • GIS • GPS • 
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • 
Mobile • iPhone/iPad/iOS • Android
@alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel 
<http://facebook.com/alphapixel> (775) 623-PIXL [7495]



___
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] OSG forum error: phpBB : Critical Error - Could not connect to the database

2017-06-29 Thread Sebastian Messerschmidt

Hi Glenn,

We are aware the forum is down. We're still waiting for some contact 
with Art Tevs.


Cheers
Sebastian > Greetings!

Subject OSG forum error:
Got message:

phpBB : Critical Error

Could not connect to the database

That is all!

David Glenn
Senior Graphics Software Engineer
TARIF Lab!
david.e.glenn@navy.mil
760-939-3291



___
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] osg::Group Child Problem

2017-06-13 Thread Sebastian Messerschmidt

Hi Latha,

You're most likely measuring your framerate with a debug-build.
Always measure in release-mode! OSG can easily handle tens of thousand 
of quads if the scene graph is well balanced.


Cheers
Sebastian


Hi

  in my  application i am drawing a quad about 1 kilometer length and 0.1 
meters width.i am getting frame rate Around 45 FPS.

 Now i am drawing each quad about 1 meter length and .1 meters width,then i 
am adding all quads to one group node, in this case i am getting frame rate 
around 25 FPS.

  is there any alternative way for drawing all quads of about 1 meter 
length and 0.1 meters width and adding to scene, for maintaining frame rate 
about 45 FPS ?

Thank you!

Cheers,
Latha

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





___
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] How to use openscenegraph to realize approaching zero driver overhead

2017-05-23 Thread Sebastian Messerschmidt

Hi Qiaokun,

Hi,

Approaching Zero Driver Overhead (Presented by NVIDIA) can substantially 
improved efficiency  in OpenGL. But, I don't find any interface to call AZDO in 
the osg source code. Can we realize it in osg finally?
If you encountered this problem, please tell me how to combine osg and AZDO. If 
I need to write new interface in osg source code?
There is no single interface, as AZDO is a more a paradigm than a 
concrete implementation. OSG offers various elements to help you 
approach it (e.g. various buffer objects, support for draw-instanced, 
indirect drawing etc, image load/store, bindless textures). There are 
some extensions which are currently not part of the OSG-core such as 
sparse textures, and various other improvements.



So in the end you'll have to invest some work to add the missing 
extension. Using the graph to use AZDO-techniques usually boils down to 
create the appropriate visitors or custom drawables. A good starting 
point (although not minimal example)  is the osggpucull example - it 
shows how to use draw-indirect on a scene graph. I successfully use this 
technique to render millions of instances of simple trees and thousands 
of complex elements like houses.


Cheers
Sebastian




Thank you!

Cheers,
Qiaokun

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





___
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] [osgPlugins] Osg to fbx

2017-05-09 Thread Sebastian Messerschmidt
It should work just fine with a newer FBX SDK. The API changed and it seems they changed the signature. If you need to use the old 2014 SDK simply change it to char *.

Cheers
Sebastian
-- 
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.Am 09.05.17, 16:38, Joe Kindle  schrieb:
sorry. i mean the latest stable release (3.4.0)

Thank you!

Cheers,
Joe

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





___
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] Multiple render passes and multithreading

2017-05-03 Thread Sebastian Messerschmidt

Hi Glenn,



Sebastian,

Have you tried setting the data variance to DYNAMIC on the StateSet
containing the Uniform?

That's the first thing I would try -- not sure whether it works on
Uniforms though.


Thanks, that indeed did the trick :-)
Thinking twice makes it obvious; declaring it dynamic will prevent it 
from being written to while being read.


Cheers
Sebastian



Glenn Waldron

On Wed, May 3, 2017 at 11:49 AM, Sebastian Messerschmidt
<sebastian.messerschm...@gmx.de <mailto:sebastian.messerschm...@gmx.de>>
wrote:

Hi,

I've just stumbled upon something I find hard to understand.
My setup contains multiple cameras (using FBO and MRT) with a
specific render-order set to them. The first camera is essentially a
render-scene-to-MRT pass.
In the simplest case a second camera will pick up the textures
rendered to and use them to draw to the framebuffer.

A cull-callback is attached to the group containing the cameras. The
callback simply extracts the current ViewMatrix and passes it to the
stateset as a uniform. This uniform is used in one of later
cameras/passed to reconstruct worldspace from the depth buffer.

Now while this all works great when setting the viewer to
SingleThreaded, it seems that using multithreading in the viewer
causes the Uniform for the ViewMatrix to be from the previous frame
in some cases. From my understanding the cull-visitor runs
asynchronously to the drawing, causing the uniform to be either from
the correct or from another frame.

What would be the multithreaded-cull/draw alternative to get the
ViewMatrix (or any other camera-related values) used for rendering
in the first camera down the chain reliably?

Cheers
Sebastian
___
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
<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


[osg-users] Multiple render passes and multithreading

2017-05-03 Thread Sebastian Messerschmidt

Hi,

I've just stumbled upon something I find hard to understand.
My setup contains multiple cameras (using FBO and MRT) with a specific 
render-order set to them. The first camera is essentially a 
render-scene-to-MRT pass.
In the simplest case a second camera will pick up the textures rendered 
to and use them to draw to the framebuffer.


A cull-callback is attached to the group containing the cameras. The 
callback simply extracts the current ViewMatrix and passes it to the 
stateset as a uniform. This uniform is used in one of later 
cameras/passed to reconstruct worldspace from the depth buffer.


Now while this all works great when setting the viewer to 
SingleThreaded, it seems that using multithreading in the viewer causes 
the Uniform for the ViewMatrix to be from the previous frame in some 
cases. From my understanding the cull-visitor runs asynchronously to the 
drawing, causing the uniform to be either from the correct or from 
another frame.


What would be the multithreaded-cull/draw alternative to get the 
ViewMatrix (or any other camera-related values) used for rendering in 
the first camera down the chain reliably?


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


Re: [osg-users] Test

2017-05-03 Thread Sebastian Messerschmidt



Works for me ;-)

HI All,

Just checking osg-users/forum is still up.

Robert.
___
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] Limitation of Displaying buildings, roads and trees etc to increase frame rate

2017-04-21 Thread Sebastian Messerschmidt

Hi Rambabu,

Hi,Actually iam able to displaying the buildings,roads on the terrain using 
shape files in osgearth,How to display the buildings,roads etc on the desktop 
screen coordinates only and how can i limit the remaining part where 
buildings,roads are loading for the purpose of increase of frame rate ?


Do you mean frustum culling? This already done by OSG. You can limit the 
number of items in the scene by using LODs with appropriate distances. 
Again: try to put some more effort in describing your problem.


Cheers
Sebastian



Iam using osg 3.4.0,osg earth 2.8.0,windows 8.1
Any Help is appreciated.

...

Thank you!

Cheers,
Rambabu

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





___
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] Regarding Slowing loading of buildings in osg

2017-04-21 Thread Sebastian Messerschmidt

Hi Rambabu,
  > Hi,Iam Using polygons and drapping the buildings texture on that in 
the terrain using osgearth,Buildings are coming but my problem is 
loading slowly in the output scene,How to load the buildings immediately 
after launching the output scene and upon moving from one place to 
another place buildings are loading slowly how to solve this?


You're not supplying any information on what your buildings are and what 
mechanism you use for loading the buildings. If this a osgEarth specific 
question you might want to use the osgEarth-forum


Cheers
Sebastian



Iam using osgearth 2.8.0,osg 3.4.0,windows 8.1
Any Help is appreciated.

...

Thank you!

Cheers,
Rambabu

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





___
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] Selective ClipNode

2017-04-18 Thread Sebastian Messerschmidt



Am 4/18/2017 um 2:17 PM schrieb Ale Maro:

Hi Sebastian,

I would like to avoid that becouse each node may have complex (dynamic) 
transformations so I should traverse the scene, calculate the global 
transformation for each node and update each transformation for the children of 
the sibling-group
Sorry I don't understand what you mean. If you simply put (at the top 
level) parts like this:


SCENE
|-CLIP
|-Childs
|-NON_CLIP  
|-Childs

the childs in this example can have arbitary transformations...
If you cannot place your nodes like this, you can take a look at the 
ClipNode-implementation and maybe inherit and change the parts that 
control the clipping state to set it effectively per child somehow.


The other option is to simply use a shader that implements the clipping 
and to switch it on/off via uniform.


Cheers
Sebastian




Ale

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





___
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] Selective ClipNode

2017-04-18 Thread Sebastian Messerschmidt

Hi Ale,


in my scene graph I have a root node of type osg::ClipNode.
In this way I can add easily clipping planes to my scene. This works fine.

Now I would like to exclude some nodes from clipping. I wonder if ClipNode 
supports something like a visitor mask to selectively apply clipping to 
children.
You can always put the nodes to be excluded from clipping into a 
sibling-group of the ClipNode.


Cheers
Sebastian


Thank you in advance.

Best regards
Ale

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





___
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] Fast move a lot of nodes to another group

2017-04-18 Thread Sebastian Messerschmidt



Am 4/15/2017 um 6:24 PM schrieb Yura Ivanov:

Hi,

I created stateset with bool uniform to indicate that node is selected and mat 
uniform with current mouse transform. To select nodes, I set this uniforms to 
nodes and all transformation preforms in shader. On mouse release, all 
transform applies to nodes by calling setMatrix and mat uniform sets to 
identity. Everything works fast and after all I don’t have extra nodes and 
statesets. Maybe my approach in this task is wrong, but many editors, for 
example 3dsMax, can work with big number of objects. And bad structure of scene 
in this case is user problem.
Thank you very much, especially for optimize.


This will disable "native" picking of the nodes however. Also I wonder 
why this should be more efficient than putting every node under a 
transform in the first place.
What you're doing is effectively a poor implementation of instancing. A 
better approach (if you want to use the uniform approach) is to setup a 
uniform buffer object (see [0]) containing the matrices and to use the 
draw-instanced version of your geometry to fetch it based on its 
gl_InstanceId. A version that scales better is to use a texture object 
to hold the matrices (see [1])



[0]
http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html

[1]
http://3dcgtutorials.blogspot.de/2013/08/instancing-with-openscenegraph.html

Cheers
Sebastian



Cheers,
Yura

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





___
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] Scale problem while transforming object in vertex shader

2017-04-18 Thread Sebastian Messerschmidt


Hi Yura

Hi,

I have a transform matrix and I want to apply it in shader. I pass it into 
uniform and set gl_Position = 
gl_ModelViewProjectionMatrix*my_transfrom_matrix*gl_Vertex.
If I set translate only, everything is ok. If I set translate and scale - 
translate multiplies by scale and transform is wrong (object is too far if 
scale>1.0). If I apply this transform not using shader (by SetMatrix) 
everything is ok. What I am doing wrong?

Matrix multiplication is not cummutative in every case.
Try
gl_Position = gl_ModelViewMatrix * matrix * gl_ProjectionMatrix * 
gl_Vertex.


Cheers
Sebastian



Thank you!

Cheers,
Yura

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





___
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] Lightning

2017-04-13 Thread Sebastian Messerschmidt

Hi Latha,



Hi,
I am working on 'Lighting' to blink lights on a sphere by making 
osg::StateAttribute ON and OFF ,its working fine.But i am
not able to make that sphere itself as light souce(means from sphere light is 
not diffusing,just it is blinking),how to apply different light properties.


If you need the Sphere to be a self-illuminated geometry you need to set 
the emissive-material properties (osg::Material. Alternatively you might 
want to check osgSim::LightPoint.


Cheers
Sebastian


Thank you!

Cheers,
Latha

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





___
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] Forum problems

2017-04-12 Thread Sebastian Messerschmidt

Hi Jannik,



Hi,

I've seen this quite often in the past; so far deleting the site cookies and 
logging back in always solved it (for a while anyway).

That indeed did the trick.

Cheers
Sebastian


Cheers,
Jannik

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





___
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] Forum problems

2017-04-12 Thread Sebastian Messerschmidt

Hi folks,

Is anyone else experiencing forum problems related to getting  a "502 
Bad Gateway" for some topics?
@Robert: I sent you a private message/email concerning the topic. Could 
you please check if you got it?


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


Re: [osg-users] Fast move a lot of nodes to another group

2017-04-10 Thread Sebastian Messerschmidt

Hi Yura,

Hi,

Quads are unique and images are different.
Sorry but I cant make screenshot of real images because of author. It is just 
like big puzzle. This is editor, and user decides how many objects can be.
I am using PagedLods to draw images and have no problem with memory. I have 
problem with moving a lot of nodes by user input. If I put put them into matrix 
i can move only it. This is fast but i need to move nodes to another group. 
Maybe I can use NodeCallback?


I think you need to think outside of the box here. There is more than 
one way to draw a collection of quads. You could render them as a big 
vertex array or even instanced and modify the sub-region of your vertex 
buffer/instance matrices instead of moving individual nodes around. If 
you need individual texturing, that still could be done via texture 
arrays or atlas-texturing.


If you absolutely want to keep them in your tree-structure you can still 
keep duplicates and simply turn them off by setting an appropriate 
node-mask (copy them to the new transform and disable drawing in the 
original group),
As a second step you could periodically sort the child vectors by the 
nodemask and batch-remove non-drawn childs from it (this is faster, 
since sorting doesn't need to resize the vector and removing a 
contiguous number of elements from the end of a vector is essentially free).


You could also apply the sort-prune algorithm in a custom osg::Group 
which will mark elements to be deleted instead of directly removing 
them. In the update phase it then could efficiently batch-sort and remove.


Anyways, this all theory as it still unclear what you want to achieve 
with your puzzle. We need more details or a small example to look at. If 
you cannot present the work, try to create a minimal example to 
demonstrate the problem (as a compilable example, so lazy people like me 
will take an actual look at it)


Cheers
Sebastian






Thank you!

Cheers,
Yura

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





___
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] NodeCallback does not traverse children

2017-04-10 Thread Sebastian Messerschmidt



Hi Yura,

Hi,

I have created NodeCallback like in example osggeometry to update 
MatrixTransform of all nodes in a group.
I applied it only for group: group.setUpdateCallback(mycallback);
In operator() of mycallback i am calling traverse(node,nv) but it works only 
for group, not for it children.
What i am doing wrong? Do I need to call setUpdateCallback for every child?


That is expected behavior. The callback is called for the element you 
added it to only. The traverse will simply tell the visitor to go on in 
its traversal so it can find nodes with an update-callback deeper  below 
your elements.
If you need to modify all childs anyways, you can run your own visitor 
from the entry of the callback.


Thank you!

Cheers,
Yura

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





___
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] Fast move a lot of nodes to another group

2017-04-04 Thread Sebastian Messerschmidt



Am 4/4/2017 um 3:53 PM schrieb Yura Ivanov:

Nodes are unique quads with editable geometry. I had no problem with 
performance exept removeChild when i tried to move them into transform matrix.
If you're actually holding all the childs in a single group, the remove 
will become horribly expensive (due to removal somewhere in the vector). 
Try to restructure your group to have a tree-like substructure 
(basically a quad-tree) to have smaller sets to work with.



 I would be nice if osg will have function to move node to another group 
whithout internal std remove and erease.
P.S. Sorry if my english is bad.


Cheers
Sebastian


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





___
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] Osg Earth

2017-04-04 Thread Sebastian Messerschmidt



Hi Ramababu,

Hi,Sebastian I added that dll but it is asking some other dlls i added those 
dlls also but again one error i.e ordinal 1338 not located in the dynamic link 
library for dirapi.dll.


You can use the dependency-walker [1] to see what dlls are missing.

[1] http://www.dependencywalker.com





...

Thank you!

Cheers,
Rambabu

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





___
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] Osg Earth

2017-04-04 Thread Sebastian Messerschmidt

Hi,


Hi, Iam loading the tiff image in osg earth then i got this ERROR 6: Unable to 
load PROJ.4 library (proj.dll), creation of OGRCoordinateTransformation 
failed.How to solve this ?


By reading the error message carefully and putting the appropriate 
proj.dll in the folder ;-)


Cheers
Sebastian



...

Thank you!

Cheers,
Rambabu

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





___
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] Fast move a lot of nodes to another group

2017-04-04 Thread Sebastian Messerschmidt



Hi Yura,

Hi,
I need to move a lot of nodes from Group to MatrixTransform to translate them 
into new position by user input, and then move them back into Group with new 
position. Call addChild and removeChild for each node is slow because of 
removeChild. Also I cant use removeChildren to remove all nodes at once because 
my node list is not continuous.
You could use the replaceChild like this: (assuming node is the Node to 
move and group its current parent)


transform = new MatrixTransform
transform->addChild(node);
group->replaceChild(node, transform);

This way the child list (implemented as a vector) is not changed in size 
for every operation.


Cheers
Sebastian



>



Thank you!

Cheers,
Yura

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





___
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] wireframe darker wrt the surface color

2017-04-04 Thread Sebastian Messerschmidt



Hi Gianni,



Thanks Nick,
I have to think it over since I've implemented a shader some months ago but  
I'm not really familiar with. The point would be how to get the real geometry 
color? BTW, I can try.


I finally managed to take a look at the attached video. Most probably 
your problem is lighting. Your surface is shaded correctly while your 
wireframe stays constant. At a certain angle the lit result is simply 
the same color as your constant wireframe. Can you present the relevant 
code, where you set up the wireframe?


Cheers
Sebastian




Anyway, isn't there a simpler way to get the desired result? Robert, any idea?

Regards,
Gianni

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





___
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] wireframe darker wrt the surface color

2017-03-27 Thread Sebastian Messerschmidt
Hi Gianni, 

Simply disable depth testing. (osg::Depth)

Cheers
Sebastian
-- 

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


Re: [osg-users] Polygon Rendering

2017-03-16 Thread Sebastian Messerschmidt



Hi Bhanu,

Hi,
I am drawing nearly 4000 Quads.How can i reduce number of triangles in 
geometry. I tried with osgUtil::simplifier but it takes more time to load.Is 
there any other ways in osg.
4000 isn't exactly many. If each quad is a separate drawable however it 
could induce some performance penalties.


1. use the osgUtil::Optimizer (to convert your quads to triangles and 
depending on their structure to on vertex array). Try ALL_OPTIMIZATIONS


2. If you need to simplify you can store the result and use it from then 
on.


Can you elaborate on the structure of your scene?

Cheers
Sebastian


...

Thank you!

Cheers,
Bhanu

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





___
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] How do cameras handle the render target?

2017-03-15 Thread Sebastian Messerschmidt
ds are issued.

Is it necessary having a finalDrawCallback instead?
I guess so. At least that worked for me, when I had to retrieve one of 
the textures written to in my chain.


Cheers
Sebastian



Thanks again

- Werner -

Am 15.03.2017 um 11:28 schrieb Sebastian Messerschmidt:


Hi Werner,


from diagonal reading:

You could make all cameras composing to the same FBO and get the
texture in a final pass that can either put the image to Framebuffer
or read back the texture. Also take a look at the screenshot example
(using pbuffer) and the various draw callbacks.

Cheers
Sebastian



Hi all.

I have a problem understanding how cameras handle render targets.
My special case:
I have a standard camera on a view.
The root node of the scene is a group with the following children:

- my model
- hud camera for wallpaper
- hud camera for text
- more cameras for special cases

All the cameras are children of the group node and do POST_RENDER
operation.

I need snapshots of the complete scene from various camera positions.
What I do:

osg::ref_ptrcamera=view->getCamera();

osg::ref_ptrfbImage=newosg::Image;

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

osg::Camera::RenderTargetImplementationrti=camera->getRenderTargetImplementation();

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);
camera->dirtyAttachmentMap();

Then I do snapshots with the modified projection matrix of the camera.
After each snapshot I read the contents of the fbImage.

I reset everything to the initial status by:

camera->setRenderTargetImplementation(rti);

camera->detach(osg::Camera::COLOR_BUFFER);

camera->dirtyAttachmentMap();


Unfortunately the fbImage always only contains my model but not the
child cameras renderings.
Attaching the fbImage to the child cameras as well gives me just a black
fbImage.
Of course the child cameras do not clear the color buffer.

What is the proper way of receiving the complete rendering? I also tried
already
installing a slave camera to the main camera but that also gives me only
the rendered model.
And rendering to the fbImage by installing an additional child camera
with POST_RENDER instead
of a slave camera leads to the same result.

Rendering to screen is perfect, but to fbImage is not.
It seems I'm blind on some basic functionality and all my research
doesn't open my eyes.

I instantly hope for some help.

Thanks

- Werner -


___
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


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


___
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] How do cameras handle the render target?

2017-03-15 Thread Sebastian Messerschmidt


Hi Werner,


from diagonal reading:

You could make all cameras composing to the same FBO and get the texture 
in a final pass that can either put the image to Framebuffer or read 
back the texture. Also take a look at the screenshot example (using 
pbuffer) and the various draw callbacks.


Cheers
Sebastian



Hi all.

I have a problem understanding how cameras handle render targets.
My special case:
I have a standard camera on a view.
The root node of the scene is a group with the following children:

- my model
- hud camera for wallpaper
- hud camera for text
- more cameras for special cases

All the cameras are children of the group node and do POST_RENDER operation.

I need snapshots of the complete scene from various camera positions.
What I do:

osg::ref_ptrcamera=view->getCamera();

osg::ref_ptrfbImage=newosg::Image;

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

osg::Camera::RenderTargetImplementationrti=camera->getRenderTargetImplementation();
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);
camera->dirtyAttachmentMap();

Then I do snapshots with the modified projection matrix of the camera.
After each snapshot I read the contents of the fbImage.

I reset everything to the initial status by:

camera->setRenderTargetImplementation(rti);

camera->detach(osg::Camera::COLOR_BUFFER);

camera->dirtyAttachmentMap();


Unfortunately the fbImage always only contains my model but not the
child cameras renderings.
Attaching the fbImage to the child cameras as well gives me just a black
fbImage.
Of course the child cameras do not clear the color buffer.

What is the proper way of receiving the complete rendering? I also tried
already
installing a slave camera to the main camera but that also gives me only
the rendered model.
And rendering to the fbImage by installing an additional child camera
with POST_RENDER instead
of a slave camera leads to the same result.

Rendering to screen is perfect, but to fbImage is not.
It seems I'm blind on some basic functionality and all my research
doesn't open my eyes.

I instantly hope for some help.

Thanks

- Werner -


___
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] bounding box collisions (without osgbullet)

2017-03-13 Thread Sebastian Messerschmidt

Hi Nick

Hi Sebastian,

it is for simulation, i have a moving entity and a terrain (with 
buildings etc). Now I am not after triangle level intersection, but 
after Entity BBox collision with the terrain (enough is true false). I 
was thinking to do it really very simple by having LOS rays from the 
entity center to the corners of the BBox. The entity can move in any 
direction
May the standard manipulators are a good start. Some of them perform 
collsion detection. A number of LOS-intersectors will do the job, too ;-)


Cheers
Sebastian






On Mon, Mar 13, 2017 at 9:41 PM, Sebastian Messerschmidt 
<sebastian.messerschm...@gmx.de 
<mailto:sebastian.messerschm...@gmx.de>> wrote:


Hi Nick,

basically this is not an easy task. What exactly do you expect as
a collision result?
I've implemented a triangle-box collision with MTD (minimal
transform distance = vector describing how to push the box to get
it exactly away from the colliding triangle). OSG has all the math
facilities to do this, but I guess you'll save a lot of headache
using pyhsics etc. for dynamics. So maybe try to explain the
problem you're trying to solve a bit more in detail.

Cheers
Sebastian


no one on this?

On Sun, Mar 12, 2017 at 9:53 PM, Trajce Nikolov NICK
<trajce.nikolov.n...@gmail.com
<mailto:trajce.nikolov.n...@gmail.com>> wrote:

Hi community,

what would be the best way to implement bbox collision with
terrain, from what is already in OSG (no bullet etc)?

thanks a bunch as always,
Nick

-- 
trajce nikolov nick





-- 
trajce nikolov nick



___
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
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>

___ 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
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>


--
trajce nikolov nick

___
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] bounding box collisions (without osgbullet)

2017-03-13 Thread Sebastian Messerschmidt

Hi Nick,

basically this is not an easy task. What exactly do you expect as a 
collision result?
I've implemented a triangle-box collision with MTD (minimal transform 
distance = vector describing how to push the box to get it exactly away 
from the colliding triangle). OSG has all the math facilities to do 
this, but I guess you'll save a lot of headache using pyhsics etc. for 
dynamics. So maybe try to explain the problem you're trying to solve a 
bit more in detail.


Cheers
Sebastian


no one on this?

On Sun, Mar 12, 2017 at 9:53 PM, Trajce Nikolov NICK 
> 
wrote:


Hi community,

what would be the best way to implement bbox collision with
terrain, from what is already in OSG (no bullet etc)?

thanks a bunch as always,
Nick

-- 
trajce nikolov nick





--
trajce nikolov nick


___
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] Displaying Geode Bounding Box

2017-03-09 Thread Sebastian Messerschmidt



Hi Sam,


Hi All,

Is there a simple way to display the bounding box of Geode or Geometry?
Or will I have to write up something to do it?


osgWorks[1] might yield something ( osgwbvv)


[1] https://github.com/mccdo/osgworks
Cheers
Sebastian


Thanks, Sam


___
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] [ A Stack Overflow for OSG? ]

2017-03-08 Thread Sebastian Messerschmidt

Hi Johny, Valerian



Dude shut the fuck up lmao


refrain from yelling insults, ad hominem and use of explicit language.
...

Cheers
Sebastian





kragnfroll wrote:

Hi Steal

It seems that you're suffering of something call narcissistic perversion.

Everyone spotted you, you won't be able to harm anyone here.

Best you can do is to consult and get treated for it.

Thank you!

Cheers,
Valerian



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





___
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] Paint splashes / How do I decal?

2017-03-08 Thread Sebastian Messerschmidt

Hi,



Ok wow but what does it mean?

Screen space sounds evil. I can't really get any hard results on Google for it.
Basically the first hit gives an implementation guideline and links to 
the other techniques I've mentioned:


http://martindevans.me/game-development/2015/02/27/Drawing-Stuff-On-Other-Stuff-With-Deferred-Screenspace-Decals/

where the latter works if you have at least a depth buffer in your FBO..


Cheers
Sebastian


Thank you!

Cheers,
Johny

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





___
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] Paint splashes / How do I decal?

2017-03-07 Thread Sebastian Messerschmidt



Hi Johny

And why not a geometry approach?
You can totally use 3d models, but that might induce z-fighting, sorting 
problems etc. Another option is of course using a world-space spanning 
texture per object-instance and managing drawing to this texture at the 
right spots. This isn't very memory friendly however.


It seemed to me, that you have a multipass-shader implementation anyways 
so using screen space decals might be the best option. (And I've got 
good experiences using it)


Cheers
Sebastian



SMesserschmidt wrote:

Hi Johny,



Here's Johny!

I'd like to know how to pick a 3d point in my model onto which a decal will 
nearly wrap itself around to. Am I using the right word here, or does Open 
Scene Graph not have this feature? Before I'm rigging my app with a custom 
decal, I'd like to know what's available, or what tools I can already work with.


There is no specific API, but you can use projective texturing or
screenspace decals (using FBO and shaders).

Cheers
Sebastian



Thank is great.

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





___
osg-users mailing list

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



___
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=70419#70419





___
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] Paint splashes / How do I decal?

2017-03-07 Thread Sebastian Messerschmidt

Hi Johny,


Here's Johny!

I'd like to know how to pick a 3d point in my model onto which a decal will 
nearly wrap itself around to. Am I using the right word here, or does Open 
Scene Graph not have this feature? Before I'm rigging my app with a custom 
decal, I'd like to know what's available, or what tools I can already work with.
There is no specific API, but you can use projective texturing or 
screenspace decals (using FBO and shaders).


Cheers
Sebastian


Thank is great.

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





___
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] Height of terrain

2017-03-03 Thread Sebastian Messerschmidt

Hi Bhanu,

We surely cannot help you without the data you use.
But try to use a Z-Value that is actually _above_ the the terrain might 
help.


Cheers
Sebastian


Hi,
I tried with following expression
double X = 8489499, Y = 1115164, Z = 0;
uble height = 
sgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),osg::Vec3(X, 
Y, Z));
  I am getting  height  value as 0. Can any one help me.
...

Thank you!

Cheers,
Bhanu

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





___
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


  1   2   3   4   5   6   7   8   9   10   >