Re: [osg-users] [osgPlugins] How to add Animations stored in Fbx to another Fbx model

2013-06-18 Thread Sergey Polischuk
Hi

You can do this trick only with animations applied to identical models: 
vertices, bones and transforms names\hierarchy etc. should be same in both 
models, just animation is different.

You can't hotswap animation from different model.

Cheers.

18.06.2013, 11:08, Sebastian Messerschmidt sebastian.messerschm...@gmx.de:
 Hi,

 I'm trying to do the same thing. I've got two models (fbx). The first
 one is containing an animation and a skeleton with (rigged) geometry.
 The second file contains an animation and another skeleton.

 Unfortunately, the merging approach doesn't seem to work. I can animate
 the second one, but I cannot apply the animation to the first skeleton.
 Any idea, how to apply the second animation to the first skeleton?

 I've already tried to replace the second skeleton with the first one,
 but no luck.

 Or maybe someone can provide an example model with animation(s) in a
 second file.

 cheers
 Sebastian

  void mergeAnimation(osg::Node* mainModel, osg::Node* mergeModel)
  {
  FindAnimationManagerVisitor famvMain;
  mainModel-accept(famvMain);
  osgAnimation::AnimationManagerBase* animationManagerMain = 
 famvMain.getAnimationManager();
  if (animationManagerMain == 0)
  throw std::logic_error(no animation manager found in main 
 model);

  FindAnimationManagerVisitor famv;
  mergeModel-accept(famv);
  osgAnimation::AnimationManagerBase* animationManager = 
 famv.getAnimationManager();
  if (animationManager == 0)
  throw std::logic_error(no animation manager found in 
 secondary model);

  const osgAnimation::AnimationList list = 
 animationManager-getAnimationList();
  for (osgAnimation::AnimationList::const_iterator ai = list.begin(); 
 ai != list.end(); ai++)
  animationManagerMain-registerAnimation(*ai);
  }

  28.05.2013, 08:27, Michael Borst mich...@jborst.de:
  Do you have sample code,
  maybe i am just missing one importent line or flag to be set

  Thank you!

  Cheers,
  Michael

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

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


Re: [osg-users] [osgPlugins] How to add Animations stored in Fbx to another Fbx model

2013-05-28 Thread Sergey Polischuk
void mergeAnimation(osg::Node* mainModel, osg::Node* mergeModel)
{
FindAnimationManagerVisitor famvMain;
mainModel-accept(famvMain);
osgAnimation::AnimationManagerBase* animationManagerMain = 
famvMain.getAnimationManager();
if (animationManagerMain == 0)
throw std::logic_error(no animation manager found in main 
model);

FindAnimationManagerVisitor famv;
mergeModel-accept(famv);
osgAnimation::AnimationManagerBase* animationManager = 
famv.getAnimationManager();
if (animationManager == 0)
throw std::logic_error(no animation manager found in secondary 
model);

const osgAnimation::AnimationList list = 
animationManager-getAnimationList();
for (osgAnimation::AnimationList::const_iterator ai = list.begin(); ai 
!= list.end(); ai++)
animationManagerMain-registerAnimation(*ai);
}

28.05.2013, 08:27, Michael Borst mich...@jborst.de:
 Do you have sample code,
 maybe i am just missing one importent line or flag to be set

 Thank you!

 Cheers,
 Michael

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

 ___
 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] How to add Animations stored in Fbx to another Fbx model

2013-05-27 Thread Sergey Polischuk
Hi

idk, for me it worked out of the box :)

Cheers.

27.05.2013, 11:32, Michael Borst mich...@jborst.de:
 Hi,
 if i do that, the programm shows me that it is playing the correct animation 
 with every detail correct (Playtime, currently Playing, name etc) but i don't 
 see anything, the model still has its arms spread like a bird and does 
 nothing.

 Am i missing something?

 Thank you!

 Cheers,
 Michael

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

 ___
 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] [OT] Is it legal to collect video card information?

2013-05-24 Thread Sergey Polischuk
Hi you can just give user option or warning about what info is collected Cheers. 24.05.2013, 16:28, "michael kapelko" korn...@gmail.com:Hi.Sorry for off-topic question, but I'm curious if it's legal to collect user video card information like GL_VENDOR, GL_MAX_TEXTURE_UNITS and such to create some possibly public DB with very detailed info about various video cards for the purpose of video settings autoselection in games? Thanks. ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] osgParticle::ExplosionEffect: assistance needed

2013-05-16 Thread Sergey Polischuk
Hi, Mike

1) you can't load from QT resources via osg out of the box. You can write 
osgDB::ReadFileCallback (and register it via osgDB::Registry) which will open 
QFile from path specified, read data from it into stream and load object from 
that stream with correct osgDB plugins.

2) matrix transform should work ok... particle emitter and processors have 
reference frame and if it not set to absolute - should respect parent 
transforms. Check if you set correct rotation matrix.

Cheers,
Sergey.

09.05.2013, 21:37, Mike Metcalf metcalfnos...@mac.com:
 I have been exploring osgParticle::ExplosionEffect for use with our software 
 and have run into a few things I haven't yet been able to figure out.

 1) We use the Qt resource system to compile and link into our executable some 
 of the binary resources we need, including some images. I have used this 
 system to store a .png file as a resource and have been trying to use that 
 png file as the texture for the particle effects in an ExplosionEffect. When 
 I invoke myExplosion-setTextureFileName(:explosiontexture), the texture 
 appears not to have been loaded. When I invoke it with an actual path to the 
 same file sitting on my hard drive, it works without problem. So, can anyone 
 tell me if the Qt Resource system's naming convention for referring to 
 internal binary resources is in some way usable with the setTextureFileName 
 interface in ExplosionEffects?

 2) The ExplosionEffect seems to be oriented with a z-up orientation. I am 
 using OSGEarth and would like to have the explosions oriented at a local up 
 axis, not a global z-up axis. I tried to add my explosions as a child of a 
 MatrixTransform, but this seemed not to have the desired effect. Any tips or 
 tricks on what my best options are?

 Thanks in advance for any help you may provide!
 -Mike

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

 ___
 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] How to add Animations stored in Fbx to another Fbx model

2013-05-05 Thread Sergey Polischuk
Hi

if models are same besides animation, you can just grab osgAnimation::Animation 
pointer from animation manager of one model and register it in animation 
manager from another model

22.04.2013, 23:42, Michael Borst mich...@jborst.de:
 Hi,

 we bought severall Models in .fbx with Animations.
 Most of the Animations lie in seperated .Fbx files.
 How can i add the Animations out of an .fbx file(with no Model included) to 
 another Model out of another .fbx file?

 Thank you!

 Cheers,
 Michael

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

 ___
 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] indexing model - loss of data

2013-04-25 Thread Sergey Polischuk
Hi all

once i've wrote small utility to optimize models with rig geometry, which, 
among other things, apply INDEX_MESH, VERTEX_PRETRANSFORM, VERTEX_POSTTRANSFORM 
optimizations and remaps vertex influences of rig geometry to new vertex 
indices. Now it suddenly dont work any more.

Problem is that after indexing geometry, there are not enough matches between 
old vertex attributes and new vertex attributes (some old vertex attribute 
values cant be found in new vertex attribute arrays after indexing, which means 
some data is lost).

here is some simplified code to show problem:

//

template typename T bool compare(T* r, unsigned ri, T* l, unsigned li) 
//compares two array elements
{
if ((*r)[ri]  (*l)[li])
return false;
if ((*l)[li]  (*r)[ri])
return false;

return true;
}

bool cmp (osg::Geometry::ArrayList rhs, unsigned rhsi, 
osg::Geometry::ArrayList lhs, unsigned lhsi) //compares all [rhsi] elements 
from rhs array list with all [lhsi] elements in lhs array list
{
if (rhs.size() != lhs.size())
throw std::logic_error(different vertex attrib arrays count 
before and after optimizations, cant do anything);
bool result = true;
for (unsigned i = 0; i rhs.size(); i++)
{
bool compared = false;
if (!result)
return result;
{
osg::Vec3Array* r = 
dynamic_castosg::Vec3Array*(rhs[i]);
osg::Vec3Array* l = 
dynamic_castosg::Vec3Array*(lhs[i]);
if (r  l)
{
result = result  compare(r, rhsi, l, lhsi);
compared = true;
}
}
{
osg::Vec2Array* r = 
dynamic_castosg::Vec2Array*(rhs[i]);
osg::Vec2Array* l = 
dynamic_castosg::Vec2Array*(lhs[i]);
if (r  l)
{
result = result  compare(r, rhsi, l, lhsi);
compared = true;
}
}
if (!compared)
return false;
}
return result;
}

void acceptMesh(osgAnimation::RigGeometry* rg)
{
osg::Geometry* g = rg-getSourceGeometry();

osg::ref_ptrosg::Geometry origG = new osg::Geometry(*g, 
osg::CopyOp::DEEP_COPY_ALL);

osg::Geometry::ArrayList alold;
origG-getArrayList(alold);
osg::ref_ptrosg::Vec3Array origVerts = 
dynamic_castosg::Vec3Array*(origG-getVertexArray());

osgUtil::IndexMeshVisitor imv;
imv.makeMesh(*g);

osg::Geometry::ArrayList alnew;
g-getArrayList(alnew);

std::mapint, int vertsMap;//store matches between old and new 
vertexattrib arrays in pairs [old_index, new_index]
osg::ref_ptrosg::Vec3Array newVerts = 
dynamic_castosg::Vec3Array*(g-getVertexArray());

unsigned id = 0;
for (osg::Vec3Array::iterator itr = origVerts-begin(); itr != 
origVerts-end(); itr++)
{
unsigned nid = 0;
for (osg::Vec3Array::iterator itr2 = newVerts-begin(); 
itr2 != newVerts-end(); itr2++)
{
if (cmp(alold, id, alnew, nid))//found match
{
vertsMap[id] = nid;
break;
}
nid++;
}
id++;
}
std::cerrorigVerts size:origVerts-size()std::endl;
std::cerrverts map size:vertsMap.size()std::endl;
}

/

here size of vertsMap map should be same as original vertex count, and it isnt, 
which means some data is lost when indexing geometry (and comparing floating 
point values with thresholds does not change anything, i've tested it).

Any ideas about what could go wrong? May be there was some changes to the way 
IndexMeshVisitor works? I'm testing on osg svn version updated last week or so.

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


Re: [osg-users] indexing model - loss of data

2013-04-25 Thread Sergey Polischuk
Hi yes, it's doing just that, but it written in a way to keep duplicate vertices with same position if other vertex attributes for this vertex is different. I checked it's sources and all looks fine to me. Also, same code was working fine like half a year ago. Cheers. 25.04.2013, 21:06, "Glenn Waldron" gwald...@gmail.com:Sergey,I believe the IndexMeshVisitor attempts to detect and remove duplicate vertices. Could that be the reason? Glenn Waldron / @glennwaldronOn Thu, Apr 25, 2013 at 11:16 AM, Sergey Polischuk pol...@yandex.ru wrote:Hi all  once i've wrote small utility to optimize models with rig geometry, which, among other things, apply INDEX_MESH, VERTEX_PRETRANSFORM, VERTEX_POSTTRANSFORM optimizations and remaps vertex influences of rig geometry to new vertex indices. Now it suddenly dont work any more.  Problem is that after indexing geometry, there are not enough matches between old vertex attributes and new vertex attributes (some old vertex attribute values cant be found in new vertex attribute arrays after indexing, which means some data is lost).  here is some simplified code to show problem:  //  template typename T bool compare(T* r, unsigned ri, T* l, unsigned li) //compares two array elements {         if ((*r)[ri]  (*l)[li])                 return false;         if ((*l)[li]  (*r)[ri])                 return false;          return true; }  bool cmp (osg::Geometry::ArrayList rhs, unsigned rhsi, osg::Geometry::ArrayList lhs, unsigned lhsi) //compares all [rhsi] elements from rhs array list with all [lhsi] elements in lhs array list {         if (rhs.size() != lhs.size())                 throw std::logic_error("different vertex attrib arrays count before and after optimizations, cant do anything");         bool result = true;         for (unsigned i = 0; i rhs.size(); i++)         {                 bool compared = false;                 if (!result)                         return result;                 {                         osg::Vec3Array* r = dynamic_castosg::Vec3Array*(rhs[i]);                         osg::Vec3Array* l = dynamic_castosg::Vec3Array*(lhs[i]);                         if (r  l)                         {                                 result = result  compare(r, rhsi, l, lhsi);                                 compared = true;                         }                 }                 {                         osg::Vec2Array* r = dynamic_castosg::Vec2Array*(rhs[i]);                         osg::Vec2Array* l = dynamic_castosg::Vec2Array*(lhs[i]);                         if (r  l)                         {                                 result = result  compare(r, rhsi, l, lhsi);                                 compared = true;                         }                 }                 if (!compared)                         return false;         }         return result; }          void acceptMesh(osgAnimation::RigGeometry* rg)         {                 osg::Geometry* g = rg-getSourceGeometry();                  osg::ref_ptrosg::Geometry origG = new osg::Geometry(*g, osg::CopyOp::DEEP_COPY_ALL);                  osg::Geometry::ArrayList alold;                 origG-getArrayList(alold);                 osg::ref_ptrosg::Vec3Array origVerts = dynamic_castosg::Vec3Array*(origG-getVertexArray());                  osgUtil::IndexMeshVisitor imv;                 imv.makeMesh(*g);                  osg::Geometry::ArrayList alnew;                 g-getArrayList(alnew);                  std::mapint, int vertsMap;//store matches between old and new vertexattrib arrays in pairs [old_index, new_index]                 osg::ref_ptrosg::Vec3Array newVerts = dynamic_castosg::Vec3Array*(g-getVertexArray());                  unsigned id = 0;                 for (osg::Vec3Array::iterator itr = origVerts-begin(); itr != origVerts-end(); itr++)                 {                         unsigned nid = 0;                         for (osg::Vec3Array::iterator itr2 = newVerts-begin(); itr2 != newVerts-end(); itr2++)                         {                                 if (cmp(alold, id, alnew, nid))//found match                                 {                                         vertsMap[id] = nid;                                         break;                                 }                                 nid++;                         }                         id++;                 }                 std::cerr"origVerts size:"origVerts-size()std::endl;                 std::cerr"verts map size:"vertsMap.size()std::endl;         }  /  here size of vertsMap map should be same as original vertex count, and it isnt, which means some data is lost when indexing geometry (and comparing floating point values with thresholds does not change anything, i've tested it).  Any ideas about what could go wrong? May be there was some change

Re: [osg-users] culling and vertex shaders still a problem

2013-04-23 Thread Sergey Polischuk
Hi

if you dont need camera view matrix in shaders (i believe you need only 
projection matrix for your task):
you can place this geode under matrix transform with reference frame set to 
ABSOLUTE_RF, and position it somewhere in front of camera with identity view 
matrix, this should solve culling issues.
or you can even add ortho projection here and pass camera projection matrix via 
uniform for calculations in shader.

Cheers.

22.04.2013, 23:34, Anton Fuhrmann fuhrm...@vrvis.at:
 Hi,

 I need to disable culling on a geode which implements a skydome/plane as a 
 shader.

 The problem is that the vertex shader places the existing vertices 
 screen-aligned at the far plane, but OSG still thinks they are in their 
 original positions.

 This problem as already been discussed - but not conclusively solved - in 
 other threads:
 (cannot post URLs at the moment)
 viewtopic.php?t=20300
 viewtopic.php?t=10912

 For this situation, disabling the culling is necessary because I do not want 
 the scene to include the real positions of the sky plane at infinity. It 
 would defy near/far calculation and I would need to introduce a callback that 
 recalculates the positions outside the vertex shader just so that the skydome 
 node does not get clipped.

 I already tried
 Code:
 Geode-setCullingActive(false)

 and
 Code:
 Camera()-setCullingMode( osg::CullSettings::NO_CULLING )

 but both cull my node as soon as the original vertex positions are behind the 
 camera.

 My workaround at the moment is to set the initial bounds very large, but this 
 is unnecessarily inflates the BBox of the real scene.

 Any suggestions would be appreciated!

 ...

 Thank you!

 Cheers,
 Anton

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

 ___
 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] osgParticle restart...

