|
Thanks for your reply,
Justin.
But I am still in doubt...
I've found below in the docs: " Blend function - used in blended transparency and antialiasing operations. The source function specifies the factor that is multiplied by the source color. This value is added to the product of the destination factor and the destination color. The default source blend function is BLEND_SRC_ALPHA. The source blend function is one of the following: BLEND_ZERO - the blend function is f = 0. BLEND_ONE - the blend function is f = 1. BLEND_SRC_ALPHA - the blend function is f = alphasrc. BLEND_ONE_MINUS_SRC_ALPHA - the blend function is f = 1 - alphasrc. " But OpenGL has the following functions : ______________________________________________________________________________________ GL_ZERO (0,0,0,0) GL_ONE (1,1,1,1) GL_SRC_COLOR (RS/kR,GS/kG,BS/kB,AS/kA) GL_ONE_MINUS_SRC_COLOR (1,1,1,1) - (RS/kR, GS/kG, BS/kB, AS/kA) GL_DST_COLOR (Rd/kR,Gd/kG,Bd/kB,Ad/kA) GL_ONE_MINUS_DST_COLOR (1,1,1,1) - (Rd/kR,Gd/kG,Bd/kB,Ad/kA) GL_SRC_ALPHA (AS/kA,AS/kA,AS/kA,AS/kA) GL_ONE_MINUS_SRC_ALPHA (1,1,1,1) - (AS/kA,AS/kA,AS/kA,AS/kA) GL_DST_ALPHA (AD/kA, AD/kA, AD/kA, AD/kA) GL_ONE_MINUS_DST_ALPHA (1,1,1,1) - (AD/kA , AD/kA, AD/kA, AD/kA) ...... where Rd, Gd, Bd, Ad are RBGA color dst; RS, GS, BS, AS are RBGA color src; kR, kG, kB, KA are the alpha Blend ____________________________________________________________________________________________ Following OpenGL.org glspec1.1 : "Let the source and destination blending quadruplets be S and D, respectively. Then a quadruplet of values is computed as : ColorSource * S + ColorDest * D " Then:
Opaque polygons can be made this way: BlendFunc ( ONE, ZERO ) ; meaning: myBlendedPoly = myPolygon * 1 + background * 0; Translucent polygons can be made this way: BlendFunc ( SRC_ALPHA, ONE_MINUS_SRC_ALPHA ) ; meaning : myBlendedPoly = myPolygon * (alpha) + background *(1-alpha); which is the Java3D default ;-)
BUT BlendFunc ( DST_COLOR, ZERO ); does this: myBlendedPoly = myPolygon * background + background * 0; or
myBlendedPoly = myPolygon * background ;
in other words it multiplies the color instead a simple add. OK ! So what ? Quake3 use the following formula for multitexture: myMultiTexPoly = (light + bump(s)) *
texture + specular ;
As far I understand above good bump mapping
effect needs a multiply. Back to Java3D we have no DST_COLOR blend
function, or least not as OpenGL specs above.
In my last bump map try (
http://www.cpm2002.hpg.ig.com.br/alessandro/bump/bump2.html ), I archive some
good results by using transparencyMode NICEST but the colors lost brightness,
and when I use default blend functions the color becomes too light and the bump
map is almost imperceptible.
So I ask :
* Has Java3D a way to have a similar effect given
by glBlendFunc (GL_DST_COLOR, GL_ZERO )
?
* Is the
transparencyMode NICEST (closet thing ?) the function above
?
Any feedback will be welcome ;-)
Thank you
Alessandro Borges
----- Original Message ----- From: "Justin Couch" Sent: Wednesday, March 12, 2003 1:40 PM Subject: Re: [JAVA3D] BlendFunc(DST_COLOR,ZERO) ? > Alessandro Borges wrote: > > Someone knows how can I have OpenGL's BlendFunc(DST_COLOR,ZERO) in Java3D ? > > The OGL glBlendFunc() call is encapsulated in the TransparencyAttributes > class. If you look in there, you'll find everything you need to know to > set the blending modes as needed. > > -- > Justin Couch http://www.vlc.com.au/~justin/ |
- [JAVA3D] AW: [JAVA3D] RestrictedAccessException ? in ... Florin Herinean
- [JAVA3D] BlendFunc(DST_COLOR,ZERO) ? Alessandro Borges
- Re: [JAVA3D] BlendFunc(DST_COLOR,ZERO) ? Justin Couch
- Re: [JAVA3D] BlendFunc(DST_COLOR,ZERO) ? Alessandro Borges
- Re: [JAVA3D] BlendFunc(DST_COLOR,ZERO) ... Justin Couch
- [JAVA3D] Java 3D: How to make it not live? tony Lincoln
- Re: [JAVA3D] Java 3D: How to make it not live? Jeremy Booth
