# thecheeselover

Member

76

569 Good

• Rank
Member

• Interests
Art
Programming
1. ## Marching cubes

I have had difficulties recently with the Marching Cubes algorithm, mainly because the principal source of information on the subject was kinda vague and incomplete to me. I need a lot of precision to understand something complicated Anyhow, after a lot of struggles, I have been able to code in Java a less hardcoded program than the given source because who doesn't like the cuteness of Java compared to the mean looking C++? Oh and by hardcoding, I mean something like this : cubeindex = 0; if (grid.val[0] < isolevel) cubeindex |= 1; if (grid.val[1] < isolevel) cubeindex |= 2; if (grid.val[2] < isolevel) cubeindex |= 4; if (grid.val[3] < isolevel) cubeindex |= 8; if (grid.val[4] < isolevel) cubeindex |= 16; if (grid.val[5] < isolevel) cubeindex |= 32; if (grid.val[6] < isolevel) cubeindex |= 64; if (grid.val[7] < isolevel) cubeindex |= 128; By no mean I am saying that my code is better or more performant. It's actually ugly. However, I absolutely loathe hardcoding. Here's the result with a scalar field generated using the coherent noise library joise :
2. ## Low poly terrain

Recently I've been tackling with more organic low poly terrains. The default way of creating indices for a 3D geometry is the following (credits) : A way to create simple differences that makes the geometry slightly more complicated and thus more organic is to vertically swap the indices of each adjacent quad. In other words, each adjacent quad to a centered quad is its vertical mirror. Finally, by not sharing the vertices and hence by creating two triangles per quad, this is the result with a coherent noise generator (joise) : It is called flat shading.
3. ## Generic method in Java

Just as he said, you cannot directly instantiate generic types. What you need to do is use reflection. Pass the type of the generic class as a parameter and then use reflection to call its constructor. Class<?> is the variable type for types. Beware that it is not safe to do that.
4. ## Tutorial for adding "tags"

Is there a tutorial on how to format a post on gamedev? I can't seem to make the tags "media" and "rollup" work and I'm lucky that I have found them on google because I don't know where to search.   I just found out that just copy/pasting a youtube video url makes it work but there's a little tweak to do: if the video is part of a playlist, it must be removed from the url.   Thanks in advance! :)
5. ## Voxels

Eclipse Mars, Java 8, jMonkey Engine 3. By the way, Eclipse Neon just got released! :D
6. ## Hexagons

Holy shit! I just favorited this link ahah
7. ## Voxels

Voxels! Unlike my old Xna application, this one's code is way more beautiful to the eye. Zero "switch" or "if and else" for cube faces, as I did with my cubic planet faces. My only problem with voxels is that it's a 3D grid. A 3D grid take a lot longer to compute than six 2D grids. 250 * 6 = 1500 quads to compute and draw. 2503 = 15,625,000 voxels to compute and maybe draw. As I use more and more complex objects to abstract the computation and the drawing part, the code slows. Following this entry, I'll make another one but with two videos: 1) Spherical planet made of voxels 2) Cubic planet made of voxels
8. ## Grouping of my [new] work so far

I'm an amateur and hobbyist video game developer. I've been programming for 9 years now even though I'm almost 21. When I started, it was rough being extremely bad with the english language and a noob programmer. Instead of helping me, people over multiple forums were only degrading my lack of skills and so I stopped being an active user. I have now finished what we call in Quebec a "technique". A technique is an academic degree of 3 years that is the equivalent of college degree. The technique I've done was called "Technique de l'informatique de gestion", which is a computer science technique applied to management softwares. As I finished college, I noticed I've improved my programming competencies and so I started again to research and program for fun, which I did 4 years ago. See I'm currently working on planet generation. Everything was done using the jMonkey Engine 3, Java 8, Eclipse Mars and Joise (a java adaptation of the accidental noise library from JTippetts). The following videos sum up what I've done so far:
9. ## Voxel lighting problem solved

Actually it was like 2-3 years ago and yes it was Cube World.
10. ## Shared vertices or not for primitives

Ok thanks everyone! Now I understand! :)
11. ## Shared vertices or not for primitives

Yes they need uv's because I'm learning GLSL and testing shaders.   And I'm still confused. I have a rectangular map that I want to apply to a sphere. How could the vertices that are at the beginning and the end of the texture in uv coordinates work normally, and by working normally I mean making a beautiful sphere. If a vertex at (0.9,0) (in uv's) makes a triangle with a random vertex and the one with (0,0) the texels applied to the triangle will cover the whole texture on the X axis instead of making a continuous texture mapping, i.e. (-0.1,0) to (0,0).
12. ## Shared vertices or not for primitives

What about the sides? If one vertex reaches the end of the texture on the X axis how will it go back to the beginning?
13. ## Shared vertices or not for primitives

Hello,   I was about to create a some classes to create primitives in order to help me with debugging. However, I don't know if each primitive should share its vertices. For example, a cube should not share its vertices because the normals would be inadequate for lighting and the uv coordinates wouldn't fit for a cubemap. However, for a sphere the normals would be better with shared vertices but what about the uv's? Would it work or should I not share the vertices for a sphere and instead calculate the normals as if they were shared?   Thank you! :)
14. ## Cannot allocate a decent amount of memory glBufferData()

To summarize, this is how my code should look like?   glBufferData(GL_ARRAY_BUFFER, NUM_VERTS * sizeof(GLfloat) * (ELEM_PER_POS + ELEM_PER_COLOR + ELEM_PER_NORM), vertexData, GL_STATIC_DRAW);
15. ## Cannot allocate a decent amount of memory glBufferData()

Possible, but why allocating 1000 bytes doesn't crash?