2013-04-04 Thread Sergey Polischuk
Hi Peter

if i understand you correctly:
there are interfaces to control some particle related objects in such a way (to 
be exact - all objects that inherited from ParticleProcessor - emitters and 
particle programs)
all they have methods to get\set startTime, currentTime, endTime and resetTime, 
so they can be configured to repeat their behaviour with some time intervals or 
can be reset manually, or configured to be endless or whatever you want :)

Cheers,
Sergey.

04.04.2013, 12:13, Peter Wraae Marino marino.pe...@gmail.com:
 Hi,

 I think this is a really good question. Right now I'm just creating new 
 instances and I would really like to a have a pool of instances for better 
 performance.

 I can see this question was asked in 2010... can anyone answer this question?

 Thank you!

 Cheers,
 Peter

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

 ___
 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] lightmap generated from lightcone geometry

2013-04-04 Thread Sergey Polischuk
Hi

you can do this in a way similar to shadows
for this you can use prebaked texture of light cone shape in section 
perpendicular to axis
knowing cone angle and position you can set up transformation matrix to 
calculate texture coords to mentioned prebaked light spot texture (kind of 
projective texturing) when drawing geometry

i dont know if it is doable with osg::TexMat, osg::TexGen and fixed pipeline 
blending, but surely doable with shaders and uniforms

Cheers.

02.04.2013, 09:59, Daniel Schmid daniel.sch...@swiss-simtec.ch:
 Hi all

 I have a number of modeled lightcones that simulate the illumination area of 
 spotlights in my scene. These lightcones allow me to render lightshafts very 
 nicely.

 Now I want to render the impact of the light on the lit geometry, known as 
 lightmap. imagine a street lamp and the floor area beeing lit.

 I couldn't find any good documentation about rendering lightmaps. An 
 important note, some lights may move, so rendering is on a per frame basis, 
 no pre-baked lightmap.

 Anybody has some more experience?

 Thank you!

 Cheers,
 Daniel

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

 ___
 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] Reflection cube map with shader

2013-03-27 Thread Sergey Polischuk
Hi

  environment-set(cubemap.get());

should be

 environment-set(int(unit));

Cheers

27.03.2013, 18:45, Andrea Martini martini.and...@gmail.com:
 Hi,
 i'm trying to apply a reflection effect on a sphere, using a cube map.
 I'm using as vertex shader dthe following :

 Code:

 #version 400 compatibility
 // Orange Book Opengl Shading Language, 2 edition  pag. 257

 varying vec3  ReflectDir;
 varying float LightIntensity;
 uniform vec3  LightPos;

 void main()
 {
 gl_Position    = ftransform();
 vec3 normal    = normalize(gl_NormalMatrix * gl_Normal);
 vec4 pos   = gl_ModelViewMatrix * gl_Vertex;
 vec3 eyeDir    = pos.xyz;
 ReflectDir = reflect(eyeDir, normal);
 LightIntensity = max(dot(normalize(LightPos - eyeDir), normal),0.0);
 }

 and the following fragment:

 Code:

 #version 400 compatibility
 // Orange Book Opengl Shading Language, 2 edition pag. 257

 uniform vec3  BaseColor;
 uniform float MixRatio;

 uniform samplerCube EnvMap;

 varying vec3  ReflectDir;
 varying float LightIntensity;

 void main()
 {
 // Look up environment map value in cube map

 vec3 envColor = vec3(textureCube(EnvMap, ReflectDir));

 // Add lighting to base color and mix

 vec3 base = LightIntensity * BaseColor;
 envColor  = mix(envColor, base, MixRatio);

 gl_FragColor = vec4(envColor, 1.0);
 }

 To pass the samplerCube, i use the following osg code :

 Code:

   osg::Shader* vertexShader = osgDB::readShaderFile(osg::Shader::VERTEX, 
 \\shaders\\\shaders\\ReflectionCubeMaps\\ReflectionCubeMaps4.vert);
 osg::Program* program=new osg::Program();
 if (!vertexShader)
 {
 std::cout   No vertex Shader Loaded.  std::endl;
 return;
 }
 osg::Shader* fragShader = 
 osgDB::readShaderFile(osg::Shader::FRAGMENT, 
 \\shaders\\\shaders\\ReflectionCubeMaps\\ReflectionCubeMaps4.frag);
 if (!fragShader)
 {
 std::cout   No fragment Shader Loaded.  std::endl;
 return;
 }
 program-addShader(vertexShader);
 program-addShader(fragShader);
 osg::StateSet* stateset=myModel-getOrCreateStateSet();  // My model 
 is the SPHERE

 osg::ref_ptrosg::TextureCubeMap cubemap = new osg::TextureCubeMap;

    /**/

 osg::Image* imagePosX = 
 osgDB::readImageFile(\\Cubemap_snow\\posx.jpg);
 osg::Image* imageNegX = osgDB::readImageFile(\\Cubemap_snow\\negx.jpg);
 osg::Image* imagePosY = osgDB::readImageFile(\\Cubemap_snow\\posy.jpg);
 osg::Image* imageNegY = osgDB::readImageFile(\\Cubemap_snow\\negy.jpg);
 osg::Image* imagePosZ = osgDB::readImageFile(\\Cubemap_snow\\posz.jpg);
 osg::Image* imageNegZ = osgDB::readImageFile(\\Cubemap_snow\\negz.jpg);

 if (imagePosX  imageNegX  imagePosY  imageNegY  imagePosZ  
 imageNegZ)
 {
 cubemap-setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX);
 cubemap-setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX);
 cubemap-setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY);
 cubemap-setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY);
 cubemap-setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ);
 cubemap-setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ);

 cubemap-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
 cubemap-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
 cubemap-setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);

 cubemap-setFilter(osg::Texture::MIN_FILTER, 
 osg::Texture::LINEAR_MIPMAP_LINEAR);
 cubemap-setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);

 cubemap-setResizeNonPowerOfTwoHint( false );
 }

 stateset-setAttributeAndModes( program, osg::StateAttribute::ON );
 stateset-setTextureAttributeAndModes( unit, cubemap.get() );

 osg::Uniform* environment = new 
 osg::Uniform(osg::Uniform::SAMPLER_CUBE, EnvMap);
 environment-set(cubemap.get());
 stateset-addUniform( environment );
 stateset-addUniform(new osg::Uniform(LightPos,osg::Vec3(0.0, 0.0, 
 4.0)));
 stateset-addUniform(new osg::Uniform(BaseColor,osg::Vec3(0.8, 0.2, 
 1.0)));
 stateset-addUniform(new osg::Uniform(MixRatio,0.8f));

 What i get, is the cubemap and a violet sphere : the sphere doesn't reflect 
 the environment.

 In the file attached, i report a snapshot of the result.

 Please, could you suggest me where i can find the error?

 Thank you!

 Cheers,
 Andrea

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

 ,
 ___
 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

Re: [osg-users] Reflection cube map with shader

2013-03-27 Thread Sergey Polischuk
in vertex shader add line

ReflectDir = (osg_ViewMatrixInverse * vec4(ReflectDir,0)).xyz;

after

ReflectDir = reflect(eyeDir, normal);


27.03.2013, 20:27, Andrea Martini martini.and...@gmail.com:
 Hi hybr(),
 thank you. Now it works!

 I have to change something to update the reflected image on camera moving ... 
 i have to check.

 Thank you again.

 Cheers,
 Andrea

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

 ___
 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] Animation control with AnimationPathCallback

2013-03-25 Thread Sergey Polischuk
Hi

i think for fine-grained control it's better to write your own callback for 
controlling animation, and query interpolated matrices from animation path at 
desired position

Cheers.

25.03.2013, 15:44, Joseph Sahexmeier sar...@gmail.com:
 Hi,

 I have loaded a model with animation frames on it. I have traversed the 
 model’s graph and gotten the AnimationPathCallbacks.

 So far, I have been able to pause and speed up/down the animation of the 
 object.

 But, the models first frame is a special position that should only be shown 
 under special circumstances.

 How could I “force” to reestart the animation loop always on the second 
 “frame”?
 Is it possible to set a specific “time” in the animation frame sequence at 
 any moment?

 I have been playing around with  setTimeOffset without success so far.
 I am kind of stuck here right now… anyone has worked with animation control 
 at this level?

 Thank you!

 Cheers,
 Joseph

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

 ___
 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] FBX only Black Texture shown

2013-03-25 Thread Sergey Polischuk
Hi

it can be down to your osg build dont have tga plugin, or some materials that 
osg fbx plugin dont know how to interpret correctly. You can convert your model 
to .osg or .osgt and check if there are textures etc. IIRC current osg fbx 
plugin have support for diffuse, reflection, opacity, self-illumination maps

Cheers.

25.03.2013, 15:39, Michael Borst mich...@jborst.de:
 Hi,

 i am new to this, so bear with me.
 The Problem i encountered is:
 after exporting from 3Ds Max to .fbx
 i could easily open the .fbx file with MotionBuilder on the same Pc.

 But if i try looking at the Model with the osganimationviewer on a Linux 
 system, i can see the Animations but the Model is Black without Texture.

 So far, i tried:
 export  with embedded Media
 export with ascii and then change the .tga locations with Texteditor

 but the Model remains black.
 What is it that i forgot?

 Thank you!

 Cheers,
 Michael

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

 ___
 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] Notify OSG when OpenGL state gets modified externally (e.g. by SFML)

2013-03-25 Thread Sergey Polischuk
Hi

have a look at osg::State interface, there are functions to tell osg that 
something was changed in gl state externally.

Cheers.

25.03.2013, 15:28, Peter Klosowski klo...@gmail.com:
 Hi,

 I am working on a small application that uses SFML and OSG. Getting a simple 
 viewer up and running was very easy. In fact, most of my code is based on the 
 osgviewerSDL example. However, there is one significant difference which is 
 causing problems:

 SFML provides its own graphics module which uses OpenGL. This means that the 
 OpenGL state will get modified outside of OSG. This seems to cause problems, 
 for example it looks like OSG thinks that certain 
 VertexAttribArray/VertexAttribPointer settings are still active. How can I 
 tell OSG to reapply these settings each frame instead of caching them?

 The problem can be demonstrated with a simple render loop, like this:

 Code:

 static const int windowWidth = 800;
 static const int windowHeight = 600;

 sf::RenderWindow window;
 sf::VideoMode mode = sf::VideoMode::getDesktopMode();

 mode.width = windowWidth;
 mode.height = windowHeight;

 sf::ContextSettings settings(24, 8, 0, 4, 2);

 window.create(mode, SFMLTest, sf::Style::Default, settings);

 osg::ref_ptrosg::Group root = new osg::Group;

 /* Create scene... */

 osgViewer::Viewer viewer;
 osg::ref_ptrosgViewer::GraphicsWindowEmbedded gw = 
 viewer.setUpViewerAsEmbeddedInWindow(0, 0, windowWidth, windowHeight);
 viewer.setCameraManipulator(new osgGA::TrackballManipulator);
 viewer.setSceneData(root.get());
 viewer.realize();

 auto state = gw-getState();
 state-setUseModelViewAndProjectionUniforms(true);
 state-setUseVertexAttributeAliasing(true);

 while (window.isOpen())
 {
 sf::Event event;
 while (window.pollEvent(event))
 {
 switch(event.type)
 {
 case sf::Event::Closed:
 window.close();
 break;
 }
 }

 window.setActive();

 window.pushGLStates();

 viewer.frame();

 window.popGLStates();

 window.display();
 }

 Removing the pushGLStates/popGLStates solves the problem. However, this is 
 not a viable long term solution, since the context could be modified in 
 between two frames.

 Cheers,
 Peter[/code]

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

 ___
 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 with uniform array

2013-03-19 Thread Sergey Polischuk
Hi

try to declare array as Intensity[0] in uniform description like:
 osg::Uniform* arrayIntensity=new 
osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,Intensity[0],2);

it should work either way, but there've been some drivers problems with those 
on nvidia cards.

Cheers.

19.03.2013, 15:50, Andrea Martini martini.and...@gmail.com:
 Hi Sebastian,
 sure, i have forgotten to report the following code line in the previous 
 message (but this code line is present in the osg code):

 stateset-addUniform(arrayIntensity);

 so the osg code is :

 Code:

 program-addShader(vertexShader);
 program-addShader(fragShader);
 osg::StateSet* stateset=myModel-getOrCreateStateSet();
 stateset-setAttributeAndModes(program);
 stateset-addUniform(new osg::Uniform(Kd,osg::Vec3(1.0,1.0,1.0)));
 stateset-addUniform(new osg::Uniform(Ks,osg::Vec3(1.0,1.0,1.0)));
 stateset-addUniform(new osg::Uniform(Ka,osg::Vec3(1.0,1.0,1.0)));
 stateset-addUniform(new osg::Uniform(Shininess,50.0f));

 osg::Uniform* arrayIntensity=new 
 osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,Intensity,2);
 arrayIntensity-setElement(0,osg::Vec3f(1.0,1.0,1.0));
 arrayIntensity-setElement(1,osg::Vec3f(1.0,0.5,1.0));

 osg::Uniform* arrayPosition=new 
 osg::Uniform(osg::Uniform::Type::FLOAT_VEC4,Position,2);
 arrayPosition-setElement(0,osg::Vec4(0.0,1.0,0.0,0.0));
 arrayPosition-setElement(1,osg::Vec4(0.0,-1.0,0.0,0.0));

 stateset-addUniform(arrayIntensity);
 stateset-addUniform(arrayPosition);

 I'm wondering if the problem could depend on osg version.

 Thank you!

 Cheers,
 Andrea

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

 ___
 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] Texture coordinates on trianglestrips

2013-03-18 Thread Sergey Polischuk
Hi Looks like your geometry does not have any texture coordinates, and you not using texgen. TexMat just transforms texture coordinates, not generate them. Cheers. 18.03.2013, 12:04, "Elistain" solee.li...@gmail.com:Hi,I'm trying to texture a triangle strip based terrain by a tif image, I use the following codes but it does not work:        //get the texture file namestd::string textureFile = _fileName.substr(0, _fileName.length() -3) + "tif";std::string textureFileName = osgDB::findDataFile(textureFile, options);if(!textureFileName.empty()){osg::ref_ptrosg::Image image = osgDB::readImageFile(textureFileName); osg::ref_ptrosg::StateSet stateSet = new osg::StateSet;osg::ref_ptrosg::Texture2D texture = new osg::Texture2D;texture-setDataVariance(osg::Object::DYNAMIC);texture-setImage(image.get()); osg::ref_ptrosg::TexMat texMat = new osg::TexMat;texMat-setScaleByTextureRectangleSize(true);stateSet-setTextureAttributeAndModes(0, texMat.get(), osg::StateAttribute::ON);stateSet-setTextureAttributeAndModes(0, texture.get(), osg::StateAttribute::ON); geode-setStateSet(stateSet);}Here is the screen shot: http://s1354.beta.photobucket.com/user/Elistain/media/1_zps9a5eb0e3.png.html(the terrain without texture) http://s1354.beta.photobucket.com/user/Elistain/media/3_zpsdd2234a7.png.html(the triangle grids after textured,the whole terrain is a signal triangle strip) http://s1354.beta.photobucket.com/user/Elistain/media/2_zpsbf7e2902.png.html(the original texture image) http://s1354.beta.photobucket.com/user/Elistain/media/4_zps4209eb26.png.html(the terrain after textured,obviously it's not correct!) I'm looking forward for your reply! Thanks !Elistain,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] PRE_RENDER ignores depth buffer?

