4
$\begingroup$

I have been investigating building some terrain for a blender game engine project, I already have a camera worked up that can follow a mesh with the static physics type. The camera works. However I noticed that the camera started clipping through the terrain at some points.

I believe there is a disparity between how the physics engine calculates collisions with quads and the physical topology of the base mesh. You can see the physics visualization shows every triangulated quad has an edge drawn between the bottom left and top right corner, it doesn't accurately describe the surface.

Square base mesh, without physics visualization Square base mesh with physics visualization

I have here, same exact same mesh explicitly triangulated with the triangulation modifier. This DOES accurately represent the base mesh. When I apply the modifier the camera works perfectly. The simulation follows the terrain perfectly, no clipping, no looking through the terrain.

Same square mesh, with applied triangulation modifier, without physics Triangulated Square mesh, with physics visualization

This would be great, but I plan to use benj's lodshader.py to add a much more detailed simulation surface at close distances while maintaining a low density surface at a distance to preserve performance. This script requires a square base mesh. How how can I get accurate terrain collisions with a square base mesh?


EDIT:

Hopefully these pictures will better illustrate the problem

This is the base mesh made of quads from an angle

Base Mesh

This is the base mesh with the incorrect physics visualization overlay

Base Mesh with physics visualization

Base mesh in wireframe

Base Mesh Wireframe

This is the triangulated mesh in wireframe

Triangulated Wireframe mesh

The same mesh in solid surface

Triangulated Solid Surface mesh

And finally the solid surface mesh, with the triangulation modifier shows the proper physics visualization that follows the surface of the mesh and doesnt allow clipping of the camera through the terrain. I need blender to do this without using the triangulate modifier

Triangulated Solid surface with proper physics overlay

$\endgroup$
1
$\begingroup$

It is always a bad idea to use quads... especially when it comes to games where you have physics and collision calculations. Everything will get converted to triangles anyway, for optimisation and accuracy purposes. I couldn't exactly understand what the exact problem was, but whatever it is it would have something to do with the quads.
Always triangulate before you use your mesh for simulation. And if it is just because of this guys script that you keep a quad surface, then either edit the script that it takes in a triangulated mesh, or find a different LevelOfDetail (LOD) script.
PS: I am pretty sure he would be converting to trinagles somewhere in the script anyway, as it is not possible to get continuous LOD with quads

$\endgroup$
  • $\begingroup$ Ive been working today rendering textures to get the script working 100%. The further I dig, I think you might be right. I think it takes quads, and does the actual generation of terrain and conversion of quads to tris in the shader. Ill try to post with some kind of final resolution today or tomorrow, I think I'm on the right track. $\endgroup$ – CraneArmy Jul 26 '14 at 19:35
  • $\begingroup$ The Game Engine now has Level Of Detail support, it was added a few months ago if I recall correctly so a script like that may not be necessary anymore. $\endgroup$ – MarcClintDion Jul 29 '14 at 1:11
  • $\begingroup$ I disagree. For modeling and animating quads are typically more usefull than triangles. They can form proper edge- and face-loops and give much smoother results when applying subsurf modifiers. And as you said, for physics and rendering they are converted to triangles anyway, so why not use them? $\endgroup$ – maddin45 Nov 23 '14 at 21:25
0
$\begingroup$

By default Blender does not draw an edge when its faces have almost the same orientation. You can enable the displaying of all edges by going to the Object settigns in the property panel. Under Display enable Draw All Edges:

enter image description here

You will have to enable this option for each mesh seperatly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.