Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Culling, bbox, and near/far-plane calculation #62

Open
stlemme opened this issue Jun 12, 2014 · 3 comments
Open

Culling, bbox, and near/far-plane calculation #62

stlemme opened this issue Jun 12, 2014 · 3 comments

Comments

@stlemme
Copy link
Contributor

stlemme commented Jun 12, 2014

Using custom shaders (in particular custom vertex shaders) that use the model-view matrix in an unusual fashion (i.e. skyboxes ignore the translation part) leads to wrong culling behavior. "Da würd wat falsch berechned."

@ksons
Copy link

ksons commented Jun 30, 2014

Custom vertex shaders that calculate the vertex position different from the standard model (gl_Position = modelViewProjectionMatrix * vec4(position, 1.0)) lead to wrong bounding box calculations and break culling etc. For these cases (and cases where the bounding box changes per frame and the author want to avoid recalculation), the user can annotate a bounding box:

  <mesh type="triangles">
    <float3 name="boundingBox">-5 -5 -5 5 5 5</float3>
  </mesh>`

This needs to be an entry of the mesh. The first tuple is the minimum vector, the second tuple the maximum of the axis-aligned bounding box in object-space.

However, since this does not work in the provided example, there is an issue in the calculation of the culling.

@stlemme
Copy link
Contributor Author

stlemme commented Jun 30, 2014

Since it is the "axis-aligned bounding box in object-space", it is clear that it will not work in the intended way, because the bbox should be constant in eye space.

csvurt added a commit that referenced this issue Jul 1, 2014
@csvurt
Copy link
Contributor

csvurt commented Jul 1, 2014

The above commit adds a new method to mesh, model and group nodes: node.setWorldSpaceBoundingBox. This method takes an XML3DBox as argument, which replaces the automatically generated bounding box for this node.

This bounding box is NOT cached anywhere, so any change that causes the node's world space bounding box to be re-calculated will overwrite the user defined bounding box. This can happen, for example, if mesh data changes or if the world space bounding box of a child node changes (in the case of group and model nodes). We also need to create some unit tests for this new functionality. For these reasons I'm leaving the issue open for now.

lachsen pushed a commit that referenced this issue Sep 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants