Jump to content

Infinite Terrain Idea Bounce...


Pryme8
 Share

Recommended Posts

https://www.babylonjs-playground.com/#EC6R4F#20

So it "works" but it crashes once it propagates out a little.
I need an idea of how to establish which zones to build.  
Maybe like a max ring size instead of what I am doing now and have it only render out say 4 steps from the current zone the player is on?

Just hoping for some alternative ideas.
http://www.babylonjs-playground.com/#EC6R4F#19
^^ for a non crashing version without neighborhood checks.

#EDIT#

Also any math buffs wanna help me with how to do an equation to calculate the distance from the the outer closest edge point or center, which ever is closest.  Not just the Center, or at least point me in the right direction?

Link to comment
Share on other sites

Got the chunking done.
http://www.babylonjs-playground.com/#EC6R4F#26

Now I really need to do calculations on the nearest point on the plane, https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_plane  I found this but I am such a lamen I have no clue what it is saying if anyone can translate?

Edited by Pryme8
Link to comment
Share on other sites

http://www.babylonjs-playground.com/#EC6R4F#33

Gotta fix cracks (which will be easy) then just do my normal's, and the procedural terrain shader.

Then ill refine/extend the way the noise stack is used, right now Im just doing 1 noise but eventually I want to layer them using the Das_Noises mixing methods.  After all that add dynamic heightmaps, so the areas can be manipulated by the user!

But here is the Infinite Terrain with LOD people have been wanting... there are a few fixes I could make to speed things up but this is a decent prototype.

Link to comment
Share on other sites

So today I am restructuring it to not build all the levels of LOD until they are needed which should do a lot for the FPS drop!

Then I am adding in a function to test the neighbors (if they exist) level of detail and have the correct T Junctions put into place on the zones so there are not any cracks and will prolly use this same function to do the normal calculations so that I can get rid of the normal artifacts.
http://www.babylonjs-playground.com/#f00M0U#7 Not done yet, but getting there... I only get to work on this in between real work so sorry if its dragging on...

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#f00M0U#11

@jerome So I really narrowed down the scope to try to debug this FPS drop, and its starting to look like its not so much pre creation of the meshes that is impacting performance as is the change in level of detail.  I say this because even after all the levels are spawned as I transverse the levels I see a drop in FPS regardless if the meshes are preSpawned or not.

What would be a viable way to stop this from happening?  Maybe do all the calculations in a setTimeout wrapper?  and then just have some secondary calculations to skip and cancel the functions of some timing/sync problems appear?  That way I can leave the main thread unlocked for the most part, Im just not sure how easy it will be to prevent someone from breaking the system then though like if they go back and forth over a "sensitive" area that will be destroying and creating zones each time.

Someone else contribute to this conversation please!!! ^_^.

hmmm Maybe a variable on the main zone that holds if the meshes have been triggered to be created and then if they are complete then make it  LOD on a callback.  but then again the same problem that i mentioned above could happen. >_< arg.

also I am trying to modify my tPlane object to know when to skip indices when I need to step down LOD levels.
http://www.babylonjs-playground.com/#1MGYNV#2 <- here is the developing of that but its a lot to think about intermittently. 

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#1MGYNV#23

Holy crap the logic behind this was a little tricky...

anyways the tPlane object now can step down in any direction...
This is getting close to a workable LOD now.
All I need to do is extend my neighborhood checks now to rebuild the zones as necessary with this new tPlane object.
which should fix the cracks from the example:
http://www.babylonjs-playground.com/#EC6R4F#33
and once I deploy it in the new structure:
http://www.babylonjs-playground.com/#f00M0U#7
the fps drops and cracks should be fixed

Link to comment
Share on other sites

WHA BAM!
http://www.babylonjs-playground.com/#f00M0U#21
Cracks are fixed ^_^... Now to calculate normals with neighbors taken into consideration.

*EDIT*
Well damn... http://www.babylonjs-playground.com/#f00M0U#23
I guess cracks are not fixed... what the heck.
Ahhh I get it... dang gotta rework the tJunctions again to have normal splits on the indices on the alt faces.

*UPDATE*
http://www.babylonjs-playground.com/#f00M0U#24
Just North and West are kind glitchy now but I should be able to fix it as soon as I have a chance to really focus.
Then I need to run a neighbor check/pass when its created as well to stop the "poping" from happening.

Link to comment
Share on other sites

@Pryme8 I've been following this thread since you first started it. The latest PG suggests that it seems to be coming along nicely:)

I'm no coder, and I probably need to sit down for a day with your code to try and understand what you are doing, but I just wanted to let you know that I find it fascinating.

I look forward to your continued posts.

cheers, gryff :)

Link to comment
Share on other sites

I should be re uploading my Das_Noise Library today to re enable Perlin, Worley, Cellular and a few other noises of my own creation.  Then I am going to redo the noise stack calculations along with fixing the poping at the tJunctions. 

If I have time ill do the normal calculations today as well....  Ill post some info as I have more.

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#f00M0U#40

so anyone have any idea on the best method to calculate these normals?   I was going to reference the x,y position of the facet and then get the normal of the neighbors touching fact on the other zone then average the two... but Im not sure if that's the correct route to take.  

Any suggestions? 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...