[osg-users] getting eye position / direction

2012-03-09 Thread Andrey Ibe
Hi,

i am trying to get eyePosition and direction, more precisely, the direction of 
a ray for the purpose of ray tracing.

this is what i am doing:

Code:
const osg::Vec3d collisionPoint = intersection.getWorldIntersectPoint();
...
osg::Vec3d eyeDirection = collisionPoint - _tracer-getEye();
eyeDirection.normalize();


where the _tracer-getEye() method returns the position of the eye (computed 
once for a frame):
Code:

if (!_eye_set) {
osg::Vec3d center, up;
getCamera()-getViewMatrixAsLookAt(_eye, center, up);
_eye_set = true;
}


i am not sure whether this is the correct way to get the eye 
position/direction. i was thinking there has to be a way to get the direction 
from an intersection itself, but i am not confident using the start/end points 
(transforming them into appropriate coordinates) considering i create the rays 
(line segment intersectors) in WINDOW and also MODEL coordinate frames.

can anyone tell me whether my method is correct or i should rather try getting 
the start/end points from the intersector, transforming them and this way 
getting the ray (==eye) direction ?

Thank you!

Cheers,
Andrey[/code]

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





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


Re: [osg-users] [build] OpenGLES2.0 build error

2012-03-09 Thread Jordi Torres
Hi Mike,

Attached is a cmake toolchain to build osg against GLES2. You need to
comment lines from 204 - 207 in the CMakeLists.txt:

  #the below is taken from ogre, it states the gcc stuff needs to happen
before PROJECT() is called. I've no clue if we even need it
# Force gcc = 4.2 on iPhone
#include(CMakeForceCompiler)
#CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
#CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
#SET(GCC_THUMB_SUPPORT NO)

And then simply do:
$cmake  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake and make install
or if you prefer to compile in XCode:
 $cmake -GXCode  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake


If it solves your problem please report here and I will try to submit this
with a simple GLES2 example.

Cheers.

2012/3/8 Mike Wozniewski m...@mikewoz.com

 Hi Tobias,

 Is there any chance you can post your cmake command that builds for OpenGL
 ES2? I tried yours (had to change the SDK to 5.0) but I get a ton of
 compile errors, starting with:

 'glLoadMatrixf' was not declared in this scope

 Thanks,
 Mike

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





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




-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
# force CMake to assume crosscompiling
set(CMAKE_CROSSCOMPILING 1)

# assume we are somewhat on a Darwin system
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm )

# set the platform flags manually
set(APPLE 1)
set(IOS 1)

# hard set values
set(IOS_SDK_VERSION 5.0)
set(IOS_TARGET iPhoneOS)
set(IOS_ARCH armv7)

# some internal values
set(IOS_DEVELOPER_ROOT /Developer/Platforms/${IOS_TARGET}.platform/Developer)
set(IOS_SDK_ROOT ${IOS_DEVELOPER_ROOT}/SDKs/${IOS_TARGET}${IOS_SDK_VERSION}.sdk)

# for Xcode 4.x we need to set the sysroot to the internal string
if(XCODE)
set(CMAKE_OSX_SYSROOT ${IOS_SDK_ROOT} CACHE STRING SDK version FORCE)
else()
set(CMAKE_OSX_SYSROOT ${IOS_SDK_ROOT} CACHE STRING SDK version FORCE)
endif()

#
set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING SDK Architecture FORCE)

# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)


# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${IOS_SDK_ROOT}/System/Library/Frameworks
${IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${IOS_SDK_ROOT}/Developer/Library/Frameworks
)

# set appropriate flags
set(CMAKE_C_FLAGS --sysroot=${IOS_SDK_ROOT} -miphoneos-version-min=${IOS_SDK_VERSION} -arch ${IOS_ARCH} -v CACHE STRING C flags FORCE)
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS} CACHE STRING C++ flags FORCE)

