Recursive LOD Planet Rendering - OpenGL

Поделиться
HTML-код
  • Опубликовано: 24 окт 2015
  • The body of the planet is a cube with 4 32x32 panels per each face. These are projected onto a sphere and then sample values from height maps are used for the deformation of the sphere.
    I didn't do much research into methods for LOD terrain before implementing my own idea for how to do it but I believe my method is similar to quadtree based terrain division. When the camera gets within a distance (relative to that panel's width) instead of rendering itself the panel calls its own render function 4 times with the relative positions and sizes of the child panels. Those panels then repeat the same process until the camera is not close enough to divide or the finest level of division has been reached. In this video the panels divide up to 15 times and frame rates are still over 400fps.
    Frustum culling is not currently used those there is culling based on how far a panel is past the horizon so that panels entirely past the horizon are not rendered.
    The height maps and normal maps are generated at execution time with the libnoise library. I generate 4 maps for height and 4 maps for normals. Each map is a quadrant of the surface. Maps are generated on separate threads and each map takes about 15 seconds to generate so it takes about 30 seconds or so of asset generation before things start rendering.
    When at close proximity the detail supported by the fine meshes is greater than the resolution of the maps being generated (making larger maps takes too long and too much memory). I intend to find a better method of generating the noise in the future.
    The finest level of detail reveals small perturbations that I believe are a result of floating point precision breakdown due to static near/far plain values.
  • ИгрыИгры

