Re: [osg-users] Runtime texture mod
Thanks Ulrich and Jason, Originally I was thinking of something that would load a texture and modify everything with a certain hue (eg everything with a given hue is set to a different hue at runtime). Sounds like there aren't any existing tools for something like that (though it wouldn't be that hard to write). I'll pursue the other option of setting a material on the geometry. This makes things slightly more complicated because the geometry must use 2 separate materials which our current models don't have. Thus I'll have to specifically edit/create each of our models with the different materials. PS Shaders are a difficult option because we will likely be running our software on machines that don't support the new shader stuff... That's the only reason I wanted to stay away. Thanks! -Brad -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ulrich Hertlein Sent: Saturday, July 18, 2009 12:34 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Runtime texture mod On 17/7/09 6:14 PM, Brad Huber wrote: Does anyone know of a good way to modify pixels in a texture at runtime w OSG? Basically I’m looking for a way for the user to select an arbitrary color to be used on an airplane or similar. EG ability to switch to any color as in the attached image. From what you're saying it sounds like you really only need to modify the object base colour, using one of the techniques that Jason suggested. If you *really* want to modify individual pixels in a texture you can use Image::data() to get a pointer to the image data and modify that directly. It might be a bit tricky since you have to take the Image format into account. Call Image::dirty() when you're done with the modification to upload the new data to the texture. Cheers, /ulrich ___ 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] Runtime texture mod
Brad Huber wrote: Thanks Ulrich and Jason, Originally I was thinking of something that would load a texture and modify everything with a certain hue (eg everything with a given hue is set to a different hue at runtime). Sounds like there aren't any existing tools for something like that (though it wouldn't be that hard to write). I'll pursue the other option of setting a material on the geometry. This makes things slightly more complicated because the geometry must use 2 separate materials which our current models don't have. Thus I'll have to specifically edit/create each of our models with the different materials. Yeah, I think those are your two options. Either tint the texture data directly, or use a material to do modulation. PS Shaders are a difficult option because we will likely be running our software on machines that don't support the new shader stuff... That's the only reason I wanted to stay away. That's a good reason :-) --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Runtime texture mod
On 17/7/09 6:14 PM, Brad Huber wrote: Does anyone know of a good way to modify pixels in a texture at runtime w OSG? Basically I’m looking for a way for the user to select an arbitrary color to be used on an airplane or similar. EG ability to switch to any color as in the attached image. From what you're saying it sounds like you really only need to modify the object base colour, using one of the techniques that Jason suggested. If you *really* want to modify individual pixels in a texture you can use Image::data() to get a pointer to the image data and modify that directly. It might be a bit tricky since you have to take the Image format into account. Call Image::dirty() when you're done with the modification to upload the new data to the texture. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Runtime texture mod
Brad Huber wrote: Does anyone know of a good way to modify pixels in a texture at runtime w OSG? Basically I’m looking for a way for the user to select an arbitrary color to be used on an airplane or similar. EG ability to switch to any color as in the attached image. I’m hoping to stay away from shaders. Thanks in advance for any insight. The simplest way would be to use a Material on the geometry, allowing the user to modify the Diffuse color. Then, you could apply a gray-scale texture in MODULATE mode to try and add a little detail. A more complex possibility would be to play with a TexEnvCombine. There are a lot of potential options there, including blending a texture with the overall environment color. I know you're hoping to steer clear of them, but a shader would be the most flexible method by far. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org