# specify compiler
set(CMAKE_C_COMPILER ${IOS_DEVELOPER_ROOT}/usr/bin/clang CACHE PATH C compiler FORCE)
set(CMAKE_CXX_COMPILER ${IOS_DEVELOPER_ROOT}/usr/bin/clang++ CACHE PATH C++ compiler FORCE)

# for Xcode we need to skip the compiler introspection
if(XCODE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_C_COMPILER_WORKS TRUE)
endif()
# root path settings
set(CMAKE_FIND_ROOT_PATH
${IOS_DEVELOPER_ROOT}
${IOS_SDK_ROOT}/usr
${IOS_SDK_ROOT}/System
)
FIND_LIBRARY(OPENGLES_LIBRARY OpenGLES)
# search paths (for makefiles the first one might be switched to NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET(OSG_WINDOWING_SYSTEM IOS CACHE STRING Forced IPhone windowing system on iOS  FORCE)
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX imageio CACHE STRING Forced imageio default image plugin for iOS FORCE)

#set OpenGL_ES2 Flags
SET(OSG_BUILD_PLATFORM_IPHONE ON CACHE STRING  Forced iOS Platform FORCE)
SET(OSG_GL1_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE ) 
SET(OSG_GL2_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE) 
SET(OSG_GLES1_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE)
SET(OSG_GLES2_AVAILABLE ON CACHE STRING  Forced for GLES2 compilation FORCE)
SET(OSG_GL_DISPLAYLISTS_AVAILABLE OFF CACHE STRING  Forced iOS Platform FORCE)
SET(OSG_GL_LIBRARY_STATIC OFF CACHE STRING  Forced iOS Platform FORCE)
SET(OSG_GL_MATRICES_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE)
SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE)
SET(OSG_GL_VERTEX_FUNCS_AVAILABLE OFF CACHE STRING  Forced for GLES2 compilation FORCE)
SET(DYNAMIC_OPENSCENEGRAPH OFF CACHE STRING  Forced iOS Platform FORCE)
SET(DYNAMIC_OPENTHREADS OFF CACHE STRING  Forced iOS Platform FORCE)
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE 0 CACHE STRING  Forced iOS Platform FORCE)
SET (BUILD_OSG_APPLICATIONS OFF CACHE STRING  Forced iOS Platform FORCE)
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC_EXITCODE 0 CACHE STRING  Forced IPhone Platform FORCE)
SET (BUILD_OSG_EXAMPLES 

Re: [osg-users] [build] OpenGLES2.0 build error

2012-03-09 Thread Jordi Torres
I guess you are trying to compile for iOS5, if you are not sorry for the
noise.

Cheers.

2012/3/9 Jordi Torres jtorresfa...@gmail.com

 Hi Mike,

 Attached is a cmake toolchain to build osg against GLES2. You need to
 comment lines from 204 - 207 in the CMakeLists.txt:

   #the below is taken from ogre, it states the gcc stuff needs to happen
 before PROJECT() is called. I've no clue if we even need it
 # Force gcc = 4.2 on iPhone
 #include(CMakeForceCompiler)
 #CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
 #CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
 #SET(GCC_THUMB_SUPPORT NO)

 And then simply do:
 $cmake  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake and make install
 or if you prefer to compile in XCode:
  $cmake -GXCode  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake


 If it solves your problem please report here and I will try to submit this
 with a simple GLES2 example.

 Cheers.

 2012/3/8 Mike Wozniewski m...@mikewoz.com

 Hi Tobias,

 Is there any chance you can post your cmake command that builds for
 OpenGL ES2? I tried yours (had to change the SDK to 5.0) but I get a ton of
 compile errors, starting with:

 'glLoadMatrixf' was not declared in this scope

 Thanks,
 Mike

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





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




 --
 Jordi Torres Fabra

 gvSIG 3D blog
 http://gvsig3d.blogspot.com
 Instituto de Automática e Informática Industrial
 http://www.ai2.upv.es




-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osg::text Question on character size when set to SCREEN_COORDS mode

2012-03-09 Thread Robert Osfield
HI David,

On 9 March 2012 02:09, David Glenn david.e.glenn@navy.mil wrote:
 Just wondering:
 We had always assumed that if you set your setCharacterSize in the 
 SCREEN_COORDS mode that you set it the size of pixels (as told to me 
 originally by a friend) and the height in meters if you are in OBJECT_COORDS 
 mode. I assume Right?

This is mostly correctly, the only thing I'd add is the OBJECT_COORDS
mean local objects coords so will be in the coordinate system and
units that the text drawable sits below, this could be Meters, it
could be feet, it could be miles, it could be anything - it all
depends upon your the parental chain in the scene graph above the
text.

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


Re: [osg-users] getting eye position / direction

2012-03-09 Thread Robert Osfield
HI Andrey,

I'm rather confused about what you are trying to do, you question
seems rather mixed up.  Could you take a step back and explain at a
higher level what you are trying to achieve and we can then point you
in the right direction of how to achieve.

Robert.

On 9 March 2012 08:29, Andrey Ibe xry...@gmail.com wrote:
 Hi,

 i am trying to get eyePosition and direction, more precisely, the direction 
 of a ray for the purpose of ray tracing.

 this is what i am doing:

 Code:
 const osg::Vec3d collisionPoint = intersection.getWorldIntersectPoint();
 ...
 osg::Vec3d eyeDirection = collisionPoint - _tracer-getEye();
                eyeDirection.normalize();


 where the _tracer-getEye() method returns the position of the eye (computed 
 once for a frame):
 Code:

        if (!_eye_set) {
                osg::Vec3d center, up;
                getCamera()-getViewMatrixAsLookAt(_eye, center, up);
                _eye_set = true;
        }


 i am not sure whether this is the correct way to get the eye 
 position/direction. i was thinking there has to be a way to get the direction 
 from an intersection itself, but i am not confident using the start/end 
 points (transforming them into appropriate coordinates) considering i create 
 the rays (line segment intersectors) in WINDOW and also MODEL coordinate 
 frames.

 can anyone tell me whether my method is correct or i should rather try 
 getting the start/end points from the intersector, transforming them and this 
 way getting the ray (==eye) direction ?

 Thank you!

 Cheers,
 Andrey[/code]

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





 ___
 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] getting eye position / direction

