Re: [Celestia-developers] Problem: texture0 with Alpha channel in CMOD is transparent in opaque are
Real-time 3D visualization of space
Status: Beta
Brought to you by:
cjlaurel
From: Chris L. <cl...@gm...> - 2006-08-30 17:51:32
|
On 8/30/06, Selden E Ball Jr <se...@le...> wrote: > Chris wrote > > > I checked in a fix . . . It was a silly one line patch: the alpha > > blend function was set incorrectly in the Open 2.0 path for mesh > > rendering. Thanks for the bug report; let me know if my fix works for > > you. > > Only partially :-( > > There seem to be quite a few related problems. > > I've created an Addon to demonstrate them > http://www.lepp.cornell.edu/~seb/celestia/files/test_trans.zip > (3.5 KB) > > It includes an html file with Cel:// urls to demonstrate the problems. > > Below is a textual rendition of the html file, listing what I observed. I checked in a fix for the crash problem. It was tricky because I wasn't able to reproduce it under the debugger. Things that are not bugs: Clouds completely inside the mesh - You're correct that the radius of the mesh is the distance to the furthest face of the mesh bounding box and not the furthest corner. I think that this is reasonable; changing it might break a few add-ons. Clouds rendered on top of model - well, it's sort of a bug, but it's not one that can be easily fixed. Transparent meshes are rendered without writing to the z-buffer in order to avoid the even worse artifacts that would result if z writes were enabled. Anything rendered afterward will appeard to be on top of the mesh. What would be better is if z was written for nearly opaque pixels but not for more transparent ones. I'm not going to fuss too much too much about this because clouds really aren't intended to be used with meshes that deviate much from ellipsoids. For the rest of the items, I think we mostly need to clarify once and for all what the expected behavior should be. In some cases I think the OpenGL 2.0 path is doing the right thing, and in others it's not. SSC material overrides: Currently the material parameters in the ssc file only override the ones in the mesh if a base texture is specified in the ssc file. Also, only the base texture and color are considered; specular color, specular map, emissive map, etc. are all ignored. Is this right? One thing I will not allow multiple materials in the ssc file that are mapped to material references inside the cmod mesh. Behavior of textures with alpha: I think that the OpenGL 2.0 path is doing the right thing here. For meshes, I think it's easiest if the texture's alpha channel is always treated as the opacity and not the specular mask. If I could go back in time, I would do the same for spheres as well, requiring something like 'SpecularInAlpha true' to appear in the ssc definition for the alpha channel of the base texture to be treated as the specular mask. The default behavior of the alpha channel should match its conventional usage as opacity. It's definitely bad that the OpenGL path exhibits different when the base texture is specified in the ssc file rather than the cmod file. I'm prepared to break a few existing add-ons in order to define consistent and reasonable behavior for cmods, alpha textures, and ssc materials. --Chris > > s. > ================== > Testing transparency of model meshes > > Environment: > Celestia's earth.png and earthnight.png applied to a cube. > > first set of links show the model with the textures applied in an SSC file, overtiding the model's material definitions. > oceans should be reflective, land not. > nightlights should be visible on shadowed side > > Second links show the model with the textures applied using the material for texture0 and emissivemap. > oceans should be opaque, land transparent. > nightlights should be visible on shadowed side > > (nightlights seem to work fine) > -------------------------------------------------------------------------------- > > ++ textures applied in SSC file w/no clouds no atmo > > ok? > + non-ogl2 render paths are entirely opaque; don't see specularity. > + basic and other render paths don't crash. > > problems: > - OGL2 path shows oceans opaque, land transparent instead of specularity > - in OGL2 path, shaded sides of object are transparent > > ++ textures applied in SSC file w/clouds & atmosphere > > problems: > - OGL2 path shows oceans opaque, land transparent instead of specularity > - in OGL2 path, shaded sides of object are transparent > - switching to Basic render path crashes Celestia > > ++ textures applied in CMOD material w/no clouds, no atmo > > OK: > + older render paths look OK: oceans opaque, land transparent, shaded sides opaque > + basic and other render paths don't crash. > > Problems: > - ogl2 path shows the cube entirely opaque > > > ++ textures applied in CMOD material w/clouds & atmo > > Problems: > - ogl2 path shows the cube entirely opaque > - clouds are inside the cube: apparently the radius of clouds are relative to object's radius but that's entirely within the cube (apparently the cube's radius sets the distance to the center of the faces) > - clouds are drawn after cube, so they're visible even though they're inside the model. > and then > - switching from ogl2 to Basic render path crashes > ================== |