Re: [osg-users] HDR Skybox

2009-04-20 Thread Robert Osfield
Hi Rob,

The OSG doesn't yet support reading cube maps from dds files.  To add this
support will require a new osg::Image subclass to handle the cubemap.  This
is on my TODO but not near the top I'm afraid.

Robert.

On Tue, Apr 14, 2009 at 2:36 PM, Rob rchad...@gmail.com wrote:

 I've tried it with both R32G32B32A32 DDS file and HDR files. I recently
 upgraded to 2.8, but no luck still. I'm wondering if it has something to do
 with the textures being coppied into the cube image from seperate files, so
 I'll see about loading those files into a non cube texture.

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





 ___
 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] HDR Skybox

2009-04-15 Thread josselin . petit

Hi Rob,

I think you forgot to set the data in the textureCubeMap in float,  
that's why you see strange colors for values above 1.0.


You can try this :

osg::TextureCubeMap* cubemap = new osg::TextureCubeMap;
cubemap-setInternalFormat(GL_RGBA16F_ARB);
cubemap-setSourceType(GL_FLOAT);
cubemap-setSourceFormat(GL_RGBA);
#define CUBEMAP_FILENAME(face)  
../../../OpenSceneGraph-Data/Cubemap_debevec/ #face .hdr


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

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::MIN_FILTER, 
osg::Texture::LINEAR);
cubemap-setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);

//cubemap-setResizeNonPowerOfTwoHint(false);
}

Hope this help :)
Josselin.


This message was sent using IMP, the Internet Messaging Program.

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


Re: [osg-users] HDR Skybox

2009-04-14 Thread Rob
I've tried it with both R32G32B32A32 DDS file and HDR files. I recently 
upgraded to 2.8, but no luck still. I'm wondering if it has something to do 
with the textures being coppied into the cube image from seperate files, so 
I'll see about loading those files into a non cube texture.

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





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


[osg-users] HDR Skybox

2009-03-31 Thread Rob
Can anyone help me with loading 6 hdr images into a cubic texture? The code 
below seems to work, but the images are sort of crazy anywhere the value of the 
colors is greater than one. I'm guessing that somehow I'm messing up the pixel 
format, but I can't figure it out. 


Code:

osg::TextureCubeMap* mTexture;
osg::Image* mImage00 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c00 + type);
osg::Image* mImage01 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c01 + type);
osg::Image* mImage02 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c02 + type);
osg::Image* mImage03 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c03 + type);
osg::Image* mImage04 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c04 + type);
osg::Image* mImage05 = ODTWTextureManager::GetPtr()-ReadImageFile(name 
+ _c05 + type);
cout   Image 5 format:   mImage05-getInternalTextureFormat()  
endl;

mTexture = new osg::TextureCubeMap();
mTexture-setClientStorageHint(true);
mTexture-setImage(osg::TextureCubeMap::POSITIVE_X,mImage00);
mTexture-setImage(osg::TextureCubeMap::NEGATIVE_X,mImage01);
mTexture-setImage(osg::TextureCubeMap::POSITIVE_Y,mImage02);
mTexture-setImage(osg::TextureCubeMap::NEGATIVE_Y,mImage03);
mTexture-setImage(osg::TextureCubeMap::POSITIVE_Z,mImage04);
mTexture-setImage(osg::TextureCubeMap::NEGATIVE_Z,mImage05);
cout   Cube format:   mImage05-getInternalTextureFormat()  
endl;


mTexture-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);
mTexture-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);

osg::Uniform* mUniform = new osg::Uniform(inSampler.c_str(),inTexunit);
mCurrentMaterial-addUniform(mUniform); 

mCurrentMaterial-setTextureAttributeAndModes(inTexunit,mTexture);




thanks!

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





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


Re: [osg-users] HDR Skybox

2009-03-31 Thread David Spilling
Rob,

What image format are you actually loading?

Regards,

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