2012-03-09 Thread Andrey Ibe
i am trying to compute the direction of an osg::LineSegmentIntersector object. 
i can get the collision point and i am trying to get the starting point - i 
need the vector of the intersector's direction.

i do this for the purpose of ray tracing (or ray casting). i create the 
intersectors this way 
Code:
new osgUtil::LineSegmentIntersector(cf, x, y);

where cf is 'WINDOW' (this is for the primary rays). i am not sure how to 
transform the starting/end point of the intersector into model (world) space. 
that's why i am trying to get the position of the camera as the starting point. 
i looked at the code of the linesegmentintersector thoroughly, but still am 
confused about the matrices, so i decided it could be less difficult to use the 
camera.

i need the vector to calculate the specular color.

robert, thank you very much for your help.

andrey

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





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


Re: [osg-users] getting eye position / direction

2012-03-09 Thread Robert Osfield
Hi Andrey,

Thanks for the explanation, make more sense now.

If you have a perspective camera then you'll be able to assume that
the all the line segments will start at the cameras eye point and end
at the intersection point that is returned.  To compute the camera's
eye position in world coordinates what you need to do is multiple the
(0,0,0) eye position in eye coorindates into the world coordinates by
multiply it by the the inverse of the camera's view matrix.

i.e.

  osg::Vec3d eyeInWorld = osg::Vec3d(0.0,0.0,0.0) *
osg::Matrixd::inverse(camera-getViewMatrix());


Robert.