2013-03-11 Thread Sergey Polischuk
Hi i've used prerender cameras with depth texture attached without any problems. Cheers. 11.03.2013, 11:24, "Daniel Schmid" daniel.sch...@swiss-simtec.ch:Hi all I have a NESTED_RENDER camera that 3 RTTs plus a Depth texture. Works fine. Now I added a PRE_RENDER camera rendering part of geometry  to a texture and a Depth texture. This works aswell except that the depth texture remains empty/untouched. Is there an issue with PRE_RENDER cameras? RegardsDaniel,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Modern OpenGL (4.0+), GLSL and VBOs

2013-03-11 Thread Sergey Polischuk
Hi in lower gl versions, if buffer object is bound to GL_ARRAY_BUFFER, pointer is offset in buffer, else pointer is treated as pointer to block of vertex data in memory to be used as vertices. 11.03.2013, 18:09, "peter klosowski" klo...@gmail.com:Hi, From reading OpenGL documentation (http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttribPointer.xml), I have concluded that glVertexAttribPointer was designed for VBOs only. Please correct me if I am wrong. In that case, OSG passing a raw pointer when using State::setUseVertexAttributeAliasing with VBOs disabled on the Geometry should be regarded as a bug? Cheers,PeterOn Tue, Mar 5, 2013 at 6:23 PM, peter klosowski klo...@gmail.com wrote:Hi, Perfect, osgUtil::GLObjectsVisitor is just what I was looking for! However, I still wonder about the first part of my question. Are VBOs inevitable when using State::setUseVertexAttributeAliasing? It seems that otherwise OSG is trying to call glVertexAttribPointer with a raw pointer rather than a VBO offset, ultimately failing to render the object ('invalid framebuffer operation' and the object does not show up). Cheers,PeterOn Tue, Mar 5, 2013 at 9:55 AM, Sergey Polischuk pol...@yandex.ru wrote:Hi you can use osgUtil::GLObjectsVisitor, it have option to enable vbos on drawables. Cheers. 05.03.2013, 04:07, "peter klosowski" klo...@gmail.com:Hi, In order to use modern shaders (without built-in OpenGL uniforms/attributes) it is necessary call State::setUseModelViewAndProjectionUniforms and State::setUseVertexAttributeAliasing. This provides a bridge to the old fixed-function approach, using a well defined set of names for sending the respective values to the shaders. Therefore, it is possible to seamlessly use existing OSG classes (Transformations, Geometries etc.). However, my question is the following: Does State::setUseVertexAttributeAliasing also require to enable VBOs via Geometry::setUseVertexBufferObjects? In my attached example, failing to do so produces a warning and the object is not drawn: Warning: detected OpenGL error 'invalid framebuffer operation' at After Renderer::compile Is it really necessary to manually enable VBOs for each geometry that is rendered using such a shader? In particular, what about 3d models that are imported with osgDB? What would be an elegant way to enable VBOs for all geometries? Cheers,Peter,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 listosg-users@lists.openscenegraph.orghttp://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] transparent geometry refuses to write to depth buffer

2013-03-11 Thread Sergey Polischuk
Hi if you are talking about fully transparent geometry (alpha = 0) - try to disable alpha test with setMode(GL_ALPHA_TEST, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE) 11.03.2013, 19:19, "Daniel Schmid" daniel.sch...@swiss-simtec.ch:Lets put it this way round: my pre-render camera has a depth and a color buffer. My geometry has a vertex and fragment shader that fades the geometry using alpha. I have the desired result in my color buffer but my depth buffer remains empty. How can I force geometry to always write depth, no matter the alpha? Is there a difference in putting the blending and alpha funcs in the geometry stateset or putting it in the camera stateset? Thanks for helpDaniel ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 set a node invisible but not its children?

2013-03-06 Thread Sergey Polischuk
Hi

What you mean?
afaik, any node which have childrens dont have any visible geometry itself, 
it's either group or transfrom of some sort, it just show it's childrens

Cheers

06.03.2013, 14:42, Lv Qing donlvq...@msn.com:
 Hi,

 ...

 It sounds strange,but sometimes I want to use setNodemask(0) to set a node 
 invisible,but still want its children all visible.

 Thank you!

 Cheers,
 Lv

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

 ___
 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] Modern OpenGL (4.0+), GLSL and VBOs

2013-03-05 Thread Sergey Polischuk
Hi you can use osgUtil::GLObjectsVisitor, it have option to enable vbos on drawables. Cheers. 05.03.2013, 04:07, "peter klosowski" klo...@gmail.com:Hi, In order to use modern shaders (without built-in OpenGL uniforms/attributes) it is necessary call State::setUseModelViewAndProjectionUniforms and State::setUseVertexAttributeAliasing. This provides a bridge to the old fixed-function approach, using a well defined set of names for sending the respective values to the shaders. Therefore, it is possible to seamlessly use existing OSG classes (Transformations, Geometries etc.). However, my question is the following: Does State::setUseVertexAttributeAliasing also require to enable VBOs via Geometry::setUseVertexBufferObjects? In my attached example, failing to do so produces a warning and the object is not drawn: Warning: detected OpenGL error 'invalid framebuffer operation' at After Renderer::compile Is it really necessary to manually enable VBOs for each geometry that is rendered using such a shader? In particular, what about 3d models that are imported with osgDB? What would be an elegant way to enable VBOs for all geometries? Cheers,Peter,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] [osgPPU] Rendering scene geometry in PPU

2013-03-04 Thread Sergey Polischuk
Hi

I believe it's easier to do with postrender camera - disable clear color, 
attach input texture as color attachment, set view and projection matrices, add 
your cones with shaders and you are done. You can also draw result into another 
texture with prerender camera and mix together inside osgppu, if postrender 
camera is not good for some reason.

Cheers.

04.03.2013, 19:19, Daniel Schmid daniel.sch...@swiss-simtec.ch:
 Hi all

 I have some light cones that simulate the glowing of a light. All the light 
 cones are in one group in the scene graph, and they have their apropriate 
 shader in the group stateset to get the desired effect.

 Now my goal is to render the cones in a osgppu postpro step. I want to have 
 them rendered over the normal scene. So my intention is to write a UnitInOut 
 class that can take a osg::Group node and render it over the existing input 
 texture.

 This is actually very close to the UnitText class, instead of a osg::Text I 
 have a small sub scene graph. One issue is the correct view and projection 
 matrixes, which must no longer be related to the screen quad, but instead 
 must be the same like the main scene.

 I hope you get the idea... I started to write the class, but I'm stuck with 
 applying the correct stateset and matrixes at the correct time.

 Can anybody help me?

 Thank you!

 Cheers,
 Daniel

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

 ___
 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] [osgPPU] osgPPU with GL3

2013-02-25 Thread Sergey Polischuk
Hi

It is usable with fixed function pipeline available, this does not prevent you 
from using gl 3.2+ in any way
i mean why would you disable fixed finction on pc app if it is still useful for 
a whole lot of stuff? (apart from mobile apps with gles)
Wang Rui was working on alternative to osgPPU - effects compositor or 
something, i dont remember if it works without fixed function, but you can try 
it (https://github.com/xarray/osgRecipes)

Cheers.

25.02.2013, 06:21, Joshua No jos...@crackcreative.com:
 Are you compiling it against an OpenGL 3.2 or higher OSG build?  I say 
 abandoned because there was no response to my original post for more then 8 
 months, and there appears to be no activity in the repository for quite some 
 time.

 Maybe I'm doing something wrong, but as far as I can tell osgPPU only works 
 for OpenGL  3.2.

 I only need one feature anyway which is glow, so I'm working on implementing 
 that with RTT / MRT in OSG directly now. But it would be handy if osgPPU was 
 usable.

 Thanks

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

 ___
 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] Geometry Merging Problem

2013-02-20 Thread Sergey Polischuk
Hi if you are using osgconv at any stage to convert your model, it implicitly invokes optimizer. you can control this with env var OSG_OPTIMIZER, to turn optimizer off you can pass OSG_OPTIMIZER=OFF Cheers. 19.02.2013, 20:38, "Adam Stambler" ada...@gmail.com:Hi All,I believe I am having trouble with OSG automatically optimizing my sets of Geometry.I am visualizing a 3D reconstruction using OSG.  Each part of the reconstruction is put into its own OSG Geometry and Geode.  All of the parts are then put a group and saved to an .ive file.  In another application, I load the ive and try and select each reconstructed Geode node.  When I click on one part ,   parts are selected.  It looks like Geometry in a few  nodes have been automatically merged. My question is:  is there any automatic optimization somewhere?  Perhaps things are optimized when they are made IVE file?  Either I implemented something incorrectly (very possible) or something modifies my scene graph.  I am not explicitly calling osgUtil::Optimizer. Thanks for any insight,Adam ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] osgdepthpeeling or osgoit

2013-02-20 Thread Sergey Polischuk
Hi iirc you can use just integer uniform for any sampler, specific sampler type matters only inside glsl shader Cheers. 20.02.2013, 13:25, "Christian Buchner" christian.buch...@gmail.com: I am currently stuck with OSG 3.0.1 (latest stable release) not being able to provide an osg::Uniform corresponding to the GLSL sampler2DRectShadow. The enum does not yet contain the SAMPLER_2D_RECT_SHADOW type. ;-( I would have to switch to a later development release, which is a major undertaking.Alternatively I might have to switch from Texture Rectangles to regular Texture2D objects, fortunately there is a #define for that. Christian2013/2/20 Mathias Fröhlich mathias.froehl...@gmx.net Hi, On Tuesday, February 19, 2013 19:07:59 Christian Buchner wrote:  After some futile attempts to make the nVidia dual depth peeling compatible  with non-Vidia cards by dropping the vendor specific extensions I've  decided to go forward with the DepthPeeling code from osgoit.   I noticed that as soon as there are GLSL shaders attached to the object  being rendered, the shadow depth testing seems to fail (is this fixed  function stuff?). Or in other words, these statements don't have an effect  anymore.           _depthTextures[i]-setShadowComparison(true);          _depthTextures[i]-setShadowAmbient(0); // The r value if the test  fails          _depthTextures[i]-setShadowCompareFunc(osg::Texture::GREATER);          _depthTextures[i]-setShadowTextureMode(osg::Texture::INTENSITY);   It seems that I will have to roll my own shadow comparison in GLSL. This  would be in the fragment shader, I presume? Without looking in depth into this and just out of my head. Yes, in the Fragment shader have a shadow sampler unifom bound on that texture and compare for the .r component. Then discard the pixel if that test fails. You need to rescale the projection space fragement position apropriately to the input of the shadow sampler.  If I remember right there was also some problem with the demo with models not being close to the origin. I believe something with the near far computation in interaction with osgoit is not entirely correct. Greetings  Mathias ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] osgdepthpeeling or osgoit

2013-02-20 Thread Sergey Polischuk
Hi i think this can be fixed with just sending resize even manually after viewer have been realized and event handlers set up:     osgGA::GUIEventAdapter * event = viewer.getEventQueue()-createEvent();        event-setEventType(osgGA::GUIEventAdapter::RESIZE);        viewer.getEventQueue()-addEvent(event); or        int x, y, width, height;        osgViewer::ViewerBase::Windows windows;        viewer.getWindows(windows);        windows.front()-getWindowRectangle(x,y,width,height);        viewer.getEventQueue()-windowResize(x,y,width,height); I believe both pieces should work same way Cheers. 20.02.2013, 15:31, "Christian Buchner" christian.buch...@gmail.com: I am currently finding a problem with the osgoit demo (as found in OSG 3.0.1). The osgviewer by default starts in full screen mode, and never generates an initial RESIZE event. I am testing this on Windows, if that matters.The _texWidth and _texHeight members of the DepthPeeling object remain at their default values of 0. While this seems to generate reasonably sized shadowing maps (why?), this has the unfortunate side effect that the CullCallback never receives an update with the correct texture width and height. When not using texture rectangles and when USE_NON_POWER_OF_TWO_TEXTURE #define is not set, it will execute this line: m.postMultScale(osg::Vec3d(viewport-width()/double(_texWidth), viewport-height()/double(_texHeight), 1));producing an invalid scaling matrix. So the screen stays blank (no model is rendered at all) when using square Texture2D objects. Feeding an appropriate default value to the DepthPeeling constructor with the screen resolution fixes it. Christian2013/2/17 Mathias Fröhlich mathias.froehl...@gmx.net Hi List, On Sunday, February 17, 2013 08:20:55 Sajjadul Islam wrote:  are both the same is theory ? What are the differences between them  implementation-wise ? osgoit concentrates on the order independent transparency and does this with a minimal requirement on the state of the displayed model. Also it uses a minimal set of OpenGL features/extensions to make this run on as much hardware/drivers as possible.  Greetings  Mathias ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Callback for resize events

2013-02-19 Thread Sergey Polischuk
Hi

yes, if you write such event handler, which will filter out RESIZE events and 
change appropriate uniform value :)

you can also get current viewport inside cull callback or may be in some other 
place

Cheers.

19.02.2013, 02:41, Alexandre Valdetaro osgfo...@tevs.eu:
 Hi,

 I currently have a shader that needs the screen resolution as an Uniform. Is 
 there a simple way to have the resolution uniform updated by a resize event?

 Thank you!

 Cheers,
 Alexandre

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

 ___
 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] Low frame rate for one animated character.

2013-02-17 Thread Sergey Polischuk
Hi

With software transform it's slow if you use heavy model with a lot of bones 
per vertex. Hardware transform is much faster but require limitation on maximum 
bones influencing single vertex
You should try to reduce bones-per-vertex count to some reasonable value like 
4-8, use indexed mesh to avoid transforming duplicate vertices multiple times, 
and in general use low-poly mesh and then tesselate it or add details with bump 
and displacement maps if needed.

Cheers.

17.02.2013, 03:59, Peterakos hay...@gmail.com:
 Edit  for the last question:
 If i face such difficulties with only 1 character, how do the modern
 3D action games work ?
 ___
 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] basic texturing

2013-02-14 Thread Sergey Polischuk
Hi

for cube you have 8 vertices, and you provide only 4 tex coord values. Besides 
that, to do what you want, you need to duplicate vertices for different faces, 
as you need different tex coord values for same vertex position on different 
faces. Easy way is to not use indexed DrawElements for first try, and just 
provide vertices and tex coords for each face by values (so total of 24 
position-texcoord pairs, 4 per face).

Cheers.

14.02.2013, 12:23, Sajjadul Islam dosto.wa...@gmail.com:
 Hi forum,

 I have a textue2D object with a image and i want to warp each face of the 
 cube with the same texture.

 In OpenGL, i generate the texture coordinates for each of the cube faces.

 How do it OSG? I have been trying the following, but getting the distorted 
 result:

 Code:

 osg::ref_ptrosg::Vec2Array texCoords = new osg::Vec2Array;
 texCoords-push_back(osg::Vec2(0.0f,0.0f));
 texCoords-push_back(osg::Vec2(0.0f,1.0f));
 texCoords-push_back(osg::Vec2(1.0f,1.0f));
 texCoords-push_back(osg::Vec2(1.0f,0.0f));

 geom-setTexCoordArray(0,texCoords.get());

 The above snippet works fine for one face only and rest of the faces get 
 distorted.
 I am rendering each element as quad follows:

 Code:

 // Add primitiveset to draw a cube
 osg::ref_ptrosg::DrawElementsUInt drawingElements = new 
 osg::DrawElementsUInt(GL_QUADS);

 //front face
 drawingElements-push_back(0);
 drawingElements-push_back(1);
 drawingElements-push_back(5);
 drawingElements-push_back(4);

 //right face
 drawingElements-push_back(1);
 drawingElements-push_back(2);
 drawingElements-push_back(6);
 drawingElements-push_back(5);
 ...
 ...

 Thanks
 Sajjadul

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

 ___
 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] basic texturing

