Jump to content

Using setEnable / isBlocked


Ahiru
 Share

Recommended Posts

I build a small example-scene: http://playground.babylonjs.com/#2KAUFG

Besides the fact, that I am wondering why the backside of the plane is black, I would like to understand some other things:

- If the camera is above the plane, I can see the plane AND the sphere - the FPS is around 50-52, but when turning the camera below the plane the FPS drops to 40-45 FPS. Why?

- Draw Calls and active meshes stay constant, even the sphere should be disabled when out of sight, right? That's how I understood how to use setEnable(false).

Still wondering, why something, that is not visible by the camera is drawn on default - is there any reason for it? (Calculation of .isBlocked pricier than rendering simple objects for example?)

Link to comment
Share on other sites

Hi,

A quick answer to legitimate questions!

1) It is black due to the normals of the plane. A plane is an interesting object, which has only one set of normals, pointing up. It is not like a box with a very low height. As there are no normals under the plane, no diffuse light will affect it. Try emissiveTexure and see the difference.

2) No idea, doesn't happen to me.

3) The active meshes are calculated according to the (enabled) meshes in the camera frustum. I have never used isBlocked, but I believe is is a definition for LOD and not if the object is hidden behind a difference object (correct me if I am wrong :-) ). This can be achieved using Octrees or ray tracing, but is not being done automatically in every frame.

In short - the sphere is never hidden (to the camera), and therefore always enabled.

It is a hard task to inspect something like that. Very expensive and usually not worth the effort. Just as an example - Let's say the plane is transparent - how would you inspect that? A Ray would have to be sent throughout the plane to see if it hits the sphere or not. This amount of raytracing in one frame will reduce the FPS tremendously, making the framework unusable for real-time games.

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