On 9 March 2012 10:41, Andrey Ibe xry...@gmail.com wrote:
 i am trying to compute the direction of an osg::LineSegmentIntersector 
 object. i can get the collision point and i am trying to get the starting 
 point - i need the vector of the intersector's direction.

 i do this for the purpose of ray tracing (or ray casting). i create the 
 intersectors this way
 Code:
 new osgUtil::LineSegmentIntersector(cf, x, y);

 where cf is 'WINDOW' (this is for the primary rays). i am not sure how to 
 transform the starting/end point of the intersector into model (world) space. 
 that's why i am trying to get the position of the camera as the starting 
 point. i looked at the code of the linesegmentintersector thoroughly, but 
 still am confused about the matrices, so i decided it could be less difficult 
 to use the camera.

 i need the vector to calculate the specular color.

 robert, thank you very much for your help.

 andrey

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





 ___
 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] Write animation to mpeg or other video format

2012-03-09 Thread Sergey Polischuk
on linux you can use glc (google for glc capture) for this task. on output 
you'll get either *.png's per frame, or uncompressed video. on encoding to more 
usable format you can check this page https://wiki.archlinux.org/index.php/GLC

08.03.2012, 20:33, Zachary Hilbun osgfo...@tevs.eu:
 Hi,

 I want to be able to animate a scene and then write the images to an image 
 format such as mpeg or other format.

 Is this possible using OSG?

 If so, is there any documentation on how to do it or is this just one of 
 those read the source code things?

 Thank you!

 Cheers,
 Zachary

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

 ___
 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] OpenSceneGraph 3.1.1 dev release tagged

2012-03-09 Thread Robert Osfield
Hi All,

I have just tagged the OpenSceneGraph-3.1.1 developer release.  Merged
pending submissions that fixed a range of bugs, full ChangeLog below.

source package : OpenSceneGraph-3.1.1.zip
svn tag: svn co
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-3.1.1
OpenSceneGraph

My plan is to keep pushing out the dev releases and then go for a 3.2
stable release before the end of April.

Cheers,
Robert.

-- ChangeLog since 3.1.0:

2012-03-09 10:20  robert

* ChangeLog, include/osgManipulator/Projector,
  include/osgManipulator/RotateCylinderDragger,
  src/osgManipulator/Projector.cpp,
  src/osgManipulator/RotateCylinderDragger.cpp: From Chuck
  Seberino, Attached are modified versions of
  RotateCylinderDragger and Projector files that clean up the use
  of _onCylinder / isProjectionOnCylinder().

  I have also made changes to the RotateCylinderDragger to provide
  a cylinder ring with a thickness. It is totally optional, but
  IMHO makes the default behavior work better than a solid cylinder
  (which typically obscures the geometry you are trying to drag).
  Gives it a bit more to grab, especially in the case where
  eyepoint and cylinder axis are near parallel.
  

2012-03-08 16:33  robert

* CMakeLists.txt, ChangeLog, include/osg/Version: Updated version
  number for 3.1.1 dev release

2012-03-08 16:05  robert

* include/osg/Image, src/osg/Image.cpp: From Farshid Lashkari,
  I've added support for reading contents of cubemap textures to
  the osg::Image::readImageFromCurrentTexture method. I added a new
  parameter to the method for specifying which face of the cubemap
  to read.

2012-03-07 09:32  robert

* src/osgViewer/GraphicsWindowWin32.cpp: From Olaf Flebbe,
  Appended now a bugfixed proposition for the Win7 Multitouch
  Support.

  Now examples/osgmultitouch really works ;-)

  Based on yesterdays trunk.

  * It should now work with all Visual Studio Versions.
  * WIN_VER is left as-is
  * I added the missing declarations from a recent SDK, if not
  supplied by the SDK
  * If someone chooses to update WIN_VER, the declarations should
  not break.
  * All API Calls are runtime detected.
  * No CMake Variable, Support is enabled automatically .

