Right, I found all of the code that does all of that. I am trying to actually use the transparency map and apply it to the COLR alpha. I am almost there. I have been able to get the COLR channel and the TRAN channel and I just need to do the magic on the osg::Images themselves. I really would like to make the lwo plugin work the same way it does in LW.
-- Rick On 4/19/07, Chris Hanson <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote: > Hello All, > I am working on the osgDB_lwo plugin. I am trying to get it to use > transparency maps. In OSG, I know I can use the alpha channel of the > color map to provide a transparency map. In LightWave, there is a > seperate grey-scale image that is used as the transparency map. In the > current implementation of the plug-in by Marco Jez, that block is ignored. > > I have it to the point in the code where I know about both blocks > (alreadt read in with osgDB from a file). I have two conditions: > 1. There is a color map. In this case, I need to grab the transparency > map and place its grey value in the alpha channel of the existing color map. > 2. There is not a color map, but only a base color. Here I create the > color map by placing the grey value of the transparency map in the alpha > channel and I set the RGB values to the base color. > > I have a pretty good idea how to do this if the images were already 32 > bit BGRA or whatever. I am not as secure working with the other image > types, like if there is not already an alpha channel, or if the thing is > using grey-scale or an indexed color. Should I create a new image and > fill it or can I use the rescale function to change it? I am not sure > how to create an image from scratch without reading it from a file. I > am not sure about how to read and write values to and from the images > (except for the 32 bit case, I got that). Any help would be > appreciated. Any reference materials I could read? Gatchas I should > watch out for? I had this discussion with Marco Jez a while ago: Hi Chris, > I'm curious -- maybe I asked this before. Does the LWO2 loader support > bitmap transparency on LW surfaces? If it doesn't, that's understandable, > but if it does, I must be doing something wrong. I figured I'd ask the > expert before spending too much time working on it. Not directly. Only textures applied to the COLR (color) channel are taken into consideration. The only way to do pixel-level transparency is to use a RGBA texture on the color channel. Lightwave will ignore the alpha channel, while the LWO loader will ignore any transparency texture, so you can have both set in the same surface. > The goal is to make things like chain-link fences that have simple > geometry and a small mask texture to cut a complex appearance into the > visual geometry. Again, you can do that by using a RGBA texture on the color channel. But remember that you still have to enable alpha testing, or even alpha blending if your texture is semi-transparent. The latter is easily done by setting the Transparency value of the LWO surface to any value larger than 0. The LWO loader will automatically enable blending for such surface. If you just need alpha testing, you may be required to enable it manually. When I developed the LWO plugin, alpha testing was enabled by default but now it isn't (I don't know whether the change occured in OSG or in the nVidia drivers). Now that OSG has solid support for shaders, the LWO loader could be largely improved. I just need time to do that... :-) Hth, Marco > Thanks in advance for any help, > -- Rick I'd love to see this capability available too. -- Chris 'Xenon' Hanson aka Eric Hammil | http://www.3DNature.com/ eric at logrus "I set the wheels in motion, turn up all the machines, activate the programs, and run behind the scenes. I set the clouds in motion, turn up light and sound, activate the window, and watch the world go 'round." -Prime Mover, Rush.
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
