Jump to content

Line of sight, big worlds


Carharttguy
 Share

Recommended Posts

Hello

I'm absolutely new to BabylonJS. I have some basic questions:

  1. Is it true that WebGL is slower than OpenGL? I know that they're the same under the hood, but why does WebGL slower? I can play massive MMORPG's on my laptop in OpenGL, while in WebGL, even a small scene seems to stutter sometimes.
  2. I read a little bit on the forum here, and it seems that downsizing the amount of meshes in a scene is always a good idea to improve performance. But what I wonder, does it matter if a mesh is in the scene, or if the mesh is seen by the camera (and thus being rendered). What if I created a an imersive world, but set the maxZ not to far? Will it matter if the world is 10.000 long, or 100.000 long if the camera line of sight is only set to 50?
  3. Main reason I'm asking is because I'm planning on creating a tool that generates imersive worlds (like RPG worlds). I was looking at other game engines, they all have their troubles. But babylonjs attracted me particulary because of the nice community this engine seem to have.

Thank you for reading (and maybe answering) my questions

Link to comment
Share on other sites

No it would not, line of site I imagine you will establish through raycasting so you will be able to establish a "line of site hit" to in any vector to infinity... You would set up the distance for the line of site validating as true in your raycast return for the position of the ray hit and your cameras position being compared and then seeing if it's true to your set "site range".

 

for your world generation how conpetent are you in 3D noise algorithms and L-system equations?

 

 

also I have a JavaScript number extension for handling psudo random seeded numbers and accepts ANY value from strings to floats... Blah blah but anyways I can post my class for you because anything like this  that you are thinking of with procedural generation your gonna need a efficient system for seeded randoms.

Link to comment
Share on other sites

Hello

I think I didn't made myself clear well enough. Blame it on my bad English. I'm not really creating a terrain generator, but more a game generator. Like RealmCrafter was in the past.

For the line of sight: I figured it out how to create very big scenes, but with a very limited line of sight (and no FPS drop)

I created a small playground: http://www.babylonjs-playground.com/#Z8QAT

10000 boxes generated, at first I get 60 fps, but zooming out and out drops the FPS bit by bit, if I'm totally zoomed out I got like 5 FPS.

Now the same, but with a maxZ on the camera of 100: http://www.babylonjs-playground.com/#Z8QAT#1

Now the camera can fly over the boxes, no FPS drop whatshowever, because only 50 (aprox) boxes are rendered at the same time.

 

Cheers

Mathias

Link to comment
Share on other sites

You are effectually passing the number of boxes that are visible by the camera to the draw stack so if you can see 1000 cubes you are making a 1000 draw calls.

Now your job as a developer is to get these calls down to a minimum while keeping the mesh diversity that you would need.  This is by constructing more complex draw calls and duplicating objects to the stack in the form of instances (can have a different position than the initial object) or copys (have more dynamically editable like material and other physic properties)

Each time you use an instance or a copy the stack "reuses" the original objects information and saves on draw calls.  The secondary method you will need to deploy is to combine separate meshes into a single draw buffer and pass that compound buffer to the draw stack and not the independent objects.

This will increase your fps dramatically

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...