2012-03-06 10:35  robert

* src/osgUtil/Optimizer.cpp: From Guillaume Millet, Please find a
  small fix to avoid crash of texture Atlas builder in case of
  textures with NULL image.

  If an object is comming with texture and NULL image, the texture
  atlas builder crash when sorting textures according to texture
  height.
  The fix is to skip textures with NULL image when inserting
  textures in the builder texture list.
  

2012-03-06 10:33  robert

* src/osgParticle/PrecipitationEffect.cpp: From Farshild Laskari,
  The vertex shader for the point stateset of PrecipitationEffect
  was not properly computing the clip vertex. It needed to apply a
  modelview transformation to the clip vertex. Attached is the
  fix.

2012-03-06 10:29  robert

* examples/CMakeLists.txt, examples/osgsimpleshaders,
  examples/osgsimpleshaders/CMakeLists.txt,
  examples/osgsimpleshaders/osgsimpleshaders.cpp: From Christian
  Buchner, The attached openscenegraph example is much simpler
  than
  osgshaders.cpp and demonstrates the use of GLSL vertex and
  fragment
  shaders with a simple animation callback. I found the
  osgshaders.cpp
  too complex to serve as a starting point for GLSL programming

2012-03-06 10:08  robert

* include/osgManipulator/Projector,
  src/osgManipulator/Projector.cpp: From Chuck Seberino, Here is a
  fix for the RotateCylinderDragger. This patch fixes the case
  where the picking direction is close to the cylinder axis. The
  current behavior is this:

  * If the eyepoint and cylinder axis are close to parallel (given
  some tolerance), then it uses a plane perpendicular to the
  cylinder axis.
  * Otherwise it uses a plane parallel to the cylinder axis
  oriented towards the eyepoint (previous behavior). This gives
  decent behavior and is the only path that was taken in the
  previous code. I kept with previous behavior and that allowed a
  good bit of code to be removed, simplifying things. There is now
  no need for the _onCylinder flag, but since there is a public
  accessor, I wasn't sure how to handle it for backwards
  compatibility, so I left it in. NOTE - there is no default

Re: [osg-users] Screen Shot question

2012-03-09 Thread Werner Modenbach
Is there also a high res example code?

Am 09.03.2012 01:45, schrieb Sergey Kurdakov:
 Hi  Thomas

  Is there a way to capture this programatically? 

 here is example from osgWorks where you have full control:
 http://code.google.com/p/osgworks/source/browse/trunk/src/osgwTools/ScreenCapture.cpp
  



 Regards
 Sergey

 On Fri, Mar 9, 2012 at 4:27 AM, Thomas Lerman osgfo...@tevs.eu
 mailto:osgfo...@tevs.eu wrote:

 I know I can capture a single screen capture with
 _keyEventTakeScreenShot in the ScreenCaptureHandler. As long as I
 remember correctly, this writes it out to some file. Is there a
 way to capture this programatically? How about capture it to the
 clipboard or at least query what the file path is?



 ___
 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] Performance question: Switch / NodeMask / WriteToFile

2012-03-09 Thread Christian Buchner
 Here is my repro case for the 1 children of a switch node causing
 massive cull times.

Tried this piece of code on Linux with osg 3.1.1 developer release. I
do not observe any high cull times here, even when drastically
increasing the number of children of the switch node. Too bad, my
intention was to do code profiling to get to the bottom of this.

So either osg 3.1 fixes this, or some implementation detail is more
efficient on Linux than it is on Windows.

I would have profiled on Windows, except the Visual Studio versions
with this feature cost a fortune (you can purchase a car for that
price).

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


[osg-users] Screen Shot question

2012-03-09 Thread Sergey Kurdakov
Hi

Is there also a high res example code?

http://forum.openscenegraph.org/viewtopic.php?t=3482

regards
Sergey
On Fri, Mar 9, 2012 at 7:33 PM, Werner Modenbach werner.modenb...@texion.eu
 wrote:

  Is there also a high res example code?



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


