Java3D:Farbige Flächen verschwinden lassen(Transparenz- oder Colorinterpolator?))

aze

Bekanntes Mitglied
Hi

Ich benutze einen TransparenzInterpolator um einige Flächen im meinen 3D Szenarion "ein- und auszublenden".Das klappt auch fast perfekt.Nur Flächen mit Farben werden nicht transparent gemacht.Muss man dazu einen Colorinterpolator benutzen oder geht das auch mit dem TransparenzInterpolator ?

Schöne Grüße

Aze
 
Also eigentlich sollte das gehen unabhängig von der Farbe 😉
Zeig am Besten mal bisschen Code davon
- wie du die Flächen farbig machst
- und wie du den TransparencyInterpolator verwendest
 
Leider ist das ganze Prgramm zu groß um es hier angeben zu können.Aber ich kann ja mal die Methode für den Interpolator angeben.Falls mehr Informationen gebraucht werden einfach nachfragen.Ich hab auch noch ein paar Screenshots angepackt in dem man die Problematik sehen kann:

Java:
    private void createLineLine4ViewsAnimation(Alpha a) {

    

     TransparencyAttributes ta = new TransparencyAttributes();

            ta.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
            ta.setCapability(TransparencyAttributes.ALLOW_VALUE_READ);
            ta.setCapability(TransparencyAttributes.ALLOW_BLEND_FUNCTION_READ);
            ta.setCapability(TransparencyAttributes.ALLOW_BLEND_FUNCTION_WRITE);

            ta.setTransparencyMode(TransparencyAttributes.NICEST);

            Appearance appearance = getToothCopyPosObjects(getVisibleTooth(n)).getToothCopyAppearance(n, JawsConst.MESIAL);
            appearance.setTransparencyAttributes(ta);

            for (Appearance app : getToothCopyPosObjects(getVisibleTooth(n)).getToothCopyAllAppearance(n)) {

                app.setTransparencyAttributes(ta);

            TransparencyInterpolator ti = null;


            if (jawsMode == JawsConst.LINE) {
                ti = new TransparencyInterpolator(a, ta, 1.0f, 0);
            }

            if (jawsMode == JawsConst.LINE4VIEWS) {
                ti = new TransparencyInterpolator(a, ta, 0, 1.0f);
            }

            ti.setSchedulingBounds(new BoundingSphere(new Point3d(0, 0, 0), 10000.0));

            animation.addChild(ti);


   public Appearance getToothCopyAppearance(int toothPos, int surface) {
        ToothSurface toothSurface = new ToothSurface(toothPos, surface);

        List<Shape3D> shapes = ToothHashManager.getShape3D(toothSurface);

        if (shapes != null && shapes.size() >= 2) {
            return shapes.get(1).getAppearance();
        } else {
            return null;
        }


    }

            }
 

Anhänge

  • vorher.jpg
    vorher.jpg
    33,4 KB · Aufrufe: 50
  • nachher.png
    nachher.png
    71,2 KB · Aufrufe: 43
Versuche mal mit :

app.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST, 0.6f));

Wobei 0.6 für die Transparenzstärke ist.
1.0f == vollständig Tranzparent

Mfg
 

Zurück
Oben