2013-02-14 Thread Sergey Polischuk
you can make it with redundant data, and give a try to osgUtil::Optimizer with 
INDEX_MESH | VERTEX_PRETRANSFORM | VERTEX_POSTTRANSFORM, it will index vertices 
and remove excess redundancies. But in general case you still need 3 sets of 
texture coordinates for each vertex of cube, but this depends on actual texture 
layout, you can get done with fewer in some specific texture mappings (f.e. if 
you mirroring adjacent faces).
Other way is to use separate indexing for vertices and texture coordinates, but 
this is deprecated and slow as hell.

14.02.2013, 13:49, Sajjadul Islam dosto.wa...@gmail.com:
 Thanks for the hint!

 I think i gave you the impression that i am converting the existing opengl 
 application to a osg version. It is partially right. More important is to 
 understand if it is really efficient the way of duplication of the vertices 
 here.

 There are quite many redundancies here, any other more efficient way ?

 Cheers,
 Sajjadul

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

 ___
 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] Beginner's Help: Problem setting up a shadowed scene

2013-02-13 Thread Sergey Polischuk
Hi,

just a guess:
looks like with shadows - black parts are the ones which does not have diffuse 
texture assigned and shadow technique you are using might require it to work 
correctly.

Cheers,
Sergey

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




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


Re: [osg-users] Disabling shaders on LightPointNodes

2013-02-13 Thread Sergey Polischuk
Hi The thing is osg::StateAttributes can not be turned ON or OFF with flags like that, if you have attribute in stateset it always ON (if you look at source, StateSet even dont save ON-OFF flags for state attributes, only PROTECTED and OVERRIDE bits). You can control if they have any effect with gl modes through StateSet::setMode(...) interface, but there are no such mode for program. To disable osg::Program you can set empty osg::Program on state set in question, like:stateset-setAttribute(new osg::Program, osg::StateAttribute::PROTECTED); Cheers,Sergey. 13.02.2013, 18:20, "Frank Kane" fk...@sundog-soft.com:Hi gang, I've got a setup where I have an osg::Program attached near the top of my scene graph to do lighting effects. It works great, except that LightPointNodes don't show up when it's active. I tried intercepting the LightPointNodes in the graph inside a cull visitor, and disabling the shader on it - roughly like this: osg::ref_ptrosg::StateSet ss = lightPointNode.getStateSet();if (ss  ss.valid()) {    ss-setAttributeAndModes(myProgram.get(), osg::StateAttribute::OFF);} But, this seems to have no effect (I checked - the call to setAttributeAndModes is being reached). Looking at the osgSim::LightPointNode source, it looks like it's doing tricks with a singleton state set shared amongst them all, its own render bin, and manipulating its own state set graph. I don't know if that's wiping out my state somehow, or if I'm just Doing It Wrong. Has anyone else ever encountered trouble using shaders in conjuction with LightPointNodes? Any advice if so? Thanks!Frank Frank KaneFounderSundog Software, LLChttp://www.sundog-soft.com/http://www.linkedin.com/pub/frank-kane/17/434/764,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Beginner's Help: Problem setting up a shadowed scene

2013-02-13 Thread Sergey Polischuk
[quote=Marten]Actually, the .mtl file of the model seems to have the diffuse 
value specified quite correctly, feel free to take a look a the model yourself, 
I have added the URL to it.[/quote]

i'm talking about diffuse texture, not material color.

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




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


Re: [osg-users] Beginner's Help: Problem setting up a shadowed scene

2013-02-13 Thread Sergey Polischuk
Hi,

i'm pretty sure that there are shadow technique implementations that work on 
models without textures, you should look shadows related osg examples and check 
related classes interfaces/implementations to get better grip on these things. 
Or wait for another answer :)

Cheers,
Sergey

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




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


Re: [osg-users] TriMeshVisitor possible bug?

2013-02-13 Thread Sergey Polischuk
 Hi Looks ok to meas it written in comment, code converts DrawArrays to DrawElements, and if primitive set is already indexed it is not DrawArrays any more, and there should not be duplicate vertices in first place (besides ones with same vertex position but different other vertex attributes like tc's or normals) Cheers. 14.02.2013, 01:17, "Paul Martz" skewmat...@gmail.com:Hi all -- Primarily Tim Moore... The code comments for osgUtil::IndexMeshVisitor reads as follows:// Convert geometry that uses DrawArrays to DrawElements i.e.,// construct a real mesh. This removes duplicate vertices. However, if a PrimitiveSet is already indexed (i.e., DrawElementsUInt), then the code skips removal of duplicate vertices. Is this the intended behavior? From reading the documentation, I expected the code would still go through and remove the duplicate vertices. Does the code need to be corrected, or the code comment? -- Paul Martz Skew Matrix Software LLC,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Self Illumination export from 3ds max 2010

2013-02-12 Thread Sergey Polischuk
Hi

osg max exporter does export all kind of maps but it does not preserve 
semantics on most of them so they does not work correctly. IIRC diffuse, 
reflections and opacity maps are correctly exported.
You should either write shader or change osg::TexEnvCombine on stateset in 
question so that your emission texture will blend additively.

Cheers.

11.02.2013, 22:07, Xomes Ss thijs_wittenho...@hotmail.com:
 Hi,

 I am trying to export my object (simple traffic light) from 3ds max 2010 to 
 Delta3d, and am using the OSGexporter.
 This object holds both a Diffuse map, and a Self-Illumination map (to make 
 red, orange or green light up). However if I export both theses maps, the 
 diffuse map shows in black, except for where the Self-illumination map is not 
 black (see attachement).
 How do I export these maps both? The .osg file looks good IMO, since the 
 first lines are:

 
 MatrixTransform {
   DataVariance STATIC
   name Scene Root
   nodeMask 0x
   cullingActive TRUE
   description # osgmaxexp material data
 Name 07 - Default
 Map Diffuse 0 1 images\\TL_Diffuse.tga UVMAP_EXPLICIT
 Map Self-Illumination 1 1 images\\TL_Self_illum_green.tga UVMAP_EXPLICIT
 

 Thank you!

 Cheers,
 Xomes

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

 Attachments:
 http://forum.openscenegraph.org//files/problem_self_illumination_358.jpg

 ___
 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] Intersections with Scenes shown in pre-rendered textures

2013-02-12 Thread Sergey Polischuk
Hi

i believe you can get normal in point of intersection with mirror with 
getWorldIntersectNormal() method of intersection, calculate reflected ray and 
start new intersection query with new ray

Cheers.

11.02.2013, 22:16, Julian Schindler julian.schind...@dlr.de:
 Hi all,

 In my scene I am sitting in a car driving around. My car has mirrors, which 
 are implemented with camera-Nodes rendering to the texture of the mirror 
 geometry.
 Now I want to know if the driver is looking at a car in front of me or in the 
 mirror.
 For this purpose, I have the exact pixel position in window coordinates, the 
 driver is looking at. I am using a LineSegmentIntersector with this pixel 
 position like shown in the osgkeyboardmouse example. It works fine with the 
 world around the mirror, but when looking at the mirror I (of course) get the 
 geode of the mirror as result.

 So: Is there a way of continuing the ray into the pre-rendered world shown in 
 the texture? I have no clue on doing this...

 I already found some Forum topics on calculating texture colors or of setting 
 the ray start into the world, but I am not sure if those ways may help me...

 Thank you!

 Cheers,
 Julian

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

 ___
 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] loading of a large number of files

2013-02-11 Thread Sergey Polischuk
Hi

what size of models are we talking about?
there are chances that you run out of memory in the process and getting 
std::bad_alloc

Cheers.

11.02.2013, 17:30, lucie lemonnier lucielemonn...@hotmail.fr:
 Hi,
 I created an application with WPF and osgViewer which load multiples 3D 
 models (up to 1420 files) with an OpenFileDialog. When I load a large number 
 of files, the osg application crash.
 Is osg be limited to a specific number of vertex?

 Thank you!

 Cheers,
 lucie

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

 ___
 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] loading of a large number of files

2013-02-11 Thread Sergey Polischuk
Hi

guessing is not very helpful in debugging application crashes
debugger is your best friend in this situation :)

Cheers.

11.02.2013, 18:11, lucie lemonnier lucielemonn...@hotmail.fr:
 Hi,

 My folder of 3D models contains 26.5 megabytes.
 it does not seem to be much though!
 What do you think?

 Thank you!

 Cheers,
 lucie

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

 ___
 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] Higher render precision in render camera.

2013-02-10 Thread Sergey Polischuk
Hi

you can get it drawn to texture in 32bit per channel, but what you see on 
screen is 8bit\channel max.

Cheers.

11.02.2013, 05:00, Peterakos hay...@gmail.com:
 Hello.

 I use a shader to write the depth value of a model as color in screen
 using  gl_FragColor = vec4(depth, depth, depth , 1).
 But it seems it renders the model with only 8-bit per channel precision.

 Can i change that behavior of the main camera (to 32-bit per channel)?

 thnx.
 ___
 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] Failure in casting to osg::AnimationPathCallback*

2013-02-07 Thread Sergey Polischuk
Hi I've one run into similar issue when was compiling some sample under linux, in my case it was solved by adding -rdynamic flag to gcc, i think there are some similar option to your compiler about exporting symbols. Cheers. 07.02.2013, 08:35, "Philip Lamb" p...@eden.net.nz:Hi all, I'm running into an interesting bug in my code which manifests as behaviour that works on one platform (Windows) and not on another (OS X) with the same OSG code. (Using OSG trunk, around 3.1.4) I am using the following node visitor to reset animations attached to transform nodes: class ResetAnimationNodesVisitor : public osg::NodeVisitor{public:        ResetAnimationNodesVisitor():    osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}        virtual void apply(osg::Transform transform)    {        osg::NodeCallback *nc = transform.getUpdateCallback();        osg::AnimationPathCallback* apc = dynamic_castosg::AnimationPathCallback*(nc);        if (apc) {            apc-reset();            apc-update(transform);        }        traverse(transform);    }}; This visitor is instantiated on a node thus: void resetAnimationTime(osg::ref_ptrosg::Node modelNode){    ResetAnimationNodesVisitor ranv;    modelNode-accept(ranv);} When compiled and run on an animated model under Windows (compiled with Visual Studio 2010 SP1) all works as expected. When the exact same code is compiled and run under OS X (using Xcode 4.5.2, with LLVM 4.2.1) the dynamic cast to osg::AnimationPathCallback* is always NULL. I have checked that RTTI is not disabled (it's on by default, and no errors are produced by the dynamic_cast, and that indeed things are as expected with this snippet inside apply():         if (nc) osg::notify(osg::NOTICE)  "UpdateCallback: className is "  std::string(transform.getUpdateCallback()-className())  " and type_id.name() is " typeid(transform.getUpdateCallback()).name()  std::endl;  which produces the output: UpdateCallback: className is AnimationPathCallback and type_id.name() is PN3osg12NodeCallbackE So it looks like a failure somewhere in RTTI. Both typeid and the dynamic_cast fail to convert the osg::NodeCallback* to an osg::AnimationPathCallback*. Yet clearly, the callback IS the right type, as evidenced by OSG's className() function's output. Any ideas about where this kind of issue might be coming from? Regards,Phil.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 Keep model color aven if shaders are applied

2013-01-30 Thread Sergey Polischuk
Hi

material colors are available in gl_FrontMaterial struct in fragment shader
there are vec4's gl_FrontMaterial.diffuse, .specular, .ambient, .emission, and 
float .shininess
there are also material params premultiplied with lightsource params in 
gl_FrontLightProduct struct (.diffuse = materialDiffuse * lightsourceDiffuse, 
same for others)

Cheers.

30.01.2013, 19:24, Andrea Martini martini.and...@gmail.com:
 Hi Glenn,
 thank you for your suggestions. Can i do the same thing also with materials?

 Thank you!

 Cheers,
 Andrea

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

 ___
 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] Retrieve Wold matrix while animating

2013-01-30 Thread Sergey Polischuk
Hi

you can create your own uniform and assign correct value each frame from 
correct camera or, if in cull callback, you can get current camera from 
cullvisitor and ask view matrix there.

Cheers.

31.01.2013, 00:08, Peterakos hay...@gmail.com:
 Hello.

 Thank you for your answer, but there is a problem.
 In the first pass algorithm, the value osg_ViewMatrixInverse is wrong.
 It corresponds to the main camera instead of the RTT camera i use.

 The variable gl_ModelViewMatrix is correct though. Any idea of what i
 can do to pass the correct value to osg_ViewMatrixInverse ?
 I use glsl 1.2.

 thank you for your time.
 ___
 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] R: Multisampling

2013-01-29 Thread Sergey Polischuk
Hi

I've tested multisampled context with disabled GL_MULTISAMPLE and it worked for 
me like year ago or so.
There are talks in web that on some hardware GL_MULTISAMPLE does nothing in 
multisampled context, and multisampling always enabled (with drivers settings 
set to application control of MSAA), may be you hit one of those?

Cheers.

29.01.2013, 16:08, Gianluca Natale nat...@europe.altair.com:
 Hi,
 I was about to ask the same question.

 And I tried what you suggest to remove multisampling from one node, but it 
 does not work.
 I mean, once you set the number of samples in the display settings, and 
 create a rendering context
 based upon such display settings, then it is impossible to disable 
 multisampling.

 BTW,
 I also tried to directly call in the DrawImplementation of my own drawables 
 this statement:

 glDisable(GL_MULTISAMPLE);

 but it does not work either. I mean, once set, multisampling seems not to be 
 controllable.
 Did I miss something? Does it depend on OSG? Or driver bug?

 Thanks,
 Gianluca

 -Messaggio originale-
 Da: osg-users-boun...@lists.openscenegraph.org 
 [mailto:osg-users-boun...@lists.openscenegraph.org] Per conto di Sergey 
 Polischuk
 Inviato: lunedì 28 gennaio 2013 18:01
 A: osg-users@lists.openscenegraph.org
 Oggetto: Re: [osg-users] Multisampling

 Hi, Filip

 you can create MSAA context and enable\disable multisampling at runtime with 
 GL_MULTISAMPLE mode on camera or scene stateset. Note that with disabled 
 multisampling you will get lower fps than with non-MSAA context.

 Cheers,
 Sergey.

 28.01.2013, 20:24, Filip Arlet fili...@seznam.cz:

  Hi,

  Is it possilbe to disable (or enable) Multisampling ? I can create context 
 with MSAA and without it, but I have no idea how can I disable or enable it 
 with existing context ? Is it even posible or do I have to recreate Context ?

  Thank you!

  Cheers,
  Filip

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

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


Re: [osg-users] Multisampling

2013-01-28 Thread Sergey Polischuk
Hi, Filip

you can create MSAA context and enable\disable multisampling at runtime with 
GL_MULTISAMPLE mode on camera or scene stateset. Note that with disabled 
multisampling you will get lower fps than with non-MSAA context.

Cheers,
Sergey.

28.01.2013, 20:24, Filip Arlet fili...@seznam.cz:
 Hi,

 Is it possilbe to disable (or enable) Multisampling ? I can create context 
 with MSAA and without it, but I have no idea how can I disable or enable it 
 with existing context ? Is it even posible or do I have to recreate Context ?

 Thank you!

 Cheers,
 Filip

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

 ___
 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] position list

2013-01-25 Thread Sergey Polischuk
Hi

you can add several drawables to billboard with different positions, and 
setPosition is there to change position of previously added drawable.

Cheers.

