In my first 3D game i now want to render the floor, which is actually a plane (not a libgdx Plane
) on y = 0
.
I want to add a Texture
to it, so i can have different floors in each level.
Now my question is: What is the best way to create and render this textured floor?
I thought about using basic Block Models
made with ModelBuilder
and then added a Texture
, but as i can only see 1 of 6 faces a 2d Texture
would be enough, so i thought about a Plane
.
Can i add a Texture
to a Plane
, as it is a infinite face in 3D room? The last thing i then thought about were the Decal
s.
Are Decal
s what i am looking for? And how can i use them? Or do you have an other solution .
Any tutorial or other help would be great.
Thanks
First about Decals, decals are like Sprites but in 3d coordinate, use it like this:
private Decal decal; private DecalBatch decalBatch;
in show() or create()
in render()
also dispose with decalBatch.dispose();
notice that in future decal will be part of 3d, I personally do not encourage you to use Decals as myself using 3d plane and I saw some problems with it, to use 3d plane use like these, i paste some of my codes here
texture can be added as attribute to material
for transparent plane that has alpha add to other attribute
Init the ModelInstance to get model that returned
render in render() with ModelBatch object
see these links too. http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=11884
this is my benchmark on Plane vs Decals http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=12493