Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Generate landscape in Blender - triangulated mesh for bullet physics in Panda3D

Prepare a slab in Blender.

Add Geometry Nodes modifier - click new

Open Geometry Node Editor

-------------------------------------------------------------------------------------------------------------

LANDSCAPING:

Noise Texture - Color Mode

1. Noise Scale 

2. Noise Detail

3. Noise Roughness

RGB Curves - Suppress or amplify parts of the color spectrum

Subdivide Mesh


Apply Geometry Nodes and Triangulate modifiers in object mode, at some point.

-------------------------------------------------------------------------------------------------------------

UV Unwrap methods:

choice 1: Minimum Stretch

choice 2: Smart UV project 

-------------------------------------------------------------------------------------------------------------

PBR TEXTURE

Open the Shader Editor and add nodes: SHIFT - A

texture coordinate -> mapping -> image

 Base - Metallic - Roughness - Normal (mesh smoothness) - Displacement (elevation)

10x scale applied to every image map -

-------------------------------------------------------------------------------------------------------------

ADDITIONAL SCULPTING

Grab Planar Cloth



-------------------------------------------------------------------------------------------------------------

>  gltf2bam model.glb model.bam  

Use bam format for faster panda3D rendering.


>  python3 setup.py build_apps  

Write a setuptool script to deploy a standalone panda3D game.

from setuptools import setup
setup(
    name="MyGame",
    options={
        "build_apps": {
            "gui_apps": {
                "MyGame": "main.py",
            },
            "platforms": ["manylinux2014_x86_64"],  # Adjust to your platform
            "include_patterns": [
                "**/*.bam", "**/*.png", "**/*.jpg", "**/*.ogg", "**/*.wav"
            ],
            "plugins": [
                "pandagl",           # Graphics
                "p3openal_audio",    # Audio
            ],
        }
    },
    install_requires=["panda3d"]
)


-------------------------------------------------------------------------------------------------------------

Panda3D CODING:

- The ground must be a triangulated collision box, for exact collision checks.

- A triangulated mesh is not able to move within bullet physics - static.

- Convex hulls are used for movable objects under gravity.


Gravity pulled down the vehicle against the ground.

panda3d-complexpbr module would  improve the graphics.


    def load_landscape(self):
        model = self.loader.loadModel("landscape.bam")
        model.setScale(45)
        model.reparentTo(self.render)
        geom_node = model.find("**/+GeomNode").node()
        mesh = BulletTriangleMesh()
        for i in range(geom_node.getNumGeoms()):
            mesh.addGeom(geom_node.getGeom(i))
        shape = BulletTriangleMeshShape(mesh, dynamic=False)
        node = BulletRigidBodyNode("Landscape")
        node.addShape(shape)
        np = self.render.attachNewNode(node)
        np.setScale(45)
        np.setPos(0, 0, 0)
        self.world.attachRigidBody(node)
------------------------------------
    def load_vehicle(self):
        model = self.loader.loadModel("vehicle.bam")
        geom_node = model.find("**/+GeomNode").node()
        geom = geom_node.getGeom(0)
        shape = BulletConvexHullShape()
        shape.addGeom(geom)
        node = BulletRigidBodyNode("Vehicle")
        node.setMass(1200)
        node.addShape(shape)
        np = self.render.attachNewNode(node)
        np.setPos(0, 0, 500)
        self.world.attachRigidBody(node)
        model.reparentTo(np)
# Movable vehicle with convexhull - A collision box membrane

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.