Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Can't get alpha blending to work properly    (Read 12910 times)
0 Members and 1 Guest are viewing this topic.
Offline arne

Senior Devvie

money is the worst drug- we should not let it rule

« Reply #30 - Posted 2005-10-13 22:34:59 »

Err... it really works ?
I haven't got it to work, What did I do wrong I wonder? There's nothing more then adding the Shapes Huh Or does this only work, if I don't use opaque planes?

:: JOODE :: Xith3d :: OdeJava ::
Offline hawkwind

Junior Devvie

Java games rock!

« Reply #31 - Posted 2005-10-13 23:40:30 »

uncertain without seeing your code.  Opaque planes???  What do you mean here??
Offline arne

Senior Devvie

money is the worst drug- we should not let it rule

« Reply #32 - Posted 2005-10-14 10:35:31 »

You wanted to see the code. Here is it  (I tried to remove unimportant stuff, because then it would be even more, the code is from my terrain-loader. It splits the terrain in many different pieces).
I marked the areas bold, where I set Transparency Attributes , cause I believe there could lie the problem)

             // g is the Geometry
                for(int i = 0; i < texTypeSplit.length; i++) {
                   System.out.println("----------------------------- "+ i);
                    AppearanceResult res = getAppearance(texTypeSplit, x, y, x+SEGMENT_LENGTH, y+SEGMENT_WIDTH);
                    if(res != null) {
                        Shape3D shape = new Shape3D(g,res.getAppearance());

    public AppearanceResult getappearance(String type, int start_x, int start_y, int end_x, int end_y) {
        Texture tiles = texloader.loadTexture(tilePath,"RGB",true,Texture.BASE_LEVEL,Texture.BASE_LEVEL_LINEAR,Texture.WRAP);
        states[0] = new TextureUnitState();
        TextureAttributes texAttrib = new TextureAttributes();
        if(checkoutBelow) { // For the purely opaque level at the ground, I don't have an alpha layer, so I skip setting the alpha
            Texture alphamap = texloader.getMinMapAlphaTexture(alphaPath);

            states[1] = new TextureUnitState();
            TextureAttributes alphaAttrib = new TextureAttributes();
            TransparencyAttributes transAttr = new TransparencyAttributes(   // These Transparency Attributes are for the Layers,
                    TransparencyAttributes.BLENDED,                                                // that get layed over others, so they are more
                    0f,                                                                                      // transparent in some places than in others.
        else {
            TransparencyAttributes transAttr = new TransparencyAttributes();   // that's for layer at the bottom, which is fully
            transAttr.setSortEnabled(true);                                                                       // opaque
        AppearanceResult res = new AppearanceResult(a, checkoutBelow);

Note, that it works, if I don't use the DecalGroup, but Transformgroups, that moves the alpha-layers a bit up, so they get shown over the opaque layer.


:: JOODE :: Xith3d :: OdeJava ::
Pages: 1 [2]
  ignore  |  Print  

EgonOlsen (79 views)
2018-06-10 19:43:48

EgonOlsen (59 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (261 views)
2018-05-13 18:23:11

nelsongames (159 views)
2018-04-24 18:15:36

nelsongames (158 views)
2018-04-24 18:14:32

ivj94 (901 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (813 views)
2018-03-24 14:43:53

Solater (177 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!