FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Rectangular shape NavMeshAgent for Unity?modernator
    I have an issue with the tank character. The Unity's navmesh agent only has a cylinder shape, so when the enemies are nearby, it causes unwanted results. If the navmesh is too big(to cover the entire tank body), the enemies can't approach the side of the vehicle. If the navmesh is too small(only covering the center), the enemies pass through the front of the car and back. Putting the collider doesn't make any changes, the unity's navmesh agent ignores whether it has a collider. How do I make na
     

Rectangular shape NavMeshAgent for Unity?

I have an issue with the tank character. The Unity's navmesh agent only has a cylinder shape, so when the enemies are nearby, it causes unwanted results. If the navmesh is too big(to cover the entire tank body), the enemies can't approach the side of the vehicle. If the navmesh is too small(only covering the center), the enemies pass through the front of the car and back. Putting the collider doesn't make any changes, the unity's navmesh agent ignores whether it has a collider. How do I make navmeshagent shape fit the mesh?

  • ✇Recent Questions - Game Development Stack Exchange
  • NVIDIA Warp Defomable Mesh using add_soft_meshMelissa Herondale
    I am trying to simulate a deformable/soft mesh falling onto the ground plane using the NVIDIA Warp framework, but I get the message "inverted tetrahedral element". I downloaded the Stanford bunny as bunny.obj so I am assuming the mesh data is fine? Could it be because of how they are loaded in the code? The code I am using is: import os import numpy as np import warp as wp import warp.examples import warp.sim import openmesh import meshio import warp.sim.render
     

NVIDIA Warp Defomable Mesh using add_soft_mesh

I am trying to simulate a deformable/soft mesh falling onto the ground plane using the NVIDIA Warp framework, but I get the message "inverted tetrahedral element". I downloaded the Stanford bunny as bunny.obj so I am assuming the mesh data is fine? Could it be because of how they are loaded in the code?

The code I am using is:

    import os
    import numpy as np
    import warp as wp
    import warp.examples
    import warp.sim
    import openmesh
    import meshio
    import warp.sim.render
    from SimulationDataConfig import *
    from pxr import Usd, UsdGeom

class Example:
    def __init__(self, stage_path="bunny.usd"):
        self.sim_width = 8
        self.sim_height = 8



        fps = 60
        self.frame_dt = 1.0 / fps
        self.sim_substeps = 32
        self.sim_dt = self.frame_dt / self.sim_substeps
        self.sim_time = 0.0
        self.sim_iterations = 1
        self.sim_relaxation = 1.0
        self.profiler = {}

        builder = wp.sim.ModelBuilder()

        #m = openmesh.read_trimesh("cylinder.obj")
        mesh_points, mesh_indices = wp.sim.utils.load_mesh(filename="bunny.obj", method="meshio")
        print(mesh_points)        

        mesh_p = np.array(mesh_points, dtype=np.int32).reshape(-1, 3)
        mesh_ind = np.array(mesh_indices, dtype=np.int32).flatten()
        print(mesh_ind)

        #correct_indices = preprocess_tetrahedra(mesh_points, mesh_indices)
        
        #mesh = wp.sim.Mesh(mesh_points, mesh_indices)
        builder.default_particle_radius = 0.01

        builder.add_soft_mesh(
            pos=wp.vec3(0.0, 10.0, 0.0), 
            rot=wp.quat_identity(),
            scale=1.0,
            vel=wp.vec3(0.0, 0.0, 0.0), 
            vertices=mesh_p, 
            indices=mesh_ind, 
            density=100.0,
            k_mu=500.0,
            k_lambda=200.0,
            k_damp=0.0)

        self.model = builder.finalize()
        self.model.ground = True
        self.model.soft_contact_ke = 1.0e3
        self.model.soft_contact_kd = 0.0
        self.model.soft_contact_kf = 1.0e3

        self.integrator = wp.sim.SemiImplicitIntegrator()

        output_dir_root = "example_sims/output"
        output = os.path.join(output_dir_root,"h5_f_{:010d}.h5")


        output_dir = os.path.dirname(output)
        config_file = os.path.join(output_dir, 'config.h5')
        #config = SimulationConfig(self.model, self.sim_dt)
        #self.config = config
        #self.config.write_to_file(config_file)

        self.state_0 = self.model.state()
        self.state_1 = self.model.state()

        if stage_path:
            self.renderer = wp.sim.render.SimRenderer(self.model, stage_path, scaling=1.0)
        else:
            self.renderer = None

        self.use_cuda_graph = wp.get_device().is_cuda
        if self.use_cuda_graph:
            with wp.ScopedCapture() as capture:
                self.simulate()
            self.graph = capture.graph


    def simulate(self):
        for _s in range(self.sim_substeps):
            wp.sim.collide(self.model, self.state_0)

            self.state_0.clear_forces()
            self.state_1.clear_forces()

            self.integrator.simulate(self.model, self.state_0, self.state_1, self.sim_dt)

            # swap states
            (self.state_0, self.state_1) = (self.state_1, self.state_0)

    def step(self):
        with wp.ScopedTimer("step", dict=self.profiler):
            if self.use_cuda_graph:
                wp.capture_launch(self.graph)
            else:
                self.simulate()
            self.sim_time += self.frame_dt

    def render(self):
        if self.renderer is None:
            return

        with wp.ScopedTimer("render"):
            self.renderer.begin_frame(self.sim_time)
            self.renderer.render(self.state_0)
            self.renderer.end_frame()

