Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (746)
Games in Android Showcase (226)
games submitted by our members
Games in WIP (827)
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  
  [Lwjgl] Partial transparent texture on Voxel don't render correctly (SOLVED)  (Read 2678 times)
0 Members and 1 Guest are viewing this topic.
Offline Akinesis

Senior Newbie


Exp: 3 years



« Posted 2014-08-23 21:16:59 »

Hello everyone,it's me again for a small but annoying problem. I currently try do make a voxel engine, everything is going one more or less well but globally it's fine.

One of my problem is that i have a leaf texture which is of course transparent in some point but when i render it the transparency only apply for the current chunk (16*16*16 group of blocks) which the leaf block is. And for the rest its the absolute nothingness.

A picture will explain this more :


In render each chunk in an interleaved VBO and i have enable BLEND etc..

If anyone have an idea of what's going wrong so i can try to fix it, i'll be glade. My opinion its that i draw the leaf before the other blocks so when the transparency is enabled there is nothing behind it, but i really wishing i'm wrong.

P.S: sorry for my bad english, it's not my native language.

What doesn't kill you, give you XP.
Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #1 - Posted 2014-08-23 21:44:58 »

You can fix the fully transparent pixels by enabling alpha test.

As for the translucent pixels, it's a really annoying problem with OpenGL. What most people do is separate the semi-transparent blocks from the opaque blocks, and render them separately.

Offline Longarmx
« Reply #2 - Posted 2014-08-23 21:47:44 »

In addition to separating transparent blocks from opaque blocks, you will also have to sort from back-to-front, so that the blocks farther away get rendered first.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Akinesis

Senior Newbie


Exp: 3 years



« Reply #3 - Posted 2014-08-24 11:42:43 »

Hi ! So i create a separate list for all my transparent voxel and then render it after all the other chunks and its working. Thanks to you two for your help and quick response.

I'll mark this problem as solved.

 Grin

What doesn't kill you, give you XP.
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #4 - Posted 2014-08-24 20:22:02 »

maybe disable backface culling (also check shader for not using gl_FrontFacing) and depth-write.

1  
2  
3  
4  
5  
6  
7  
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDepthMask(false);

// render transparent things

GL11.glEnable(GL11.GL_CULL_FACE)
GL11.glDepthMask(true);

probably not working tho Wink ... you would probably get z-fighting next.
Pages: [1]
  ignore  |  Print  
 
 

 
xxMrPHDxx (70 views)
2017-12-31 17:17:51

xxMrPHDxx (35 views)
2017-12-31 17:15:51

xxMrPHDxx (41 views)
2017-12-28 18:11:33

Ecumene (212 views)
2017-09-30 02:57:34

theagentd (310 views)
2017-09-26 18:23:31

cybrmynd (356 views)
2017-08-02 12:28:51

cybrmynd (399 views)
2017-08-02 12:19:43

cybrmynd (367 views)
2017-08-02 12:18:09

Sralse (335 views)
2017-07-25 17:13:48

Archive (1083 views)
2017-04-27 17:45:51
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
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!