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)
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
Well thanks? Sorry I didn’t know decals were also billboarding, I just asked for more information…
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
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…
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.
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.
Maybe you should have tried 5 seconds on phajdu82’s reply.
Wut? phajdu posted after.
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.
This is the message that contained “i dont need the sprites to face camera” (4 hours ago)
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
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.
your game is super 2D, why would you wanna mess with a 3D feature ? just use sprites
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…
Lots of bickering in here. Do I have to send you kids to your rooms?