5

I have a vector<vector<int>>, which contains my map (2D array created with my random generator):

img
(source: cjoint.com)

I want to display this map in 3D (with Irrlicht graphic 3D library). The big problem: my map is too big (1920x1080), so i can't display 2073600 little cube in my screen. (I want to be able to change my map and reload the screen with the good mesh)

So my solution is to create One cube, and write on it all the pixel I want (here is my little paint to show you...)

img
(source: cjoint.com)

So... I know how to create/write/parse a file in c++, now my problem is: I don't know very well 3D perspective and .obj object...

I am learning OBJ format with wikipedia and other docs.

I wonder if there is more simplest solution than changing in live a .obj object... And if not... i required some help for the conception of my obj...

genpfault
  • 51,148
  • 11
  • 85
  • 139
usernameHed
  • 51
  • 1
  • 2
  • .obj here refers to the 3d format here: https://en.wikipedia.org/wiki/Wavefront_.obj_file as opposed to visual studio .obj object files generated from compiling c/c++ code -- I edited the title to make it super clear. – xaxxon May 03 '16 at 00:22
  • You'll have to write a parser for the .obj format (it's not simple but is relatively well documented here: http://www.martinreddy.net/gfx/3d/OBJ.spec) load it into memory, make whatever changes you want, then serialize it back out. This is a pretty sizeable task and not for the faint of heart. Depending on how many of the .obj features your file uses will determine how much of the .obj format you'd have to write a parser for. – xaxxon May 03 '16 at 00:28
  • Thanks you, i'm progressing in the creation process. But I'm bloked: how do I make Hole in a surface 3D ? – usernameHed May 03 '16 at 16:07
  • @usernameHed the images of yours are not very didactic and (at least for me) is hard to understand what are you trying to achieve. Is this surface height map? why holes I do not see any, why cubes and not continuous surface? – Spektre May 26 '16 at 19:31

1 Answers1

0

I think you are confusing issues here. Alias wavefront obj is a file format for storing 3d geometry, it is extremely easy to use to extract the geometry. The MTL (Material Template Library) is a bit more complex that just the geometry and is usually associated with .obj files for defining the visual representation of the geometry (in regards to its material appearance).

What you are asking is more along the lines of a geometric question (how to remove a hole from a surface) and depends entirely how your geometry is represented (I assume triangulated since you ask about obj, which represent triangulated data). More information is required about how you store your data.

Maybe try looking into Constructive Solid Geometry which use Boolean operations to construct geometry. If you have triangulated data, then unless you employ some form of BVH for processing which triangles/geometry to work on, you will ultimately be using brute force to see which triangles are valid and which need removing for your 'hole removal'.

lfgtm
  • 1,037
  • 6
  • 19