Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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 747 times)
0 Members and 1 Guest are viewing this topic.
Offline Ramses

Senior Newbie




Java games rock!


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

Hello,

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.

Thanks!
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:

1  
2  
3  
RenderingAttributes ra = new RenderingAttributes();
ra.setDepthBufferEnable(false);
appearance.setRenderingAttributes(ra);
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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
    appearance.setPolygonAttributes(new PolygonAttributes(polygonFill,
            PolygonAttributes.CULL_NONE, 0));
    appearance.setColoringAttributes(
            new ColoringAttributes(color, ColoringAttributes.NICEST));
    appearance.setTransparencyAttributes(new TransparencyAttributes(
       TransparencyAttributes.BLENDED, opacity));

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

Senior Member




Speak Java!


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

Hi,

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

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (16 views)
2014-08-31 22:59:12

TehJavaDev (24 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (42 views)
2014-08-19 09:29:53

Tekkerue (41 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (26 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (73 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!