25.01.2013, 13:30, DavidHornung horn...@googlemail.com:
 Hi,

 I just saw setPosition() from OSG Billboard,
 what is the _positionList for? why define multiple positions for a
 Billboard? For what could you use multiple Positions?

 Cheers,
 David

 ___
 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] Forcing OSG to create VBO

2013-01-24 Thread Sergey Polischuk
Hi There are osgUtil::GLObjectsVisitor which can do such thing with option COMPILE_DISPLAY_LISTS (it compiles vbo's too). You should traverse your tree with such visitor in a thread which have valid graphics context, i.e. inside cull callback. Cheers,Sergey.  24.01.2013, 14:02, "Carlos Reig Matut" carlos.r...@irtic.uv.es:Hi all, Anyone knows if it is possible to force the creation of a VBO (copy the vertex data into the GPU memory)? I explain it, using setUseDisplayList(false) and setUseVertexBufferObjects(true), I tell OSG that it has to create the VBO in the next viewer.frame() BUT if the geometry is not in the viewer frustrum, OSG does not create the VBO. I have tried disabling the camera's culling with viewer.getCamera()-setCullingMode(osg::CullSettings::NO_CULLING) but I haven't any success at the time. Thank you. -- --Carlos Reig MatutLSyM - Instituto IRTICUniversidad de Valencia Ph. +34 96 354 3639 -- ext. 43639http://irtic.uv.es/lsym,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] osgFX::outline: unable to change outline color

2013-01-24 Thread Sergey Polischuk
Hi

default osgFX implementation of mentioned effect seems to not use any shaders 
at all, and color applied through emissive color of material, so i think 
problem is somehere down in drivers. You can try different versions of them or 
rewrite outline effect to use some other way of coloring lines (like setting 
material diffuse color and disable lighting, or something other)

Cheers.

24.01.2013, 17:28, Mike Metcalf metcalfnos...@mac.com:
 hybr,

 Thanks for your reply.

 I've used vanilla openGL for years, but never Cg or GLSL, and I'm new to OSG. 
 I am supposing that your suggestion is in relation to some shader code we 
 might be using. If this is correct, this probably isn't part of the problem 
 because the only shader code that I think is running is that which is within 
 OpenSceneGraph, and the osgFX code in particular.

 Is there a way for me to check the GLSL compiler warnings for GLSL shader 
 code running from within osg?

 Thanks again for your help.
 -Mike

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

 ___
 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] Retrieve Wold matrix while animating

2013-01-22 Thread Sergey Polischuk
Hi

most straightforward way is to use gl_ModelViewMatrix * osg_ViewMatrixInverse

Cheers.

22.01.2013, 13:16, Peterakos hay...@gmail.com:
 Hello.

 I try to create a multi pass algorithm and i am stuck.
 I use my own view and projection matrix for an absoluted positioned camera.
 But i cant figure out how to handle the World matrix.
 Glsl gives me gl_ModelViewMatrix but i need only the model matrix for
 the current vertex being processed.

 How can i retrieve it in osg and pass it in the shader as uniform ?

 thank you.
 ___
 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 keep the camera from being below the terrain?

2013-01-14 Thread Sergey Polischuk
Hi there is no collision detection in osg. You can use intersectors in osgUtil and trace rays from camera downwards to check distance from ground, or use some physics engine to get proper collision detection. Cheers. 13.01.2013, 20:51, "Yansi Yao" yaoyans...@yahoo.com.cn:Hi all,I'm going to attach a bounding box or bounding sphere to the camera, and detect the collision between the terrain and the bounding object. But I don't know how to detect this collision in osg. Could you tell me how to do this? or is there any demo for this problem?Cheersyaoyansi,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 keep the camera from being below the terrain?

2013-01-14 Thread Sergey Polischuk
I believe you can use osgUtil::PolytopeIntersector for this purpose, but i didn't used it myself and can't say much more than that. 14.01.2013, 12:51, "Yansi Yao" yaoyans...@yahoo.com.cn:Thanks for your reply, Sergey. I will try it.BTW, sometimes, I want to detect the intersection between the camera frustum and the terrain. So, is there any way to detect the intersection between a bounding sphere(or box) and the terrain in OSG?  Cheersyaoyansi 发件人: Sergey Polischuk pol...@yandex.ru 收件人: OpenSceneGraph Users osg-users@lists.openscenegraph.org  发送日期: 2013年1月14日, 星期一, 4:34 下午 主题: Re: [osg-users] how to keep the camera from being below the terrain? Hi there is no collision detection in osg. You can use intersectors in osgUtil and trace rays from camera downwards to check distance from ground, or use some physics engine to get proper collision detection. Cheers. 13.01.2013, 20:51, "Yansi Yao" yaoyans...@yahoo.com.cn:Hi all,I'm going to attach a bounding box or bounding sphere to the camera, and detect the collision between the terrain and the bounding object. But I don't know how to detect this collision in osg. Could you tell me how to do this? or is there any demo for this problem?Cheersyaoyansi,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 get node rotation in world coordinates?

2013-01-11 Thread Sergey Polischuk
Hi attitude is osg::Quat, and it does not have routines to transform it with matrix. You can use something like this: osg::Matrix world(osg::computeLocalToWorld(node-getParentalNodePaths()[0]));//world.setTrans(osg::Vec3()); - not sure if this makes any differenceworld.preMultRotate(node-getAttitude());osg::Quat result(world.getRotate()); Cheers,Sergey. 11.01.2013, 08:35, "michael kapelko" korn...@gmail.com:Hi. I have one PAT node as child of another one.I've implemented retrieval of its position in world coordinates this way: node-getPosition() * osg::computeLocalToWorld(node-getParentalNodePaths()[0]) This works fine.I've tried the same for rotation: node-getAttitude() * osg::computeLocalToWorld(node-getParentalNodePaths()[0]); But this doesn't even compile.Can anybody tell me how to get node rotation in world coordinates?Thanks.  ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] mapping to video koordinate system

2013-01-11 Thread Sergey Polischuk
Hi

best thing is to get real camera parameters f.e. calibrating it with opencv 
routines, so you can built correct projection matrix.
other than that all you can is just guessing and trying different projections 
to see which will fit best.

Cheers.

07.01.2013, 18:51, DavidHornung horn...@googlemail.com:
 Hi,
 for example: I have a video of a football game, the teal camera always
 stays in its place and force the same point.
 Now I want to add a virtual football field on the one in the video.

 So how can i get the camera parameters the real camera had(unknown) for
 my virtual camera so that their views fit together?
 Which techniques are there?

 Hope now it is more clear

 Cheers,
 David

 Am 07.01.2013 15:43, schrieb Robert Osfield:

  Hi David,

  On 7 January 2013 11:21, DavidHornung horn...@googlemail.com wrote:
  how can I map a rectangle in my osg world on a rectangle with the same size
  in a Video? The Video is behind the OSG Scene.
  Probably solve this in a similar way to one would answer the generic
  question how long is a piece of string?

  The bottom line is we can't answer you question as it's too open
  ended.  Is you OSG world a 3D one, an perspective or orthographic one?
    When you say rectangle in my OSG world, what exactly do you mean?
  What about the rectangle in the video, is the dimensions of the vedeo
  frame or a rectangle that is within the video image?

  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] Loading an osgb file from a statically linked application

2013-01-09 Thread Sergey Polischuk
Hi

just in case someone stuck with similar problem - i've got same with 
ComputeBoundingBoxCallback's, i believe (either osg fbx plugin added those 
while reading model, or they are created in some osgAnimation classes). dont 
know if there are some way of solving this with use of similar macro, i've just 
used dynamically linked binary that strips those bad boys from model as a 
preprocess step before using them in static app, and all work fine.

hth,
Sergey.

07.01.2013, 04:15, Thilo Weigel thilo.wei...@atrics.de:
 Hi,

 With the following lines added to my code everything works as expected:

 USE_SERIALIZER_WRAPPER(DefaultUserDataContainer)
 USE_SERIALIZER_WRAPPER(StringValueObject)

 Interestingly, these macros aren't used in osgstaticviewer.

 Cheers,
 Thilo

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

 ___
 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] Coursera Classes Coming Up!

2013-01-04 Thread Sergey Polischuk
Hi

there are great courses, but dont overestimate your time and capability, some 
courses are quite time consuming... last time i simultaneously started two 
courses with four weeks delay, and it was hard to catch up between work and 
stuff.

02.01.2013, 20:49, Jeremy Moles cubic...@gmail.com:
 Hey guys!

 You've probably heard by now, but there is a really great up-and-coming
 website/organization/movement called Coursera that I learned about last
 year.

 http://www.coursera.org
 https://www.coursera.org/user/i/cec974e9434316ce7625ee9df772effe

 There are some REALLY great math and graphics classes that start in the
 next few days, and I wanted to see if anyone was going to be taking the
 same classes as myself. Perhaps we could work together over Jabber and
 form a kind of study group. :)

 Anyways, hope you all had as great a 2012 as myself! Here's to another
 great one!

 P. S. All of our resolutions should be, henceforth, to never use the
 OpenGL FFP ever again!
 ___
 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] Texture internal and source format questions

2012-12-31 Thread Sergey Polischuk
Hi

kind of late response here :)
that's just how opengl texture works
in order to use texture, you need need to allocate memory storage for it with 
glTexImage2D call, and for this call you should provide internal 
format(GL_DEPTH_COMPONENT16), format(GL_DEPTH_COMPONENT), and type 
(GL_UNSIGNED_SHORT)

Cheers.

15.12.2012, 04:49, Peterakos hay...@gmail.com:
 Hello.

 Lets say i have a texture which stores the depthmap.

 1) Is the following correct ?
 texture2d-setInternalFormat(GL_DEPTH_COMPONENT16);
 texture2d-setSourceFormat(GL_DEPTH_COMPONENT);
 texture2d-setSourceType(GL_UNSIGNED_SHORT);

 2) Why do we need do initialize both internal format and source format
 if we are not going to use
 any image ?

 Thank you
 ___
 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] Render multiple osgText nodes with the same drawcall

2012-12-28 Thread Sergey Polischuk
Hi my suggestion is not about text, but anyway, if your models contain tristripped geometry, they issue single draw call per primitiveSet (mean for each triangle strip) and they usually not so lenthy at all, about 7-10 vertices on average. With display lists this dont matter, but on gles it can have huge impact on framerate. You can try to run your models through osg optimizer with INDEX_MESH | VERTEX_PRETRANSFORM | VERTEX_POSTTRANSFORM optimization options to make single indexed triangle list per geometry instead of bunch of triangle strips. Cheers. 23.12.2012, 07:54, "Preet" prismatic.proj...@gmail.com:It will probably be more efficient to create a scene graph from osg::Geometry/osg::Texture/osg::StateSet rather than using osgText.  You could use the osgText::Font and associated Textures to help with the texturing side to the rendering.  The osg::Geometry you create you could put as many quads in as you need.I have a couple of questions on using the texture directly rather than using osgText::Text... When grabbing the textures with all the glyphs in it (osgText::Font::getGlyphTextureList), can I safely assume that for one font resolution there will only be one texture for that font? That is will *all* characters which are requested with the same font be handled by one texture? How/when do individual glyphs get added to their collective texture? (I looked through the source code but got a little lost) -- in a small example I tried with just osg::Geometry/Texture as you suggested above, I looked up glyph texture coordinates for a bunch of characters without manually adding any glyphs and it 'just worked'. Do I never need to do anything to ensure the glyphs I need are in the texture or is this taken care of implicitly? Regards,Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] osgAnimation

2012-12-28 Thread Sergey Polischuk
Hi

iirc osgAnimation animation is not get started by default when viewer starts, 
you should start it in code. You can use osganimationviewer binary from osg 
examples or write your own utility for your purpose. Also osg and ive file 
formats lacks some support of osgAnimation, try using osgb or osgt file formats 
instead.

Cheers.

26.12.2012, 21:48, Bhaskar Bhattacharya bhask...@iastate.edu:
 Hi all,

 I'm having a tough time trying to use osgAnimation. Essentially I have an 
 animation however the primitives in every frame keep changing. I have no 
 issues showing it on the fly frame by frame i.e. just showing it via 
 osgViewer::Viewer however I want to save the animation in a .ive/.osg file 
 and view it using osgviewer. I hope I'm making it clear. Thing is the 
 documentation of osg is pretty bad and I can't find any examples to 
 understanding how to use osgAnimation for my purpose. Can anyone help me or 
 point me in the right direction? If someone could help me understand the 
 concept of channels and how to use them that also would suffice.
 ...

 Thank you!

 Cheers,
 Bhaskar

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

 ___
 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] What can I do to improve rendering performance for a bunch of billboarded nodes?

2012-12-28 Thread Sergey Polischuk
Hi you can use point sprites for this purpose instead of billboards\autotransforms, it should be much faster as you need only one drawable per single geometry type(triangles, squares, ngons, etc). you can shape them either in fragment shader based on point coords, or apply small texture. Cheers. 21.12.2012, 10:15, "Preet" prismatic.proj...@gmail.com:I have a scene that contains 100s of small low-complexity flat geometries (triangles, squares, ngons, etc). Each of them is parented with an autotransform node so that they constantly face the camera. Color data is passed through vertex attributes and there's no texture data. Is there anything I can do to improve rendering performance in this scenario? This is on a mobile device (OpenGL ES 2) and I get a fair bit of slow down as the number of objects increases.Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Understanding osg Image packing

2012-12-27 Thread Sergey Polischuk
Hi

what pixel format and type you have passed to 
osg::Image::computeRowWidthInBytes(...) call?

Cheers,
Sergey.

26.12.2012, 21:48, Claus Steuer claus...@googlemail.com:
 Hi,

 i try to understand the packing parameter of osg::Image::allocateImage.
 My current understanding is that packing specifies the alignment of each 
 pixel row in memory like the GL_PACK_ALIGNMENT parameter in OpenGL does.

 That means if i have a packing of 2 and an image width of 3 with 3 bytes per 
 pixel, one row would take 10 bytes of memory, whereas it would take 9 bytes 
 of memory if a packing of 1 would be used.

 However when i use the calculation made in osg::Image::computeRowWidthInBytes 
 for the same example i get 6 bytes for each row.

 Since i dont expect osg to be wrong at this there must be some error in my 
 understanding of the packing parameter.

 I hope someone can enlighten me,
 Claus

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

 ___
 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] osgFX::outline: unable to change outline color

2012-12-27 Thread Sergey Polischuk
Hi

If you are using shaders in your implementation, make sure you declared shader 
version with #version directive and check compilation log on warnings

Cheers.

26.12.2012, 22:02, Mike Metcalf metcalfnos...@mac.com:
 We've been attempting to implement an osgFX::outline node for highlighting 
 during mouse selection/hover.

 Our implementation works, except that the resulting outline ignores our calls 
 to setColor() and remains black at all times. Outline line widths properly 
 respond to calls to setWidth().

 We gave a version of the app to a tester and he found that the outline was 
 appearing as yellow, as our source was requesting.

 We found his machine has an NVidia card running OpenGL 4.2. All of us 
 developers, for whom the outline is always black, are running NVidias with 
 OpenGL 3.3.0 or 3.2.0.

 Because our development machines cannot be updated to OpenGL 4.2, is there 
 something else we might do to correct this behavior?

 Thanks in advance!

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

 ___
 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] Projective multitexturing save/export

2012-12-27 Thread Sergey Polischuk
Hi

how would you include glsl shaders in 3ds file, for example?
model formats support some limited set of features, and not all of those 
supported by osg writer plugins.

