PDA

View Full Version : Libgdx 3D Doom style help!



tommohawkaction
06-25-2017, 05:36 AM
Hello so, I'm trying to make a 3D engine like prelude of the Chambered, however I am having a few issues
I want to make animations on tiles however the mesh is static, now I could make the mesh dynamic and every frame rebuild it (giving it new texture coords) however I feel like there is a better way of doing this

The current way I am making the map is by going through each pixel of an image and if its black then its not a wall else is a wall, and im rendering all into one mesh.

[My current solution to my problem is]
What if i split up the mesh into parts of meshes for example a static mesh which is stuff which will always be there and the dynamic mesh which will have to change every frame... Is this correct? Am i doubting my method?

-------------------------------------------------------------------

Also on another note, I've had trouble with implementing shaders in the 3D api while creating a custom mesh as all i wanted is FOG including everything that Libgdx provides, now would it be better to make a custom shader which will mean re-building the rendering api or what i have done which is copy the shader code from libgdx docs and just add the fog in ---- which is what you see in the image below?

So far I have this
2403

Silence
06-25-2017, 11:01 PM
All of this looks very confused.

Doom was using BSPs (https://en.wikipedia.org/wiki/Binary_space_partitioning) intensively. It allows to split out walls in order to render only what is visible.
Here is another link (http://doom.wikia.com/wiki/BSP) and another one (ftp://ftp.sgi.com/other/bspfaq/faq/bspfaq.html).
I really advise you to have a deep look and understanding of them.

GClements
06-26-2017, 02:33 AM
What if i split up the mesh into parts of meshes for example a static mesh which is stuff which will always be there and the dynamic mesh which will have to change every frame... Is this correct?

If you are going to be changing attributes for some vertices and not others, it makes sense to separate dynamic faces from static faces. Otherwise you're faced with a choice between a single update which uploads more data than is strictly necessary, or many small updates. Neither of those are efficient. The dynamic faces should use a separate draw call so that you don't have to modify the texture coordinates in place (which will cause a pipeline stall).

The other option is to not modify the texture coordinates, but to add additional vertex attributes which describe how the texture coordinates change with time, then calculate the texture coordinates in the vertex shader.

tommohawkaction
06-26-2017, 03:30 AM
All of this looks very confused.

Doom was using BSPs (https://en.wikipedia.org/wiki/Binary_space_partitioning) intensively. It allows to split out walls in order to render only what is visible.
Here is another link (http://doom.wikia.com/wiki/BSP) and another one (ftp://ftp.sgi.com/other/bspfaq/faq/bspfaq.html).
I really advise you to have a deep look and understanding of them.

Yeah sorry Slience, I didn't mean the whole engine bit by bit.. What i meant was the same look but using modern techniques. Thanks for your reply though :)

tommohawkaction
06-26-2017, 03:34 AM
If you are going to be changing attributes for some vertices and not others, it makes sense to separate dynamic faces from static faces. Otherwise you're faced with a choice between a single update which uploads more data than is strictly necessary, or many small updates. Neither of those are efficient. The dynamic faces should use a separate draw call so that you don't have to modify the texture coordinates in place (which will cause a pipeline stall).

The other option is to not modify the texture coordinates, but to add additional vertex attributes which describe how the texture coordinates change with time, then calculate the texture coordinates in the vertex shader.

Okay that makes sense, so for a smallish level/dungeon would you suggest splitting the mesh into two, one being static (Where nothing changes) and one being dynamic (Changing texture coords) and every frame recreate the dynamic mesh?

GClements
06-26-2017, 10:44 PM
Okay that makes sense, so for a smallish level/dungeon would you suggest splitting the mesh into two, one being static (Where nothing changes) and one being dynamic (Changing texture coords) and every frame recreate the dynamic mesh?
Well, there's no need to recreate the entire mesh; you just need to change the texture coordinates. See this page (https://www.khronos.org/opengl/wiki/Buffer_Object_Streaming) for techniques for doing so efficiently.