Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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  
  libgdx decals  (Read 672 times)
0 Members and 1 Guest are viewing this topic.
Offline phajdu82

Senior Newbie


Projects: 1



« Posted 2014-05-11 18:47:08 »

hello. i have problems with decals in libgdx...
i am using hexagon sprites to draw a map. if the decals are in the same height, the one that is rendered later overwrites the visible parts of the previous decal... is there a good way to solve this? (i already tried to render the decals one at the time, but got the same result)
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #1 - Posted 2014-05-11 19:14:38 »

Sorry, but what do you mean by decal? Are you rendering in a 2.5D world? More info would be appreciated, please.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 289
Exp: 5 years



« Reply #2 - Posted 2014-05-11 19:20:19 »

Sorry, but what do you mean by decal? Are you rendering in a 2.5D world? More info would be appreciated, please.

Try 5 seconds on Google: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/decals/Decal.html

Also known as Billboarding.


As for OP, draw them in the correct order, i.e. front-to-back? Seems pretty simple to me.
Here's more info regarding hex grids if you need it: http://www-cs-students.stanford.edu/~amitp/gameprog.html#hex
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #3 - Posted 2014-05-11 19:28:24 »

Well thanks? Sorry I didn't know decals were also billboarding, I just asked for more information...

Offline phajdu82

Senior Newbie


Projects: 1



« Reply #4 - Posted 2014-05-11 21:05:28 »

http://i1329.photobucket.com/albums/w558/phajdu1982/dec_zps334f3fd1.png

top down view, but i want to use 3d... with java2d i can do this with a little math, hexagons sprites and a few polygons to paint the sides... now with libgx i would like to leave that math thing out - leave it on camera... but where the sprites in decalbatch are covering each other (with the same z height - tried random heights and then it was working quite well), parts of sprites are missing...
this is what i want to have
http://i1329.photobucket.com/albums/w558/phajdu1982/bits3dtextured_zps9326d5af.jpg

im not sure if we are talking about the same billboard:
/*
 * Billboard is a 2d sprite that renders its location on screen
 * based on 3D world position. think of it like a 3D sprite that is always
 * facing the user.
 *
 * author: yatayata
 */
i dont need the sprites to face camera. i will set their position. i only need them to be displayed as whole, without the parts that were cutted by the edges of sprites around that sprite...
maybe correct use of groups in decalbatch would help, but i dont know how to use that...
Offline ewg

Junior Devvie


Medals: 8


Java games rock!


« Reply #5 - Posted 2014-05-11 22:22:49 »

For what you are doing you should have z/depth buffer test disabled and alpha blending enabled.  Looks like one of those is in the wrong state or your texture is not really transparent at the edges where you want it to be. 

If you need better performance (all of the overdraw and alpha blending can be slow) you may want to make your map tile hexagons out of triangles and render them that way instead of rendering as overlapping squares.  That way each pixel only needs to be rendered to once per draw.
Offline Cero
« Reply #6 - Posted 2014-05-11 23:12:56 »

decals are not billboards.

eg decals = gun shot holes in the wall in shooters.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 289
Exp: 5 years



« Reply #7 - Posted 2014-05-11 23:22:14 »

decals are not billboards.

eg decals = gun shot holes in the wall in shooters.

Ah, quite right, although billboards are decals, just aligned towards the camera. (Which is what OP is doing here)
My mistake.
Offline saucymeatman
« Reply #8 - Posted 2014-05-11 23:58:55 »


i dont need the sprites to face camera.

Ah, quite right, although billboards are decals, just aligned towards the camera. (Which is what OP is doing here)

Maybe you should have tried 5 seconds on phajdu82's reply.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #9 - Posted 2014-05-12 00:02:40 »

Maybe you should have tried 5 seconds on phajdu82's reply.
Wut? phajdu posted after.

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

« JGO Bitwise Duke »


Medals: 289
Exp: 5 years



« Reply #10 - Posted 2014-05-12 00:04:26 »

Maybe you should have tried 5 seconds on phajdu82's reply.

It looks to me based on the screenshot of what he wanted that they're facing the camera. OP, correct me if I'm wrong.
Offline saucymeatman
« Reply #11 - Posted 2014-05-12 00:51:03 »

http://i1329.photobucket.com/albums/w558/phajdu1982/dec_zps334f3fd1.png

top down view, but i want to use 3d... with java2d i can do this with a little math, hexagons sprites and a few polygons to paint the sides... now with libgx i would like to leave that math thing out - leave it on camera... but where the sprites in decalbatch are covering each other (with the same z height - tried random heights and then it was working quite well), parts of sprites are missing...
this is what i want to have
http://i1329.photobucket.com/albums/w558/phajdu1982/bits3dtextured_zps9326d5af.jpg

im not sure if we are talking about the same billboard:
/*
 * Billboard is a 2d sprite that renders its location on screen
 * based on 3D world position. think of it like a 3D sprite that is always
 * facing the user.
 *
 * author: yatayata
 */
i dont need the sprites to face camera. i will set their position. i only need them to be displayed as whole, without the parts that were cutted by the edges of sprites around that sprite...
maybe correct use of groups in decalbatch would help, but i dont know how to use that...

This is the message that contained "i dont need the sprites to face camera" (4 hours ago)


decals are not billboards.

eg decals = gun shot holes in the wall in shooters.

Ah, quite right, although billboards are decals, just aligned towards the camera. (Which is what OP is doing here)
My mistake.

This is Burnt's message (2 hours and 2 minutes ago)

I was just trying to point out that its funny that Burnt jumped on Opiop for not googling something, and then the very next message had an inaccuracy in it haha
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 289
Exp: 5 years



« Reply #12 - Posted 2014-05-12 00:54:59 »

In fact I spent more than 5 seconds on phajdu82's reply because I went and looked at the image again, saw that the hexagons he wants are facing the camera, and made my response to Cero's correct observation regarding my logical faux pas; but enough chitchat.
Offline Cero
« Reply #13 - Posted 2014-05-12 01:23:20 »

your game is super 2D, why would you wanna mess with a 3D feature ? just use sprites

Offline phajdu82

Senior Newbie


Projects: 1



« Reply #14 - Posted 2014-05-12 10:11:29 »

i would like to switch to real 3d terain instead of flat hexagons in different height... so using 3d sprites is a place to start... (but i would also like to keep using sprites, because i want to have that grass over the edges so i dont want to use just textured meshes)
i was asking in wip thread what would be the best to use to get the result i want, but noone replied there, so i started to look for solutions myself and now have this problem with transparency...
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #15 - Posted 2014-05-12 17:10:17 »

Lots of bickering in here. Do I have to send you kids to your rooms?

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.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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