Re: [osg-users] [osgOcean] Wind speed representation

2009-11-02 Thread Dimitrios Filiagos
Hi,

guys thanks for your quick answers! I checked in the header and indeed the 
speed is considered to be m/sec, it works fine for me I just want to make a 
connection between wind and sea state.  


Cheers,
Dimitrios

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





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


[osg-users] [osgOcean] Wind speed representation

2009-11-01 Thread Dimitrios Filiagos
Hi,

I was wondering if there is a connection of wind speed parameter of the ocean 
surface to real world wind speed. Is it representing m/sec or Km/h or it has 
some connection with ocean sea state?


Thank you!


Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-13 Thread Dimitrios Filiagos
Hi,
you can certainly redistribute the boat model. Please be my guest!!!



Thanks


Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Dimitrios Filiagos
Hi,

you 're right now I understand why I had some crashes from time to time


Thanks!

Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Dimitrios Filiagos
Hi,

here's the code for normal interpolation I promised

osg::Vec3f OceanTile::normBiLinearInterp(float x, float y ) const{
float dx = x / _spacing;
float dy = y / _spacing;

unsigned int ix = dx;
unsigned int iy = dy;

dx -= ix;
dy -= iy;

osg::Vec3f s00 = getNormal(ix,iy);
osg::Vec3f s01 = getNormal(ix + 1,iy);
osg::Vec3f s10 = getNormal(ix,iy + 1);
osg::Vec3f s11 = getNormal(ix + 1,iy + 1);

return s00*(1.f - dx)*(1.f-dy) + s01*dx*(1.f-dy) + s10*(1.f - dx)*dy + 
s11*dx*dy;


}


and the code for getSurfaceDataAt()

osg::Vec4f FFTOceanSurface::getSurfaceDataAt(float x, float y) {
if(_isDirty)
build();

const unsigned int SAMPLE_SIZE = 5;
//ocean surface coordinates
float oceanX, oceanY;
//value to return
osg::Vec4f surfData(0.0f,0.0f,0.0f,0.0f);

//df osg::Vec3f tileOffset;

//translate x, y to oceanSurface origin coordinates
oceanX =  -_startPos.x() + x;
oceanY =   _startPos.y() - y;

//calculate the corresponding tile on the ocean surface
unsigned int ix/*tile_x*/ = oceanX/_tileResolution;
unsigned int iy/*tile_y*/ = oceanY/_tileResolution ;

//This might not be corect but I don't want to ruin data encapsulation of 
OceanDataType class
unsigned int frame = _oldFrame;

//Test if the tile is valid 
if(ix  _numTiles  iy  _numTiles){



const OceanTile data = _mipmapData[_oldFrame][0];//curData[ 
tile-getLevel() ];


float tile_x = oceanX - ix * _tileResolution;
float tile_y = oceanY - iy * _tileResolution;

osg::Vec3f norm = data.normBiLinearInterp(tile_x, tile_y);
surfData.x() = norm.x();
surfData.y() = norm.y();
surfData.z() = norm.z();
surfData.w() = data.biLinearInterp(tile_x, tile_y);


}
return  surfData;
}


then you can position an object on the ocean surface by doing something like:
osg::Vec4f data(m_oceanSurface-getSurfaceDataAt (x,y));

then data.w() is the height and as rotation you can use something like:

(data.x()*180.0f/PI,data.y()*180.0f/PI,(1.0f - data.z())*180.0f/PI)




Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-06 Thread Dimitrios Filiagos
Hi all,

the code that Jean Claude posted works like a sweet.
I also wrote a function similar to biLinearInterp to interpolate the normals of 
4 vertices.
I renamed the function getHeightAt(x,y) to getSurfaceDataAt(x,y) that return an 
osg::Vec4f now. The x,y,z represent the interpolated normal and the w the 
surface height. Now when you apply rotation and translation (only the height) 
to an object you might except from seeing the object to follow the motion of 
the waves you can see it rotate a little bit, like it should be in real life.

I will post the code soon.

One other thing what is the functionality of _isDirty and buid() in Jean 
Claudes code ? It will save me a lot of time.

Thanks!

Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-30 Thread Dimitrios Filiagos
Hi,
 I saw the Update function and understood that you're absolutely right!
I saw more accurate results also!
Yesterday I changed the function to retrieve the normal too. Now with the 
normal I can make the models not only to move up and down but rotate also when 
a wave passes.

I will try to use biLinearInterp to interpolate the height between four 
vertices. For that function you must provide the indices (x,y) of three 
vertices? Is that correct?


Thanks

Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-30 Thread Dimitrios Filiagos
Hi Kim,
  yesterday I realized that my object goes up and down from the water 
because:
a) it is smaller than the distance of two vertices of the grid 
b) the vertice displacement that takes place to simulate the wave

on larger objects it works fine!
I used the linear interpolation function of OceanTile it seems to work ok but I 
am still testing.

Thanks!





Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-29 Thread Dimitrios Filiagos
Hi,

it seems to work fine but I am still testing. For big models of height 2.0 and 
more works fine, for smaller height models there are frames that goes  above 
water, just a little though and also on some other frames just below the 
surface, especially on high wind speeds. This behavior might be correct but I 
'll try to make it more realistic. For bigger models the behavior is OK. I am 
thinking of using the surface normal to calculate the models pitch and roll, 
but it will take sometime .


Thanks!

Cheers,
Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Dimitrios Filiagos
Hi,

I checked the _oldFrame and you are absolutely right.


Thanks!


Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-25 Thread Dimitrios Filiagos
Hi Kim Bale,
   your hints are valuable. As I've seen so far I need to know the 
height on a specific point on sea surface. 
I wrote a function in FFTOceanSurface passing the x,y of a point. That function 
finds the corresponding ocean tile and retrives the closest vertice using the 
getVertex of OceanTile function. 
That way I can program my objects on the sea surface to maintain that height 
from the sea zero level on every frame.
I haven't done yet (actually it doesn't work so far) but I believe I am going 
to the right direction.
I' ll make a post when I have good news.
Thank you!

Cheers,
Dimitrios

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





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


[osg-users] osgOcean collision detection

2009-09-23 Thread Dimitrios Filiagos
Hi,

is it possible to gain the information of a specific point (providing the x,y) 
on the ocean surface? Because I am using osgOcean on a project and I need to  
do some collision detection stuff.

Thank you!

Cheers,
Dimitrios

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





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