Jump to content

Padman

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Padman

  1. Thank you for your help Guppy. You're right, I have double vertices on my edges because of my bad quadtree generator algorythm ^^. So I recoded it and now I can have a perfect noised sphere. Thank you all for your help. Now ... I have to apply textures on my planet according to the height of my vertices... It's time to work hard (and first read some docs). ^^

  2. Thanks for your help. But I aldready know that ^^'. Sorry if I don't explain correctly my problem. My problem is to apply a perlin noise on my sphere. I don't know how to generate a coherent noised sphere. In my screenshot, all my cube faces are separated. I don't know how to join them "smoothly".

  3. Hi,

    I'm doing a planet generator for my game. But I've some problems with the c++ libnoise.

    I successfully generated a quadtree (maybe with a bad algo... ^^') and successfully transformed it into a sphere according to this great blog.

     

    But now, I want to apply a perlin noise using the c++ libnoise library. But the render is not really good... But I think I'm in the right way. My problem is about the noise coherence between each faces of my cube. The faces are not joined. Here is a screenshot.

     

     

    I do this following code to generate one face of my cube :

    //generating the front face...
    Surface* frontFace = model->AddSurface();
    for(int i = 0 ; i<numSquare ; i++)
    {
     for(int j = 0 ; j<numSquare ; j++)
     {
    	 float x = -1+i*segment;
    	 float y = -1+j*segment;
    	 float z = -1;
    	 float dx = (x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0))) * Radius; //transform into sphere
    	 float dy = (y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0))) * Radius;
    	 float dz = (z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0))) * Radius;
    	 float ndz = dz + perlinModule.GetValue(dx,dy,dz);//generate noise
    	 int v0 = frontFace->AddVertex(dx,dy,ndz);
    	 x = -1+(i*segment)+segment;
    	 y = -1+j*segment;
    	 z = -1;
    	 dx = (x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0))) * Radius;
    	 dy = (y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0))) * Radius;
    	 dz = (z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0))) * Radius;
    	 ndz = dz + perlinModule.GetValue(dx,dy,dz);
    	 int v1 = frontFace->AddVertex(dx,dy,ndz);
    	 x = -1+(i*segment)+segment;
    	 y = -1+(j*segment)+segment;
    	 z = -1;
    	 dx = (x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0))) * Radius;
    	 dy = (y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0))) * Radius;
    	 dz = (z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0))) * Radius;
    	 ndz = dz + perlinModule.GetValue(dx,dy,dz);
    	 int v2 = frontFace->AddVertex(dx,dy,ndz);
    	 x = -1+i*segment;
    	 y = -1+(j*segment)+segment;
    	 z = -1;
    	 dx = (x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0))) * Radius;
    	 dy = (y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0))) * Radius;
    	 dz = (z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0))) * Radius;
    	 ndz = dz + perlinModule.GetValue(dx,dy,dz);
    	 int v3 = frontFace->AddVertex(dx,dy,ndz);
    	 frontFace->AddTriangle(v2,v1,v0);
    	 frontFace->AddTriangle(v0,v3,v2);
     }
    }
    

     

    I don't know how to solve this. I didn't find good explanations on the web. I'm not really good in maths but I've some logic ideas (I think ...), it's a miracle if this code works xD. Maybe it's my cube generation algorythm which is bad...

    I understood that some others use a lerp function to join "smoothly" each faces, but I don't know how I can apply this to my code. ^^' If someone can help it would be great.

    Thx !

     

    PS: I'm french so really sorry for my english

  4. Just for information, I succesfully install Leadwerks on my Arch Linux with nvidia drivers so I just want to explain how I did it if someone has some trouble.

     

    My system :

    Arch Linux x64 with Nvidia drivers

    Nvidia GTX 670

    Core i5 3570K

    Gnome 3

     

    First, I installed these packages :

     

    # pacman -S gcc nvidia-libgl lib32-openal gtk-engines gtk-engine-murrine lib32-libx11 lib32-libxxf86vm lib32-glib2 lib32-gtk2
    

     

     

    Next, I had some problems with the gtk lib path, so I had to set this environment variable :

     

    $ export GTK_PATH=:/usr/lib/gtk-2.0
    

     

    You can also add this line at the end of your .xinitrc file to automatically set this env at startup.

     

    Now you can start the LeadwerksUpdater and finally the editor when the update has finished. happy.png

     

    If someone have an other arch linux configuration with some other steps to do. You can post it here.

    • Like 1
    • Upvote 2
×
×
  • Create New...