[osg-users] Simuating realistic large crowds with RVO2 C++ library

2012-03-09 Thread Christian Buchner
Hello,

I am currently working on a demo that shows the use of the RVO2 C++
library with OpenSceneGraph. Check out these videos to get an idea of
what RVO2 is capable of:
http://www.youtube.com/playlist?list=PLD56A0C7765234DCDfeature=plcp

This amazing library can be used for simulating large crowd of agents.
It implements an algorithm called optimal reciprocal collision
avoidance. My demo will be using an efficient billboarded renderer
for animated persons with approximation of camera perspective (this
can display thousands of people and is loosely based on the billboard
shaders found in the osgforest sample).

When done, I will be submitting the demo to osg-submissions. However
the textures required for the animated walking persons would be a few
hundred kilobytes in size. Unfortunately there are dependencies on
OpenMP (for which a CMake Module exists) and on the RVO2 library
however (for which I crafted my own CMake module that hasn't been
tested much so far).

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


Re: [osg-users] If I set a vertex color using floats and access the vertex color in a shader, is there a loss of precision?

2012-03-09 Thread Ethan Fahy
So I decided to go again and try to use a generic vertex attribute to store my 
index numbers.  I noticed from another osg forum thread that there is currently 
a problem using int values for vertex attributes but that floats are working 
and can be converted to ints in the shader.  With that in mind, I implemented 
Christian's code snippet up to the part where I've already added a vec2 float 
vertex attribute to the 6th position.  I have a couple of questions though:

1.  in osg there is no Vec1Array (which makes sense), but then if I only wanted 
to store 1 float value for each vertex, what would I use?  osg::array ?

2.  I need to access the vertex values from a frag shader instead of the vertex 
shader as seen in Christian's code snippet.  If I have a generic vertex shader 
like this:


Code:

void main(void)
{ 
gl_FrontColor = gl_Color; 
gl_Position = ftransform(); 
}




then can I access the vertex attribute in the frag shader like this?



Code:

in vec2 indices; 
void main(void)
{
//get index from vertex attribute 6
vec2 index = indices;
}



[/code]

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





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


Re: [osg-users] If I set a vertex color using floats and access the vertex color in a shader, is there a loss of precision?

2012-03-09 Thread Jason Daly

On 03/09/2012 02:08 PM, Ethan Fahy wrote:

So I decided to go again and try to use a generic vertex attribute to store my 
index numbers.  I noticed from another osg forum thread that there is currently 
a problem using int values for vertex attributes but that floats are working 
and can be converted to ints in the shader.  With that in mind, I implemented 
Christian's code snippet up to the part where I've already added a vec2 float 
vertex attribute to the 6th position.  I have a couple of questions though:

1.  in osg there is no Vec1Array (which makes sense), but then if I only wanted 
to store 1 float value for each vertex, what would I use?  osg::array ?


Close, osg::FloatArray  :-)



2.  I need to access the vertex values from a frag shader instead of the vertex 
shader as seen in Christian's code snippet.  If I have a generic vertex shader 
like this:


Code:

void main(void)
{
 gl_FrontColor = gl_Color;
 gl_Position = ftransform();
}




then can I access the vertex attribute in the frag shader like this?



Code:

in vec2 indices;
void main(void)
{
//get index from vertex attribute 6
vec2 index = indices;
}


Depends on what you're after, but I'm guessing not.  The fragment values 
will be interpolated between the vertices, so if you have a value of 6.0 
on one vertex and 8.0 on another, the value for the fragment halfway 
between those vertices  will be 7.0.  If you're drawing triangles, and 
you want all of the fragments on a particular triangle to have the same 
value, you can specify flat shading in the fragment shader:


flat in vec2 indices;

which might give you what you're looking for (without knowing how your 
geometry is laid out and how you're using the indices, I can only guess).


--J

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