Voxel or Multiple Heightmaps? (21 posts)

  • Profile picture of Guedez Guedez said 10 months ago:

    After some years i got the motivation to start a project again. And i have ran into a serious issue that needs to be addressed before even starting. Should i use multiple heightmaps one on top of the other? or Voxels?

    While Heightmaps are already implemented in JME3. Voxels seens to be the awnser for all my needs, however not only there is not much about it implemented in JME3(i think at least), and i don’t want my game to look like another minecraft clone.

    Making a voxel engine is almost out of the question for me, the little i know about voxels tells me that i need to know LOTS of crazy mathmagic to make it work good, and altough im confident in my knologe as a java developer, i know very little about math and geometry, a lot less than i should(won’t be able to address this lack of knowloge anytime soon).

    So, any tips or sugestions?

    More info related to the problem:

    The Idea of the game:
    Something like The Unreal World or Dwarf Fortress Adventurer Mode.
    Single Player Only.

    What i WANT it to have.

    - Water that flows realisticaly enough, something in the line of coluns of liquid.
    - Caves/Caverns, being able to make one, explore/modify one, making tunnels, tunnels with water for large scale ships to come thru mountains if you have the patience to make them.
    - – Those must collapse if there is not enough support.
    - Modificable terrain, being able to rise and romove mountains/islands/anything if you have the patience.
    - – Erosion would be very nice to have, as walls of dirt are simply retarded

    Thx for the help!

  • Profile picture of tralala tralala24p said 10 months ago:

    Then you need voxels or minecraft thingy.

  • Profile picture of erlend_sh erlend_sh132p said 10 months ago:

    To further clarify your vision, would you say the technical aspects of “From Dust” are similar to what you have in mind?

    Keep in mind that the primary reason why there isn’t such a game as “Dwarf Fortress – Adventurer Mode (3D)” out yet is by and large because no one has yet figured out how to do that technically, not because there’s a lack of ambitious designs. So if you yourself can’t easily envision how you would approach these technical challenges, there’s a good chance you’re going a bit out of scope.

    That said, I’m dying to see more of these games realized.

  • Profile picture of phate666 phate66670p said 10 months ago:

    You just need a 3D-Voxel structure, and then use the Marching-Cubes algorithm. I am already working on a voxel framework for jme3.

    Some results:
    http://imgur.com/IQqVz.png

    http://i.imgur.com/xFgy2.png

  • Profile picture of TimePath TimePath6p said 10 months ago:

    @phate666: I don’t suppose you’re willing to release your completed framework to the community when it’s in a user friendly state?

  • Profile picture of Guedez Guedez said 10 months ago:

    erlend_sh said:
    To further clarify your vision, would you say the technical aspects of “From Dust” are similar to what you have in mind?

    F awesome, too bad it’s on a very small scale, but yeah, it’s very close to that

    TimePath said:
    @phate666: I don’t suppose you’re willing to release your completed framework to the community when it’s in a user friendly state?

    If that question’s awenser don’t turn to be true, i probably will have to reduce some of the scope acording to the other’s posts D:

  • Profile picture of phate666 phate66670p said 10 months ago:

    I will release the code once it is in an usable state. But that will not happen until next month as I am busy with exams right now.

  • Profile picture of Guedez Guedez said 10 months ago:

    phate666 said:
    I will release the code once it is in an usable state. But that will not happen until next month as I am busy with exams right now.

    well, i got tons of other things to do, like making moddable content.

    Thx for the heads up peeps, can’t wait to mess up with the voxels stuff later

  • Profile picture of nomnom nomnom7p said 10 months ago:

    @phate666 can’t wait ;) Thanks for working on that!!! It’s so helpful for the community :)

  • Profile picture of phate666 phate66670p said 10 months ago:

    Source code is now online: http://code.google.com/p/jme3-voxel/

  • Profile picture of normen normen1271p said 10 months ago:

    Cool, you think you can pack it in a jMP plugin? Theres not much to do about it really, this way people can find, install and update the library from the update center in jMP.

  • Profile picture of phate666 phate66670p said 10 months ago:

    Ok, i finished the steps from http://jmonkeyengine.org/wiki/doku.php/sdk:development:setup#jmp_contributions_update_center .
    If you can give me commit access I will upload it to the contributions repository.

  • Profile picture of Decoy Decoy8p said 10 months ago:

    @phate666: wow, that looks fantastic! i cant wait to see what can be done with your framework! (im tempted to go get an MRI just to have some data to throw at it.)
    its gonna be fun trying to slap on some lighting and make physics collisionshapes for that stuff. :D
    (of course my old pc probably wont be able to keep up, what hardware are you running that on in those screenshots?)

  • Profile picture of tralala tralala24p said 9 months, 4 weeks ago:

    it doesnt work on my computer.

    WARNING: Bad compile of:
    #define GENERATE_NORMALS 1
    uniform sampler2D m_ColorMap;
    uniform float m_textureScale;

    varying vec4 vVertex;
    varying vec3 vNormal;

    void main(){
    #ifdef GENERATE_NORMALS
    vNormal = cross(dFdy(vVertex.xyz), dFdx(vVertex.xyz));
    #endif

    // tri-planar texture bending factor for this fragment’s normal
    vNormal = normalize(vNormal);
    vec3 blending = abs( vNormal );
    blending = (blending -0.2) * 0.7;
    blending = normalize(max(blending, 0.00001)); // Force weights to sum to 1.0 (very important!)
    float b = (blending.x + blending.y + blending.z);
    blending /= vec3(b, b, b);

    // texture coords
    vec4 coords = vVertex;

    vec4 col1 = texture2D( m_ColorMap, vVertex.yz * m_textureScale );//* 0.01 + vec4(1.0,0.0,0.0,1.0);
    vec4 col2 = texture2D( m_ColorMap, vVertex.xz * m_textureScale );//* 0.01 + vec4(0.0,1.0,0.0,1.0);
    vec4 col3 = texture2D( m_ColorMap, vVertex.xy * m_textureScale );//* 0.01 + vec4(0.0,0.0,1.0,1.0);
    // blend the results of the 3 planar projections.
    vec4 tex1 = col1 * blending.x + col2 * blending.y + col3 * blending.z;

    gl_FragColor = tex1 ;

    }

    Jul 23, 2011 6:14:32 PM com.jme3.app.Application handleError
    SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
    com.jme3.renderer.RendererException: compile error in:ShaderSource[name=MatDefs/UnshadedTriPlanar.frag, defines, type=Fragment] error:Fragment shader failed to compile with the following errors:
    ERROR: 0:10: error(#164) l-value required assign “vNormal” (can’t modify a varying)
    ERROR: 0:14: error(#164) l-value required assign “vNormal” (can’t modify a varying)
    ERROR: error(#273) 2 compilation errors. No code generated

  • Profile picture of phate666 phate66670p said 9 months, 4 weeks ago:

    I didnt get this error, but should be fixed now