26.12.2012, 21:24, Mateo Gasparovic mateo.gasparo...@gmail.com:
 Hi,

 I've made projecting textures on the STL model. To project textures I've used 
 the OpenGL vertex and fragment sheders as in examle on Jotschi's Blog: 
 ProjectiveTextureExample OpenSceneGraph.
 I'm interested if is it possible to save the textured model that is displayed 
 in the window (viewer) in OBJ, 3DS, PLY, VRML2.0 file?

 When I save a model in OSG file and import it again, everything is OK. My OSG 
 model file has texture information. If the problem can be solved by 
 converting the OSG to OBJ, 3DS, PLY or VRML2.0 it's fine as well.
 Is there a program, procedure or sample code for such conversion?

 I tried to save node/object file (OBJ) but in both cases I only receive 
 geometry model
 without textures. MTL file is empty. Also, I've tried to export a 3DS or PLY 
 file, but in both cases I got geometry without textures.

 Below I have attached a part of my code, where I tried to save/export 
 textured model.

 osgViewer::Viewer viewer;
 viewer.setSceneData(createModel3());
 osgDB::writeObjectFile(*viewer.getSceneData(),test.obj);

 Thank you for help!

 Best regards,
 Mateo Gasparovic

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

 ___
 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 can I call a vector method on a generic array type?

2012-12-27 Thread Sergey Polischuk
Hi if you have only osg::Array pointer then all you can get directly is array size : array-getNumElements()as for others - you can get to them only with exact type (which you can get computed with help of array-getDataType() and array-getType() return values) Cheers  28.12.2012, 08:59, "Preet" prismatic.proj...@gmail.com:Hi,I'm trying to call std::vector functions on generic array objects. So I'd like to be able to get an osg::Array and call something like size() or clear() on it, but I'm not sure how I can do this without casting it to one of the 'proper' array types. Is this possible?  Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] projection matrix calculating problem

2012-12-22 Thread Sergey Polischuk
Hi You can set projection matrix directly with camera-setProjectionMatrix(...)Also there are osg::Projection, which is a node modifying projection matrix for subgraph under it.Also note, that osg by default calculates near and far projection values by itself using bounding volumes (check osg::CullSettings::ComputeNearFarMode enum for available modes), in order to set znear and zfar manually you should disable this behaviour by calling camera-setComputeNearFarMode (osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR) Cheers. 22.12.2012, 18:23, "caijun" caijun2002...@126.com:Hello,everyone,  I am using osg to build a 3D software.I don't know how to change the znear,zfar and projection matrix values when I change the camera position. When I read the osg's cullstack class,the refmatrix of projection differs every time.how does it calculates?Can anyone tell me?   Thanks very much!,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Model Matrix in Vertex Shader

2012-12-21 Thread Sergey Polischuk
Hi

this is correct, camera position is osg_ViewMatrixInverse[3].xyz

Cheers.

21.12.2012, 17:25, Ethan Fahy ethanf...@gmail.com:
 I looked around the web to try to figure out how to also get the camera XYZ 
 in world space.  According to sources I should be able to get the camera 
 world coordinates from the last column of the inverse view matrix.  Is this 
 correct?

 Code:

 vec3 cameraPositionWorldCoordinates;
 cameraPositionWorldCoordinates[0] = osg_ViewMatrixInverse[3][0];
 cameraPositionWorldCoordinates[1] = osg_ViewMatrixInverse[3][1];
 cameraPositionWorldCoordinates[2] = osg_ViewMatrixInverse[3][2];

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

 ___
 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] Model Matrix in Vertex Shader

2012-12-20 Thread Sergey Polischuk
Hi Not sure if it is still true, but last time i used this stuff with stereo setups (not sure but it can hold for any offset-based slave cameras setup) osg_ViewMatrix and it's inverse was containing main camera view (and inverse) matrix and was same for both eyes. Cheers,Sergey. 20.12.2012, 00:12, "Glenn Waldron" gwald...@gmail.com:vec4 worldVert = osg_ViewMatrixInverse * gl_ModelViewMatrix * gl_Vertex; ...where osg_ViewMatrixInverse is a built-in OSG uniform (type mat4). Just be aware: GLSL is single-precision, so you will lose some precision doing this.Glenn Waldron / @glennwaldronOn Wed, Dec 19, 2012 at 3:03 PM, Ethan Fahy ethanf...@gmail.com wrote:Hello all,  I would like to have access to vertex world coordinates in my GLSL vertex shader that is attached to an osg::Node.  In GLSL the Model Matrix and the View Matrix are combined into the ModelViewMatrix, so you cannot get access to the Model Matrix without either passing in the Model Matrix itself or the Inverse View Matrix (which could be multiplied by the ModelViewMatrix to get the Model Matrix).  I am familiar with how to attach an osg::Uniform to pass uniforms into the shader; my question is, what is the best way to obtain either the Model Matrix or the Inverse View Matrix from a given osg::Node?  I think I may be able to use osg::getLocalToWorld() to obtain the Model Matrix?  I have read through this thread: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-April/009903.html but it doesn't really arrive at a satisfying conclusion and may or may not be out of date.  Any advice is appreciated.  Thanks,  -Ethan  -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51639#51639  ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] RigTransformHardware skinning on DAE models

2012-12-12 Thread Sergey Polischuk
Hi

default implementation uses vertex attribs from slot 11 upwards for bone 
weights, and most implementations have GL_MAX_VERTEX_ATTRIBS = 16, so with more 
than 4 attributes you are probably hitting hardware limits on vertex attributes 
count, i think gl error comes from this too.

Cheers.

29.11.2012, 01:01, Peterakos hay...@gmail.com:
 Hello.

 I use the default RigTransformHardware for skinning on a dae Model
 with skeleton.
 My model consists of 4 RigGeometries (image 1). The number of bones
 per vertex is 7, 2, 20 and 15 respectively.
 After enabling the OSG_NOTIFY as INFO i see that it creates vec4
 boneWeightX attributes based on the 4 previous numbers
 (num_of_bones/2).

 The vertex shader i use for skinning is the following:

 #version 120

 attribute vec4 boneWeight0;
 attribute vec4 boneWeight1;
 attribute vec4 boneWeight2;
 attribute vec4 boneWeight3;

 uniform int nbBonesPerVertex;
 uniform mat4 matrixPalette[MAX_MATRIX];

 vec4 position;

 void computeAcummulatedNormalAndPosition(vec4 boneWeight){
 int matrixIndex = int(boneWeight[0]);
 float matrixWeight = boneWeight[1] ;
 mat4 matrix = matrixPalette[matrixIndex];
 position += matrixWeight * (matrix * gl_Vertex );
 }

 void main( void ){
 position =  vec4(0.0,0.0,0.0,0.0);

 if (nbBonesPerVertex  0) 
 computeAcummulatedNormalAndPosition(boneWeight0);
 if (nbBonesPerVertex  2) 
 computeAcummulatedNormalAndPosition(boneWeight1);
 if (nbBonesPerVertex  4) 
 computeAcummulatedNormalAndPosition(boneWeight2);
 if (nbBonesPerVertex  6) 
 computeAcummulatedNormalAndPosition(boneWeight3);

 gl_Position = gl_ModelViewProjectionMatrix * position;
 }

 The problem is that when i try to use all the boneWeight attributes it
 creates (which are 10), the model breaks (image 2).
 On the other hand the code above (with only 4 attributes) works like
 the RigTransformSoftware.

 On a different high detail model (which creates 25 bone weight
 attributes max), i get the following results:
 -With only the first 4 attributes: the model is broken and animated
 -With all the attributes: the model is correct but there is no 
 animtion.

 Can anyone help me through this ?
 Is this behavior normal?

 I also get a lot of Warning: detected OpenGL error 'invalid value'
 after RenderBin::draw()

 Thank you for your time and sorry for the long post.

 ,
 ___
 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] Rendering sets of objects in layers/passes

2012-12-12 Thread Sergey Polischuk
Hi using separate renderbin ID for each set of objects should do exactly what you want, as they should be sorted by depth inside each set, and sets rendered in order of renderbin ID's. How you assigning render bin ids? You may need to set RenderBinMode to USE_RENDERBIN_DETAILS or OVERRIDE_RENDERBIN_DETAILS to make it work. And back to front depth sorted renderbin prototypes names are "DepthSortedBin" and "SORT_BACK_TO_FRONT", check if you typed it right.Dont use setRenderingHint(...) after you've set bin number or mode, as it overrides them. Best to use only setRenderBinDetails call like:setRenderBinDetails(binID, "DepthSortedBin", osg::StateSet::USE_RENDERBIN_DETAILS);Cheers. 09.12.2012, 01:34, "Preet" prismatic.proj...@gmail.com:Hiya,I have multiple sets of depth sorted geometry that I'd like rendered in a specific order. So the depth sorted part itself only matters within a single set, if that makes any sense. For example, I might have three sets, each containing 100 osg::Geometry objects. I'd like each of the objects to render correctly with respect to the other objects in their own set, but I'd like all the objects in the first set to show up over all the objects in the second set and so on.I'm not sure how to do this with OpenSceneGraph. I tried giving each set of objects a separate DepthSorted render bin... but this doesn't do what I want. I'd appreciate any advice.Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Skinning with osg / osgAnimation

2012-12-12 Thread Sergey Polischuk
Hi

fbx plugin support skinning animation.

Cheers.

12.12.2012, 21:05, Janna Terde brja...@gmail.com:
 Hi,

 I am looking into doing hardware skinning (such as animating some cables for 
 a example). I will provide transformation matrices for bones.

 So far I've found that osgAnimation provides support for hardware skinning. 
 However I am not sure what file formats are supported for gathering influence 
 data? So far only saw support for collada. However I have not tested if it is 
 working and how easy to set it up yet.
 Does any other plugin supports importing of influence data into osg 
 animation? And what is typically used to create skinning mesh/bones to work 
 with osgAnimation?

 Thank you!
 Janna

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

 ___
 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] questions on simple skeletal animation for crowd simulation

2012-11-23 Thread Sergey Polischuk
Hi You can use any .fbx model with skinned character, as osg can read those just fine. I think you should be able to find some of those in the web. Cheers. 22.11.2012, 03:41, "Bruno Fanini" phoeni...@gmail.com:Hello Jan and Christian,Thanks for your hintsThe simulation has to run on medium-sized crowds (order of 1000-2000 agents) since we are planning to run on just a portion of a city, so actually theres no need for huge-sized crowds. At least not at the present times.The architecture I'm developing should allow to separate completely the engine (collisions, social influences, etc) and let a separate FrontEnd to receive produced data, so it should be feasible both at CPU and GPU level.Now I'm wondering where I can find some osgAnimation-based characters (apart from the classic "avatar.osg" in osg-data) or how can I generate a very basic walking character - I just need to control independently the walking speed - and have some tests. I've read something involving the Blender exporter: is this the only workflow (modeling) or I can find some basic animated agents around on the web that I can somehow convert to a osgAnimation-based setup?Thanks,On Tue, Nov 20, 2012 at 5:16 PM, Jan Ciger jan.ci...@gmail.com wrote:Hello, Back in the day I have done about 2000 walking skeletons for a demo using the osgCal plugin - i.e. no instancing, separate node each of them, software skinning (ok, skeletons don't have much skin :-p) they just shared some data. That was running at ~20fps on a GeForce4 back then. So it is certainly possible. Not sure how amenable the osgAnimation stuff is to that - to me it looked a bit unfinished and clunky when I worked with it last time.  The comment from Christian about billboards is certainly valid if you want to scale the simulation above some ~20k-50k characters - bellow that you probably will be able to drive fully articulated characters. With some clever LOD you can do even something like this: http://archiveweb.epfl.ch/vrlab.epfl.ch/Movies/Movies_index.html (scroll down for the "Real-Time Navigating Crowds: Scalable Simulation and Rendering" video, the paper is here: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.3149rep=rep1type=pdf) Of course, the CPU is the bottleneck, as Christian said - you need to push as much simulation as you can on the GPU.JanOn Tue, Nov 20, 2012 at 3:54 PM, Christian Buchner christian.buch...@gmail.com wrote:Are you sure your agents need to be full 3D models?I've done something using perspective billboards, in the osgrvo2 sample in the osgRecipes repository maintained by Wang Rui. The billboards were rendered in Poser using a python script that rendered it out from many viewing angles. The GPU can easily render 1 agents with different walking speeds at interactive frame rates. The bottleneck is the agent simulation on the CPU. ;)2012/11/17 Bruno Fanini phoeni...@gmail.comHello osgUsers,Within a osg-based crowd simulator I'm currently developing, I was trying to investigate a simple skeletal animation for a given set of agents.I'm digging the animtkviewer.cpp example (osganimationviewer) and it looks like a good solution for this case.In this context, I would just need a plain simple "walking" animation for my characters.I've a set of PositionAttitudeTransforms nodes to control position  attitude of a single agent, so my questions are:- is it possible to control the independent speed of the walking animation for a single agent? (i.e. another agent is walking faster, etc..)- what about instancing 3d models? is it still possible with this approach somehow? (i.e. every p.a.t pointing to the same 3d model)- what about the performance drop (estimate)?- is there any example out there applied to crowd simulations or similar?Thanks,-- Bruno Fanini http://BrunoFanini.co.nrhttp://DevHelio.co.nr (Software Development)http://www.facebook.com/DigitalDivadlo (Digital Art)___ 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 -- Bruno Faninihttp://BrunoFanini.co.nrhttp://DevHelio.co.nr (Software Development)http://www.facebook.com/DigitalDivadlo (Digital Art),___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 with high detailed model with skinning.

2012-11-22 Thread Sergey Polischuk
Hi, Peterakos

If you load model from fbx format, osg optimizer can screw up some things, dont 
use optimizations that change drawable arrays, like INDEX_MESH, 
VERTEX_PRETRANSFORM, VERTEX_POSTTRANSFORM, TRISTRIP_GEOMETRY, as it will broke 
vertex attribute binding to bones etc. Try to open your model in osgviewer with 
OSG_OPTIMIZER=OFF env var, and check if it make any difference.

Even if above is not your case, by default osgAnimation transforming vertices 
and normals for skin animation on cpu side, so it can actually be quite slow 
(but i'm not sure about 10 fps on such machine). There are some support for 
hardware skinning, but it is not all that automated and such, you can check 
osganimationhardware example to get a feel how to use it.

Cheers,
Sergey.

22.11.2012, 17:06, Peterakos hay...@gmail.com:
 Hello.

 I load in osg a model with 130K triangles and 76K vertices.
 This model supports animation.
 I see that it runs only with 10 frames.

 Is it normal for my pc ?
 GTX 560
 8GB memory
 cpu: 
 http://ark.intel.com/products/65520/Intel-Core-i5-3570K-Processor-6M-Cache-up-to-3_80-GHz

 thnx.
 ___
 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] Streaming world and integer limits

2012-10-30 Thread Sergey Polischuk
Hi

Where did you found anything about node positions being stored as integers in 
OSG? Nodes are positioned with osg::Transform derived classes which use 
floating point (single or double precision, depending on build configuration) 
matrices\vectors\quaternions for transformations.

Cheers.

30.10.2012, 12:17, Dmitry K. zzfi...@hotbox.ru:
 I'm saying about position of a node.
 If I model earth (for example) then the camera (for example) or another node 
 will move from southern pole (0, 0) to equator (0, MAX_INT) and then it will 
 move again to southern pole though it increments its position (not 
 decrements), due to integer overflow (MAX_INT + inc_pos = inc_pos).

 Again, if I have a node with position (200, 200) and a child node with 
 position (MAX_INT, MAX_INT) the result position of the child's node will be 
 MAX_INT + 200, MAX_INT + 200. That means integer overflow again.

 These two cases are not clear for me. Sorry, if I've expressed myself not so 
 clearly. Thanks for your answers.

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

 ___
 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] DDS Texture vanish with LINEAR_MIPMAP_LINEAR

2012-10-30 Thread Sergey Polischuk
Hi