if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--device", type=str, default=None, help="Override the default Warp device.")
    parser.add_argument(
        "--stage_path",
        type=lambda x: None if x == "None" else str(x),
        default="bunny.usd",
        help="Path to the output USD file.",
    )
    parser.add_argument("--num_frames", type=int, default=300, help="Total number of frames.")

    args = parser.parse_known_args()[0]

    with wp.ScopedDevice(args.device):
        example = Example(stage_path=args.stage_path)

        for _ in range(args.num_frames):
            example.step()
            example.render()

        if example.renderer:
            example.renderer.save()

What could be the reason for this message? Does anyone know a fix or how I should approach it

  • ✇Recent Questions - Game Development Stack Exchange
  • Mesh normals create square pattern on surfaceuser1798770
    Whether I import a smooth shaded mesh from Blender or I generate a mesh in Unity manually using Unity's built in normal calculation function, I get a square grid pattern showing for the shading of my mesh (red line highlights a couple of the squares). Each square outline is where a quad is located. Is this normal? Is there any way that I can make this appear more smooth? Edit: Each point on the triangle exists only once. Points are shared between triangles. They are created with a simple loop:
     

Mesh normals create square pattern on surface

Whether I import a smooth shaded mesh from Blender or I generate a mesh in Unity manually using Unity's built in normal calculation function, I get a square grid pattern showing for the shading of my mesh (red line highlights a couple of the squares).

Each square outline is where a quad is located.

Is this normal? Is there any way that I can make this appear more smooth?

Edit:

Each point on the triangle exists only once. Points are shared between triangles. They are created with a simple loop:

        List<Vector3> vertexList = new List<Vector3>();

        for (int z = 0; z < zSize; z++)
        {
            for (int x = 0; x < xSize; x++)
            {
                Vector3 v = new Vector3(0, 0, 0);
                v.x = (x * vertexSpacing) - vertexSpacing;
                v.z = (z * vertexSpacing) - vertexSpacing;
                v.y = Mathf.PerlinNoise(v.x + g.transform.position.x, v.z + g.transform.position.z);
                vertexList.Add(v);
            }
        }

Grid pattern with no wireframe

Wireframe edges visible

How to fix UVs of spline tunnel/cylinder mesh?

I have created a tunnel using unity's spline tool. And I'm creating a custom shader for it in shader graph, and I would like to add bumps inside of the tunnel. The problem is in how the UVs, vertices and triangles are set up in the mesh:

enter image description here

But I would like to have the UVs and vertices be something like this: enter image description here

Then I could easily sample a texture or generate a noise pattern.

  • ✇Kotaku
  • How To Unlock Final Fantasy 16: The Rising Tide's Secret BossTimothy Monbleau
    Final Fantasy 16 is a pretty casual-friendly game, despite its shift to combo-heavy action combat. So it’s come as a bit of a shock that The Rising Tide DLC has upped the difficulty quite a bit, featuring some of the most intense boss fights in the entire game. But what if I were to tell you that there’s an even…Read more...
     

How To Unlock Final Fantasy 16: The Rising Tide's Secret Boss

22. Duben 2024 v 16:15

Final Fantasy 16 is a pretty casual-friendly game, despite its shift to combo-heavy action combat. So it’s come as a bit of a shock that The Rising Tide DLC has upped the difficulty quite a bit, featuring some of the most intense boss fights in the entire game. But what if I were to tell you that there’s an even…

Read more...

❌
❌