Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Transparency Hiding Shapes  (Read 923 times)
0 Members and 1 Guest are viewing this topic.
Offline Ramses

Senior Newbie

Java games rock!

« Posted 2006-02-23 18:28:54 »


Since this is my first post in a long time I just want to thank all of you guys working on Xith and making it available to the community at large.

My scene consists of one big hollow box with a whole bunch of smaller shapes inside it. My problem is when setting the transparency of the big box, some (not all) of the shapes start dissapearing from the view. And depending on the rotation of the box, some shapes will appear and other will disapear. The image I'm attaching shows the box with its polygon attributes set to POLYGON_LINE, to show you all the shapes that should be appearing in the scene, and 3 other views at other rotations with the transparency set. You'll notice that some shapes appear and disapear.

What I'd like to do is always have the shapes appear when the big box's transparency is set. Any ideas where I could be going wrong in my scene setup?

This is part of a pretty big program so providing code samples of the whole rendering process would be difficult, but if you feel a certain piece would help please let me know.

Offline Ramses

Senior Newbie

Java games rock!

« Reply #1 - Posted 2006-02-23 23:46:53 »

After going at it some more and reading some older threads here I found that adding this to the appearance setup fixes it:

RenderingAttributes ra = new RenderingAttributes();
Offline Ramses

Senior Newbie

Java games rock!

« Reply #2 - Posted 2006-02-23 23:51:50 »

But now when the box shape is set to zero transparency the other shapes are bleeding through and showing  Sad

Help! Smiley

Here's my appearance init for the box shape:
    appearance.setPolygonAttributes(new PolygonAttributes(polygonFill,
            PolygonAttributes.CULL_NONE, 0));
            new ColoringAttributes(color, ColoringAttributes.NICEST));
    appearance.setTransparencyAttributes(new TransparencyAttributes(
       TransparencyAttributes.BLENDED, opacity));

   RenderingAttributes ra = new RenderingAttributes();
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Yuri Vl. Gushchin

Senior Devvie

Speak Java!

« Reply #3 - Posted 2006-02-24 08:34:41 »


This directly relates to transparency sorting policy set in Xith3D View. By default, rendering order is determined by sorting distances from the shape center (center of bounding sphere) and eyepoint (which in your case is not correct because of your box ENCLOSES all the shapes, and this explains situation with rotations). Better option is TRANSPARENCY_SORT_BOUNDING_SPHERE_AND_EYE_RAY_INTERSECTION transparency sorting policy, but to achieve better results you should break your box to six planes, so they treated as separate objects.

Currently, there is no easy solution for multiple-intersecting AND, MOST IMPORTANT, SELF-INTERSECTING shapes. There is a technique called multipass depth peeling, but it requires high-end GPU hardware.

Alternatively, you may employ some of your application specifics and constraints by placing your shape in the ordered group and directly manipulating their rendering order (by defining order index mapping). In this case you can (and should) switch transparency sorting off on scene-basis or on shape-bases (see setSortEnabled and setEnabled on TransparencyAttributes). This will [should] not give you any speed penalty, because of sorting is done on CPU anyway.


Yuri Vl. Gushchin
JProof Group
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Coldstream24 (18 views)
2015-09-03 00:41:28

Andrew_3ds (29 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (14 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (30 views)
2015-08-29 11:30:54

GamerC4 (38 views)
2015-08-22 20:38:50

GamerC4 (36 views)
2015-08-22 20:37:18

GamerC4 (42 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 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!