it seems like osg dds plugin cant (correctly) read your mipmaps from dds file. 
You can use file without mipmaps or try to dive in and find exact reason for 
this behaviour.

Cheers.

30.10.2012, 14:19, Tim Rambau tim.ram...@dlr.de:
 Hi,

 I have a terrain model with 1024x1024 DXT1 textures. Using a min filter with 
 LINEAR_MIPMAP_LINEAR the textures are gone, changing only this filter to 
 LINEAR everything is back again. The textures contain 1 main image and 10 
 mipmaps...

 Any ideas?

 Thanks  Cheers,
 Tim.

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

 ___
 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] dead locking problem of osgDB::DatabasePager::DatabaseThread under QT/linux

2012-10-29 Thread Sergey Polischuk
Hi

at first try to update osg, may be you find this problem solved.

Cheers.

27.10.2012, 17:39, Lv Qing donlvq...@msn.com:
 Hi,

 My osg2.9.11 app is working under QT/Linux.Occasionally it suffers a dead 
 lock as follows:
    #0 in _kernel_vsyscall()
    #1 in pthread_cond_wait_@@GLIBC_2.3.2 from/lib/libpthread
    #2 in Openthreads::Condition::wait from libOpenThreads
    #3 in osgDB::DatabasePager::DatabaseThread::run from libosgDB
    #4 in OpenThreads::ThreadPrivateActions::StartThread from   
 libOpenThreads
    #5 in ?? from/usr/lib/libGL.so

 The only function I use from libosgDB is just loading a osgDEM terrain 
 file,nothing else.So I think maybe  DatabasePager rendering terrian file 
 conflict about something.

 Another clue is my osg thread is integrated with other qt thread,just use 
 the AdpateWidget.cpp example.Previously,I found DatabasePager rendering 
 confilic with some QT signal.It presents just loading and runing a terrain 
 file may affect some other thread's share memory and leading some unusual 
 crash.I  solve this problem by blocking these QT signals before every fram() 
 function.

    I do not know if this two problem is relevant.I am just a 3D programmer 
 ,not so good with muti-threding programing.I know there may be nothing about 
 OSG,but I know there are so many experienced programmer in this forum can 
 help me.

    This problem is so serious,it beyond my knowledge and it may be affect my 
 career  ,so anyone give a lead may be hlepful.

 Thank you!

 Cheers,
 Lv

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

 ___
 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] custom vertex attribut, using BIND_OVERALL

2012-10-24 Thread Sergey Polischuk
Hi wouldnt it be better to use uniform in this case? Cheers. 24.10.2012, 13:28, "Daniel Schmid" daniel.sch...@swiss-simtec.ch:Hi all I want to pass a custom vertex attribute (lets say a material code) to my vertex shader. For the moment I use BIND_PER_VERTEX: [code]int l_SMC = 1027; // some material code for (unsigned int i=0; ia_geode.getNumDrawables(); ++i){  osg::Geometry* l_Geom = a_geode.getDrawable(i)-asGeometry();  if (l_Geom)  {    osg::Array* l_VertexArray = l_Geom-getVertexArray();    if (l_VertexArray)    {  unsigned int vertex_count = l_VertexArray-getNumElements();  osg::IntArray* l_Array = new osg::IntArray;  for (int v=0; vvertex_count; v++)  {    l_Array-push_back(l_SMC);  }  l_Geom-setVertexAttribArray(6, l_Array);  l_Geom-setVertexAttribNormalize(6, false);  l_Geom-setVertexAttribBinding(6, osg::Geometry::BIND_PER_VERTEX);    }  }}[/code] Since the material code is unique within geometries, so actually I would need to transfer it only once per Geometry. If I change to BIND_OVERALL, the data is no longer transferred, or at least my shader cannot detect it anymore. I thought i should maybe reduce the VertexAttribArray (l_Array) to one single entry, but this doesn't work either. What is the correct way of passing general or common data, on a per geometry (and not vertex) basis? RegardsDaniel,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] custom vertex attribut, using BIND_OVERALL

2012-10-24 Thread Sergey Polischuk
Hi

 As you say, setting Uniforms requires a state change, while with an attribute 
 the rendering is done at the GPU completely.

it is kind of same both ways... here you need glUniform* call, there you need 
to bind vertex attrib and call glVertexAttribPointer*
and rendering is done at the GPU completely no matter what way you choose.

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


Re: [osg-users] Help: does the time difference between two successive update callback of one osg::node imply FPS?

2012-10-16 Thread Sergey Polischuk
Hi

one node callback can be called multiple times per frame if node is shared in 
several graph paths (and iirc event callbacks can be called once per event 
happened between frames).
If you just need to know framerate - there are osgViewer::StatsHandler.
Other than that - you should track frame number (you can get those from 
nodevisitor framestamp).

Cheers.

16.10.2012, 01:46, wang shuiying shuiying.w...@fu-berlin.de:
 Hello,

 I have a very naive question. But I really need to make sure about it.

   In one osg::viewer thread, if the time difference between two
 successive update callbacks (or drawCallbacks)of one osg::node is equal
 to T(s), then can I say that the corresponding FPS of GPU is 1/T?

 Thank you in advance!

 Shuiying
 ___
 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] FBX 2012.1?

2012-10-16 Thread Sergey Polischuk
Hi

you can just change 2012.1 version check to 2012.2 in osg fbx plugin code, it 
will compile just fine, and 2012.2 sdk is googlable

Cheers.

16.10.2012, 04:14, Brad Colbert bcolb...@rscusa.com:
 Hi Folks,

 Does anyone know of a source for getting the FBX 2012.1+ SDK?  Autodesk has 
 released 2013 which is currently incompatible with the OSG plugin.

 -B

 ---
 Brad Colbert
 Renaissance Sciences Corporation
 (480) 290-3997

 ___
 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 change the text with osg::Text?

2012-10-15 Thread Sergey Polischuk
Hi

call textLabel-setText(strTmp);
instead of update()

Cheers.

15.10.2012, 13:42, Eungil slwa...@naver.com:
 Hi,

 I am a very new, and i got a problem with using osg::Text.

 I set the text like this blow.
 osg::Geode* textGeode = new osg::Geode();
 osgText::Text* textLabel = new osgText::Text();
 
 root-addChild(textGeode); // root is a point of osg::group()

 then, i want to display the numbers being continuelly increasing.
 the screen I guess will be showen up like this.
 0, 1, 2, 3, 4, 5..

 In order to achieve this, I typed code within while roop.

 wchar_t strTmp[100];
 swprintf(strTmp, L%.3d, 0);
 textLabel-setText(strTmp);
 int index = 0 ;
 while(!viewer.done())
 {
   swprintf(strTmp, L%d, ++nIndex);
   textLabel-update();
   viewer.frame();
 }

 However, the result is stopped. I think the problem is related to 
 textLabel-update() line.

 Please, anyone tell me how to change (or update) the text frequently?

 Thank you!

 Cheers,
 Eungil

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

 ___
 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] fbx plugin, option to read animation channels as quats instead of euler angles

2012-10-12 Thread Sergey Polischuk
Hello there

I want to add read option to use quaternions for stacked rotation elements and 
animation tracks instead of euler angles on fbx import, as they often works 
better and cut down model size (and i have couple of models which just dont 
work with euler angles for whatever reason, after being converted from fbx to 
osgb). There are already code for doings this, but it get's runned on condition 
which seems like never being evaluated to true no matter what model is:
--- pNode-QuaternionInterpolate.IsValid()  
pNode-QuaternionInterpolate.Get()
in fbxRAnimation.cpp around around line 337 and in fbxRNode.cpp around line 346

So i want to add option to force using quaternions instead of euler angles.

Easy way is to just add another read option to ReaderWriterFBX, and pass it all 
along the way to readFbxRotationAnimation(...) in fbxRAnimation.cpp and to 
readUpdateMatrixTransform(...) in fbxRNode.cpp

If there are anyone involved in writing fbx plugin, i'd like to hear any 
comments on this.

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


Re: [osg-users] sampler shader texture

2012-10-12 Thread Sergey Polischuk
Hi

use setTextureMode(id, GL_TEXTURE_2D, osg::StateAttribute::OFF) on your group 
stateset, with id set to texture unit you binded your texture to. It prevents 
fixed function from using your texture, and dont have any effect on rendering 
with shaders.

Cheers.

12.10.2012, 16:20, Filip Arlet fili...@seznam.cz:
 Hi,

 I pass data to my shader in texture which is attached to Group StateSet. If I 
 want to render something in fixed pipilene function, under that StateSet. It 
 will use that texture, but I do not want to do it. I just want to pass 
 sampler to shader, but not to texture fixed pipeline. Is there something to 
 do this ? Or do I have to disable Texture Unit everytime I want to draw 
 something in fixed pipeline mode ?

 Thank you!

 Cheers,
 Filip

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

 ___
 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] multipass transparency

2012-10-10 Thread Sergey Polischuk
Hi

For such complex transparent models you need some proper order-independent 
transparency algorithm

Cheers.

09.10.2012, 23:22, Tina Guo guoyiting1...@gmail.com:
 Hi,

 Thanks for reply. Now the code is like

 virtual void define_passes()
 {
 osg::ref_ptrosg::StateSet ss = new osg::StateSet;
 ss-setAttributeAndModes( new osg::ColorMask(true, true, true, true) 
 );
 osg::Depth* depth = new osg::Depth;
 depth-setWriteMask( false );
 ss-setAttributeAndModes( depth, osg::StateAttribute::ON );
 addPass( ss.get() );

 ss = new osg::StateSet;
 ss-setAttributeAndModes( new osg::ColorMask(false, false, 
 false, false) );
 depth-setWriteMask( true );
 ss-setAttributeAndModes( depth, osg::StateAttribute::ON );
 addPass( ss.get() );
 }

 However, it could not handle sel-intersection(the picture in the attached doc)

 Using:
 transparency-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
 transparency-setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA 
 ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute:ShockedN);
 osg::Depth* depth = new osg::Depth;
 depth-setWriteMask( false );
 transparency-setAttributeAndModes( depth, osg::StateAttribute::ON );
 _geom_solid-setStateSet(transparency);

 instead of

 transparency-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
 transparency-setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA 
 ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute:ShockedN);
 _geom_solid-setStateSet(transparency);

 self-intersection is correct. However, some transparent parts will disappear, 
 like the wheels of the car in the picture in the doc, the color seems to be 
 blended after the inner parts.

 ...

 Thank you!

 Cheers,
 Tina[/img]

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

 Attachments:
 http://forum.openscenegraph.org//files/test_152.pdf

 ___
 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] Texture coords in osgmultiplerenderingtargets.

2012-10-10 Thread Sergey Polischuk
Hi most likely, it uses a texture rectangle instead of texture2d, it uses texture coords in pixels. Cheers. 10.10.2012, 16:46, "Peterakos" hay...@gmail.com:Hello.in the example  osgmultiplerenderingtargets, why are the texture coordinates initialized as:0,0tex_width, 0tex_width,tex_height0,tex_heightinstead of 0,11,01,10,1(the result is different)Thank you for your time.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Difference between osgFX and osgPPU

2012-10-09 Thread Sergey Polischuk
Hi They are completely different. osgFX have support for multipass rendering of geometry, osgPPU purpuse is to do postprocessing on camera output. Cheers.08.10.2012, 22:01, "Peterakos" hay...@gmail.com:Hello.Is there any difference between these 2 or are they different implementations for the same purpose ?For someone who wants to support multi passes (using shaders) on model nodes which is better ?thnx.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Memory issues when using uniform shader variables on Intel HD graphics

2012-10-09 Thread Sergey Polischuk
Hi

What exactly makes memory usage increase? What if you attach shader without 
uniform, or without adding uniform to stateset? Try to add #version 110 
directive as first line of your shaders, does it make any difference?
I think you'd better send bugreport to intel, best if you can reproduce this 
with pure opengl.

Cheers.

09.10.2012, 09:28, Clemens Spencer clemens-m...@gmx.de:
 Hi,

 I'm trying to use shaders on an Intel HD 3000 graphics chip (Windows7 x64, 
 latest graphics driver).

 As soon as I pass a uniform variable to the shader (regardless of the type), 
 the memory of my process increases by about 400MB. Other than that, the 
 shader works fine.
 The size of the object the shader is attached to or the complexity of the 
 shader do not make a difference. Every additional shader (containing at least 
 one uniform variable) I use, increases the memory usage by another 400MB.

 The problem does not occur on another machine with some NVidia graphics card.

 Has anyone encountered a similar problem or does someone have an idea what 
 could cause a problem like this?

 Code:

 osg::Program *program = new osg::Program;
 osg::Shader *frag = new osg::Shader( osg::Shader::FRAGMENT, fragSource.str() 
 );
 osg::Shader *vert = new osg::Shader( osg::Shader::VERTEX, vertSource.str() );
 program-addShader( frag );
 program-addShader( vert );
 // add shader to stateSet
 sset-setAttributeAndModes( program, osg::StateAttribute::ON );
 // add uniform variable
 osg::Uniform *var = new osg::Uniform(MATERIAL_COLOR, 
 osg::Vec4(1.0f,1.0f,0.0f,1.0f));
 sset-addUniform(var);

 Code:

 // Vertex Shader

 void main()
 {
 gl_Position = ftransform();
 gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
 }

 // Fragment Shader

 uniform vec4 MATERIAL_COLOR;

 void main()
 {
 gl_FragColor = MATERIAL_COLOR;
 }

 By the way, I know I'm not using reference pointers :? but this shouldn't be 
 a problem in this little example.

 ...

 Thank you!

 Cheers,
 Clemens[/code]

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

 ___
 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] multipass transparency

2012-10-09 Thread Sergey Polischuk
Hi

If you need to blend all visible layers - try to change order of passes, and 
set colormask to all false's (so first will be only color, second only depth). 
If you dont need depth from transparent geometry - you can get by with only 
first pass.
If you need only closest single layer - you draw first pass depth only (with 
colormask set to false's), second pass with depth test set to lequal.

Cheers.

09.10.2012, 09:33, Tina Guo guoyiting1...@gmail.com:
 Hi,

 In open inventor, there is a transparency mode called: delayed blend

 Transparent objects are rendered using multiplicative alpha blending, in a 
 second rendering pass with depth buffer updates disabled. And I want to get 
 the same effect.

 here's what I am trying to do

 transparency-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
 transparency-setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA 
 ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute::ON);
 _geom_solid-setStateSet(transparency);

 class TransparencyTechnique : public osgFX::Technique
 {
 public:
 TransparencyTechnique() : osgFX::Technique() {}
 virtual bool validate( osg::State ss ) const { return true; }

 protected:
 virtual void define_passes()
 {
 osg::ref_ptrosg::StateSet ss = new osg::StateSet;
 ss-setAttributeAndModes( new osg::ColorMask(true, true, true, true) 
 );
 addPass( ss.get() );

 ss = new osg::StateSet;
 osg::Depth* depth = new osg::Depth;
 depth-setWriteMask( false );
 ss-setAttributeAndModes( depth, osg::StateAttribute::ON );
 addPass( ss.get() );
 }
 };

 The result is not right. how should define_passes() be defined?

 ...

 Thank you!

 Cheers,
 Tina

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

 ___
 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] Normalmap with osgPPU

2012-10-09 Thread Sergey Polischuk
Hi osgppu drawing screen aligned quad with each pass, using texture data you've provided as input. It does not have access to your scene in any way except of mentioned textures.vertex shader process vertices of this quadnormals you are getting is normals of this quad (so they are all the same, and facing to camera with value vec3(0,0,1)), and not those of your scene. Cheers.09.10.2012, 16:46, "Peterakos" hay...@gmail.com:Hello.Is it possible to retrieve the normal map using osgPPU ?I have used the following shaders and a blue screen appears.Vert---varying vec3 normal;void main(void){gl_Position = ftransform();normal =  gl_NormalMatrix * gl_Normal;}Frag---varying vec3 normal;void main(){gl_FragColor = vec4(normal,1);}I guess the blue color means that the normal.z is always 1.In some examples in osgPPU solution, i have noticed that vertex shaders are used.Which vertices are passed through these shaders ? All of the scene's vertices or just the ones that are visible ?Thank you.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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:why does renderbin affect the display of textures ?