Комментарии • 52

  • @addmix
    @addmix Год назад +40

    This is honestly amazing. As you say, this is similar, if not analogous to quadtree LOD functionality, on 2015 or earlier hardware, with 15 LOD levels, and above 400 fps. Truly astonishing.

  • @dragoxeo5362
    @dragoxeo5362 3 года назад +88

    i have no idea how this was made but good job! looks cool :D

    • @AGBuzz182
      @AGBuzz182 3 года назад +3

      it says in the description

    • @--Valek--
      @--Valek-- 4 месяца назад +2

      @@AGBuzz182I read that and still have no idea how it was made

  • @TomFowkes
    @TomFowkes 2 года назад +10

    what a perculiar looking planet, beam down an away crew number one we need to get to the bottom of this

  • @oreonengine9444
    @oreonengine9444 7 лет назад +45

    epic stuff mate 👍

    • @suncrafterspielt9479
      @suncrafterspielt9479 4 года назад +3

      If OREON ENGINE comments that you do epic stuff, it is like the Oscar nominee for OpenGL

  • @pepsipwns666
    @pepsipwns666 4 месяца назад +1

    You've just basically made no mans sky! So cool!

  • @Simp_Zone
    @Simp_Zone 4 месяца назад

    I dont know how I got here but this is really cool!

  • @Ðogecoin
    @Ðogecoin Год назад

    Wow this is amazing!

  • @NimerionTech
    @NimerionTech 8 лет назад +4

    Nice LOD! :)

  • @CanadianReset
    @CanadianReset 8 лет назад +2

    Very cool

  • @householdemail1305
    @householdemail1305 4 месяца назад

    Nice mapping format.

  • @javinshki17000
    @javinshki17000 4 месяца назад

    bro is in the metaverse

  • @cracker8328
    @cracker8328 Год назад +1

    Impressive.

  • @Yorgarazgreece
    @Yorgarazgreece 4 месяца назад

    Pretty good! I'm interested to implement this system inside unity engine one day.

  • @WildAnimalChannel
    @WildAnimalChannel 4 месяца назад

    Reminds me of my game Amazing Shrinking Giraffe

  • @janiowy2137
    @janiowy2137 4 месяца назад

    cool

  • @9z9z9z9
    @9z9z9z9 2 года назад +2

    Can you try this with earth and elevation data?

  • @RobertMOdell
    @RobertMOdell 5 лет назад +2

    raythetse. Why are the face seams so obvious? What makes them not be smooth transitions? Also, when do you load vertices with this scheme? Lastly, when you say you don't do frustum culling, you are talking about during CPU generation of new faces, right? The OpenGL does it's own culling when rendering. Thanks.

    • @raythetse
      @raythetse  5 лет назад +3

      The seams are intensionally extened and overlapped. Because the panels are produced individually, the edges of adjacent panels don't necessarily close up in a clean seam which would leave obvious spaces between them. Extending the edges outward fills these gaps.
      I assume by "when do you load vertices" you mean when do I push to meshes to the gpu... its too long ago I can't remember exactly, sorry.
      I don't do any manual frustum culling. I assume that whatever culling opengl does requires the completion of the vertex shader processing before it can determine if its visible or not. Doing cpu based frustum culling can sometimes be more efficient if you can eliminate enough vertices. But yes, in this context you could eliminate the necessity to generate the panels from the height data if you were to do some preculling, but I never did get around to implementing that.

  • @Kepler-7B
    @Kepler-7B 3 месяца назад

    It looks like spore planets but even bigger

  • @ItsOnlyMe360
    @ItsOnlyMe360 5 месяцев назад

    this would be a great mod for a spherical world in Minecraft (although it would probably have to rewrite a lot of things about the game itself)

    • @-minushyphen1two379
      @-minushyphen1two379 5 месяцев назад

      A spherical world cannot be tiled with only squares and 4 squares at a corner

  • @sergodobro2569
    @sergodobro2569 4 месяца назад

    Potential for a global wargame

  • @RobertMOdell
    @RobertMOdell 5 лет назад +6

    raythetse. At the poles, don't you end up with triangles instead of faces ?

    • @raythetse
      @raythetse  5 лет назад +16

      No, because I start with a cube and then project the cube onto a sphere, the sphere essentially has 6 curved faces that are sort of curved squares. This is simple to do, you just build a cube mesh then pull each vertex toward the center of the cube so that they are all the same distance from the center.

    • @RobertMOdell
      @RobertMOdell 5 лет назад +2

      @@raythetse Thanks for the great answers so quickly. It all makes sense. All the best.

  • @SmaIlHum
    @SmaIlHum Год назад +1

    spore 2 devlog

  • @Mattparks5855
    @Mattparks5855 8 лет назад +2

    Is this done in C++ or Java? Any links to the sources or demo downloads?

    • @raythetse
      @raythetse  8 лет назад +2

      +Matthew A (Mattparks) Everything is done in C++ OpenGL and GLSL. I don't have any source code up right now, but I plan to keep working on this stuff and develop further and I might post some stuff once I get some more done!

    • @cristiandecu
      @cristiandecu 8 лет назад

      +raythetse I wonder how you solved the floating point precision problem. If you're rendering a planet i believe Z fighting would the the least of your troubles compared to the issues that appear with the objects that are far away from the camera (where floating point precision is almost gone, objects "jumping" all around the scene). Thank you!

    • @raythetse
      @raythetse  8 лет назад

      +Cristian Decu Well I haven't solved the issue that I point out in the video because I haven't worked much on the project in the last couple of months. I haven't encountered any problems with distance objects jumping around though I know what you are talking about. In other parts of the project I've made videos about I don't subdivide the panels nearly as much so the precision issues don't even pop up at all.

    • @TristanPopken
      @TristanPopken 2 года назад +1

      For anyone in the future wondering how to remove z fighting, here's what I did:
      In the planet fragment shader:
      gl_FragDepth = log2(vFragDepth) * logDepthBufFC;
      with logDepthBuffFC being:
      const float logDepthBufFC = 1.0 / log(FAR + 1.0) * (log(2)/log(2.71828182846));
      In the planet vertex shader:
      vFragDepth = 1.0 + dist(cameraPos, worldPosition);
      with the dist() function being Pythagoras
      This basically stores the depth in a logarithmic scale to give more detail to far away objects
      To read the depth in a post processing shader with a depth texture:
      vec4 depthT = texture(depthTexture, texturePos);
      float depth = pow(2, depthT.x / logDepthBufFC) - 1.0;
      :)

  • @mindlessmrawesome
    @mindlessmrawesome 4 месяца назад +2

    Space engineers

  • @Alexey_Pe
    @Alexey_Pe Год назад

    What is the size? Do they use float 32 for coordinates?

    • @raythetse
      @raythetse  Год назад

      I'm not sure exactly what component you're asking about, but this was years ago and I've not touched it since so I'm sure I don't remember much about it.

  • @erikm9768
    @erikm9768 11 месяцев назад

    0:10 Why so much tesselation when theres not enough detail in the planet density model?

    • @flevo
      @flevo 4 месяца назад

      proof of concept

  • @Lius525
    @Lius525 2 года назад +2

    This guy made Nanite before it was cool.

  • @nomads8409
    @nomads8409 3 года назад +10

    please release the Source Code

  • @user-fh1yz2yg3m
    @user-fh1yz2yg3m 4 месяца назад

    Wat is this app or game?

  • @sanyagogol310
    @sanyagogol310 10 месяцев назад

    Кто знает может; где найти исходный код для изучение?

  • @multikillgames
    @multikillgames 3 года назад +1

    add some caves ;d

  • @juri_duty
    @juri_duty 3 года назад

    Your LOD needs a little more D ;) jk looks satisfying as fuck.

  • @HillcrestGames
    @HillcrestGames 3 года назад +3

    Alright now put Dragon Ball Z characters in there and let me fly around.

  • @atlas8034
    @atlas8034 2 года назад

    made in 2015

  • @HNN_CBEPXCNCTEM_CCCP_NM._COBbl
    @HNN_CBEPXCNCTEM_CCCP_NM._COBbl 4 месяца назад

    Что это такое? :)

  • @secondarycontainment4727
    @secondarycontainment4727 4 месяца назад

    Most people cant even read cursive.

  • @googleuser4720
    @googleuser4720 4 месяца назад

    Looks terrible up close. Why use wireframe? At least wireframe squares

    • @raythetse
      @raythetse  4 месяца назад +1

      Its a tech demo. Its demonstrating how the meshes breakdown. I fill it in with color at the end. Wireframes are not made of squares, they are made of triangles.