2012-10-08 Thread Sergey Polischuk
Hi
Seems like you are messing with opengl state, and osg dont know about it. You 
should either:
a) when you draw something with pure gl - after you finished, return all state 
you modified to values being before you started drawing
b) use osg::State interface members to let osg know what state you are changed, 
or use osg wrappers in osg::State to make this state changes.
c) call osg::State's dirty*() methods (like dirtyAllModes() and 
dirtyAllAttributes()) for state you've changed, after you finished with pure 
gl, but i dont recommend using this.

Cheers.

08.10.2012, 12:14, wang shuiying shuiying.w...@fu-berlin.de:
 Is nobody interested in this question?:-(

 Hello,

 I have two drawable nodes A and B under the same main group node. I
 mapped two different textures on the drawables respectively. Those two
 drawables do not have any overlappings in terms of pixels on the screen.
 Drawable A is described using open scene graph library while drawable B
 is described using openGL terms. Depth test is disabled by Drawable A
 and enabled by drawable B. Texture display on A uses a shader while B
 does not.

 When the renderbin of drawable A is set to be -1 and that of drawable B
 is 1, the two textures cannot show at the same time. That is to say,
 when I toggle on both drawable A and drawable B and make them both seen
 on the screen, the texture on drawable B doesn't show, but the color of
 B is correct. Under such circumstance, when I manipulate the view in a
 way such that drawable A is out of sight, then the texture on drawable B
 will appear.

 If I reverse the renderbins of those two drawables, then the textures
 can show at the same time.

 I just cannot figure out why this happens.

   If it is due to depth test, why should such conflicts happen, since
 they have no overlapped pixels on the screen? Even it is due to depth
 test, why is the color  correct?

 Would someone please be so kind enough as to explain that to me?

 Thanks millions in advance!

 Best regards
 Shuiying

 ___
 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 can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-06 Thread Sergey Polischuk
Hi

I believe this caused by small features culling (which is culling away objects 
which cover less space on screen than some pixel threshold). With compute near 
far enabled - when camera far enough objects on earth surface gets culled away, 
and as there are no objects on earth surface get's rendered, far plane 
calculated is just to close for earth to be visible.
To check if this causing problems try to set culling mode to 
myCam-setCullingMode(myCam-getCullingMode()  
(~osg::CullSettings::SMALL_FEATURE_CULLING));

You can incorporate some logic into bounds computation to return valid bound 
when camera is far from earth surface, or disable small feature culling (or 
just reduce it's threshold)

Cheers.

06.10.2012, 09:16, Preet prismatic.proj...@gmail.com:
 On Sat, Oct 6, 2012 at 1:02 AM, Preet prismatic.proj...@gmail.com wrote:

  Sergey's suggestion (invalidating the geometry's bounds with a custom
  compute bounds callback) sort of worked, but led into another issue.
  If I zoom out far enough, the Earth surface geometry disappears.
  Specifically, if the camera is pointing at the center of the Earth,
  the Earth geometry disappears when the camera eye is further than
  ~5.13E6m from the surface of the Earth. Changing the near and far
  planes don't have any effect here.

  However, if I disable culling I don't have this problem (but disabling
  culling kills the framerate):
  myCam-setCullingMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

 Sorry, typo above, I meant to write:
 myCam-setCullingMode(osg::CullSettings::NO_CULLING);

  So right now I'm:

  * Setting the near and far plane manually
  (myCam-setComputeNearFarMode is set to DO_NOT_COMPUTE) whenever the
  camera is updated to ensure my desired view volume is correct
  * Setting the Earth surface geometry compute bounds callback to disabled

  And that works fine up until I move the camera out far enough as I
  described previously. Something happens at that causes the geometry to
  disappear unless I disable culling altogether.

  Preet

 ___
 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 can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-05 Thread Sergey Polischuk
Hi

You can set ComputeBoundingBoxCallback on a geometry to specify whatever bounds 
you want. In your case to ignore earth geometry bound you can set its bound to 
uninitialized bounding box, and it will not make any difference to near\far 
calculations. Note that this thing completely disable view frustum culling on a 
geometry! In order to get it working you should write your cull callback and do 
check vs actual bounds there, if you need it.

Code looks like:

class UseInitialBoundsCallback : public 
osg::Drawable::ComputeBoundingBoxCallback
{
public:
osg::BoundingBox computeBound (const osg::Drawable  drawable)
{
osg::BoundingBox brand_new_uninitialized_bbox;
return brand_new_uninitialized_bbox;
}
};

geometry-setComputeBoundingBoxCallback(new UseInitialBoundsCallback);

Cheers, Sergey.

05.10.2012, 05:11, Preet prismatic.proj...@gmail.com:
 On Thu, Oct 4, 2012 at 5:37 PM, Chris Hanson xe...@alphapixel.com wrote:

  I wanted to avoid specifying the near/far planes manually since the
  behaviour without the Earth surface geometry is perfect as is. I don't
  care about the overhead of drawing the surface geometry since its so
  simple, and I don't want the scene graph to account for the surface
  geometry (outside of rendering it); the other objects in the scene
  should determine the camera frustum.
    Due to the way OGL works with near/far, if you want it drawn, you need it
  taken into account when computing the near/far planes.

    Are you just worried about the far plane being set too far?
  Including geometry for the
  Earth's surface makes the other stuff disappear (and reappear at
  certain angles).

    It sounds to me like you're not trying to solve the right problem. You
  should first determine WHY these other items aren't displayed at times.

 Sorry if it wasn't clear; the items aren't being displayed because the
 near and far planes that osg sets creates a frustum that doesn't
 include them. I need to manually set the near and far planes to see
 everything.

 The near and far planes that osg sets without the earth surface
 geometry is fine. Once you add the surface geometry though, the near
 and far planes are set such that the items are no long in the view
 frustum.

 I was looking for a flag or something that basically tells osg hey,
 don't include this node when you do your view frustum calculations
 ___
 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::PPU texel 0,0 in depthbuffer is wrong

2012-10-05 Thread Sergey Polischuk
Hi Check texture wrap mode, it can be set to clamp_to_border, with some border color. Does it work okay when sampling other texture areas? Dont know if it can cause problem, but texture(...) call returns vec4, and you are sampling single component texture. I believe it returns (depth, 0, 0, 1), but who knows. And you'd better use #version directive, as nvidia drivers can compile a lot of stuff without it, but it can work not the way you would expect. 05.10.2012, 15:36, "Peterakos" hay...@gmail.com:Hello.i use UnitCameraAttachmentBypass to retrieve depth buffer from camera, while rendering cow.osg.After that i pass it to a UnitInOut which uses fragment shader to change the result.I have noticed there is a problem when i try to retrieve the 0,0 texel from depth texture in fragment shader.Even though the cow is in the middle of the screen, the texel's 0,0 depth is always grey.Here is the frag shader code which shows the problem:uniform sampler2D depth_texture;void main(){gl_FragColor = texture(depth_texture, vec2(0.0, 0.0));}I attach the depth buffer.thnx.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-05 Thread Sergey Polischuk
Hi I'm talking about setting this bounds callbacks on geometry(drawable) leaves. 05.10.2012, 17:20, "Glenn Waldron" gwald...@gmail.com:Is that true? Setting an invalid bounding sphere will indeed suppress node-level culling, but I believe the near/far calculation is done at the Drawable level. See CullVisitor::apply(Geode). The usual approach for terrain rendering is to subdivide your globe into tiles. Then OSG can cull out the tiles that are not in the view, including far-off tiles or back-facing tiles (by means of the ClusterCullingCallback). That will bring the far clip plane closer and give you the z-buffer resolution you need in order to visualize surface features. In addition, you can decrease the Camera's near/far ratio; this will give you a little more near clip space if you still need it.Glenn Waldron / @glennwaldron On Fri, Oct 5, 2012 at 7:28 AM, Sergey Polischuk pol...@yandex.ru wrote:Hi  You can set ComputeBoundingBoxCallback on a geometry to specify whatever bounds you want. In your case to ignore earth geometry bound you can set its bound to uninitialized bounding box, and it will not make any difference to near\far calculations. Note that this thing completely disable view frustum culling on a geometry! In order to get it working you should write your cull callback and do check vs actual bounds there, if you need it.  Code looks like:  class UseInitialBoundsCallback : public osg::Drawable::ComputeBoundingBoxCallback { public:         osg::BoundingBox computeBound (const osg::Drawable  drawable)         {                 osg::BoundingBox brand_new_uninitialized_bbox;                 return brand_new_uninitialized_bbox;         } };  geometry-setComputeBoundingBoxCallback(new UseInitialBoundsCallback);  Cheers, Sergey.  05.10.2012, 05:11, "Preet" prismatic.proj...@gmail.com:  On Thu, Oct 4, 2012 at 5:37 PM, Chris Hanson xe...@alphapixel.com wrote:    I wanted to avoid specifying the near/far planes manually since the   behaviour without the Earth surface geometry is perfect as is. I don't   care about the overhead of drawing the surface geometry since its so   simple, and I don't want the scene graph to account for the surface   geometry (outside of rendering it); the other objects in the scene   should determine the camera frustum.     Due to the way OGL works with near/far, if you want it drawn, you need it   taken into account when computing the near/far planes.      Are you just worried about the far plane being set too far?   Including geometry for the   Earth's surface makes the other stuff disappear (and reappear at   certain angles).      It sounds to me like you're not trying to solve the right problem. You   should first determine WHY these other items aren't displayed at times.   Sorry if it wasn't clear; the items aren't being displayed because the  near and far planes that osg sets creates a frustum that doesn't  include them. I need to manually set the near and far planes to see  everything.   The near and far planes that osg sets without the earth surface  geometry is fine. Once you add the surface geometry though, the near  and far planes are set such that the items are no long in the view  frustum.   I was looking for a flag or something that basically tells osg "hey,  don't include this node when you do your view frustum calculations"  ___  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 listosg-users@lists.openscenegraph.orghttp://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::PPU , Texture unit associated with depth buffer

2012-10-04 Thread Sergey Polischuk
Hi
There are not only explicit texture bindings, but also implicit ones, which 
passed from units parents. If your unit added to other ppu units, it uses 
theirs output as input textures in order. There are also interfaces to bind 
other unit output to uniform IIRC setInputToUniform call
Cheers.
 Hello
 
 In osgppu_ssao project in simple.h file, there are the following lines:
 
 shader-add(originalDepthTexture, osg::Uniform::SAMPLER_2D);
 shader-set(originalDepthTexture, 1);
 
 Where is the depth texture associated with texture unit 1 ?
 i couldnt find it anywhere.
 
 thnx.



___osg-users mailing 
listosg-users@lists.openscenegraph.orghttp://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] glslDevil

2012-10-04 Thread Sergey Polischuk
Hi.
It used to be great tool at a time, but now is quite outdated, it would be 
great to see this project being developed further, as IIRC there are no 
crossplatform analogs with same functionality. Wish you best luck.

 Does anyone here on the list know any of the folks involved in the glslDevil 
 project:http://www.vis.uni-stuttgart.de/glsldevil/
 
 This seems to be one of the few prospects for a cross-platform (Linux and 
 Windows anyway) GLSL source-level debugging tool. It was not released as 
 open-source, but is a free download, and seems like it is getting neglected 
 now. I'd like to contact the creators and see about open-sourcing it and 
 maybe updating it a bit.
 
 Is anyone else interested in helping? Do we have any other Germans, 
 especially academics who might help me contact and talk to uni-stuttgart? I 
 have some interest in the project from an American university who might help 
 keep the project alive.
 
 --
 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
 
 Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • 
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android



___osg-users mailing 
listosg-users@lists.openscenegraph.orghttp://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] osgPPU::Processor and other root's children traversing order

2012-10-03 Thread Sergey Polischuk
Hiiirc ppu stuff does it things at a renderbin 100. Cheers. 03.10.2012, 23:42, "Peterakos" hay...@gmail.com:Hello.I am working on osgPPU but there are some things i haven't completely understood yet.I add 2 children in root's group.A cow model and the osgPPU::Processor.In processor i have added 1 child which outputs the depth buffer and under that child i have added 1 child which outputs to frame buffer.I have noticed that the order of root-addChild(loadedModel);root-addChild(ppu);doesnt matter and i am wondering why.UnitCameraAttachmentBypass needs the depth buffer which is taken from camera. But if ppu is rendered first (as first child) there will be no depth buffer to output to frame buffer (through UnitCameraAttachmentBypass's child, which is UnitOut).Why is this happening ? do i miss something?The scene graph is the followingroot   ppu       UnitCameraAttachmentBypass (outputs Depth)          UnitOut   loadedModelThank you for your time.,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Fixed size

2012-10-02 Thread Sergey Polischuk
Hi, Anders  Take a look at osg::Billboard and\or osg::AutoTransform Cheers,Sergey. 02.10.2012, 11:34, "Anders Backman" ande...@cs.umu.se:Hi all.Anyone got a reference to code/example illustrating how to get an object being rendered to the screen with a fixed size, no matter the distance to the camera?For example, if I want an icon to be rendered with a fixed size of 100 pixels high, it should rotate and translate with the rest of the scene, but the size should be constant.Cheers,Anders-- ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Mipmapping for downsampling

2012-09-28 Thread Sergey Polischuk
Hi

looks like you was hitting NaN's somewhere, as they propagate in such fashion.

Cheers.

28.09.2012, 18:11, Kenzo Lespagnol kenzo.lespag...@cm-labs.com:
 Hi Sebastian,

 Ok, I've displayed the different mipmap in my application and I realized that 
 a black square is propagated along the different mipmap level (see pictures). 
 Finally the last level became completely black.
 We solved the problem by changing the model involved.

 Thanks for the precious advices,
 Kenzo

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

 Attachments:
 http://forum.openscenegraph.org//files/mipmap7_205.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] FBO and mipmaps

2012-09-27 Thread Sergey Polischuk
Hi

in camera interfaces there are attach method which have parameter to specify 
either to generate mipmaps or not for texture rendertarget attachmant, it does 
not behave correctly?

Cheers,
Sergey.

27.09.2012, 01:55, Kenzo Lespagnol kenzo.lespag...@cm-labs.com:
 Hi Aurelien,

 I'm also using FBO and mipmaps and I would like to know if you're solved your 
 problem. I'm assuming FBO doesn't generate mipmap automatically as described 
 is this document http://www.songho.ca/opengl/gl_fbo.html.

 So I created a drawcallback to my render-to-texture geometry and add this 
 code:

 Code:
 struct DrawCallback : public osg::Drawable::DrawCallback
 {
 DrawCallback(osg::Texture* texture)
 : osg::Drawable::DrawCallback()
 , _texture(texture)
 {}

 ~DrawCallback()
 {}

 void drawImplementation(osg::RenderInfo ri,const osg::Drawable* dr) const
 {
 dr-drawImplementation(ri);

 osg::FBOExtensions* fbo_ext = 
 osg::FBOExtensions::instance(ri.getContextID(),true);
 ri.getState()-setActiveTextureUnit(0);
 ri.getState()-applyTextureAttribute(0, _texture.get());
 fbo_ext-glGenerateMipmapEXT(_texture-getTextureTarget());
 }
 osg::ref_ptrosg::Texture _texture;
 };

 I'm not sure about the final result as I've still some bugs. So I'm very 
 interesting by your solution.

 Regards,
 Kenzo

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

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