A list of puns related to "Triangle mesh"
I have a basic icosphere which i exported from blender with normals as obj.
Here is what i am doing
mesh->vert[i].position = mesh->vert[i].position + noise(mesh->vert[i].position) * mesh->vert[i].normal
for every vertex.
But the triangles are splitting up wierdly like:
https://i.stack.imgur.com/YXTEA.png
The Exact Code:
for(int i=0;i<customModel->mesh->vertexCount;i++)
{
Vert tmp = customModelCopy->mesh->vert[i];
float x = tmp.position.x;
float y = tmp.position.y;
float z = tmp.position.z;
float elev = 0.0f;
if (noiseBased)
{
elev = noiseGen->Evaluate(x, y, z);
for (NoiseLayerModule* mod : moduleManager->nlModules)
{
if (mod->active)
{
elev += mod->Evaluate(x, y, z);
}
}
}
else {
float pos[3] = { x, y, z };
float texCoord[2] = { tmp.texCoord.x, tmp.texCoord.y };
float minPos[3] = {0, 0, 0};
float maxPos[3] = {-1, -1, -1};
elev = EvaluateMeshNodeEditor(NodeInputParam(pos, texCoord, minPos, maxPos)).value;
}
tmp.position -= elev * tmp.normal;
customModel->mesh->vert[i] = tmp;
}
customModel->mesh->RecalculateNormals();
And For Model : https://github.com/Jaysmito101/TerraForge3D/blob/master/TerraForge3D/src/Base/Mesh.cpp https://github.com/Jaysmito101/TerraForge3D/blob/master/TerraForge3D/src/Base/Model.cpp
Also posted in r/SolidWorks
Equilateral Grid on Organic Surface
I have modeled an organic surface and now want to create a mesh of equilateral triangles that closely represents this surface. It does not have to be a perfect match. I am currently creating the mesh using many 3D sketches. Does anyone have any suggestions on how to do this efficiently?
My current workflow:
1.Model the 3D surface
2.Create a 3D sketch of a triangle with vertices on the surface (orange in picture). Place triangle somewhat randomly in the center of the surface. Fix the 3 vertices.
3.Create a 3D sketch containing a 6 sided polygon (it's not planar so I'm not sure polygon is the correct term) with all vertices on the surface and with two vertices fixed to two of the triangle's vertices from step 1. Turn the polygon into 6 equilateral triangles by drawing a line between each vertex of the polygon to a new central point somewhere in 3d space. Set all lines to equal length. The lines are now all defined and the point that was floating now snaps to one of two possible points in space (there are two solutions, convex or concave).
Note that I have filled in some of the gaps between 6 sided polygons with individual triangles as I was experimenting.
Has anyone done this before? Is there a better way?
https://preview.redd.it/e2ctm4i74cn71.jpg?width=1413&format=pjpg&auto=webp&s=3bc54ce192f18aa731f3212bb4be8819765210e3
https://preview.redd.it/hu07v7i74cn71.jpg?width=1556&format=pjpg&auto=webp&s=5f9be24ae93061b8d082f4626a177164ea39b8f7
Hello, question in the title, I need every triangle of the mesh rotated around its axis, and do it from shader.
May be there better solution for my problem, I need to render a point cloud in opengl es 2.0, so I can't use GL_POINTS
I have exported the Blender Suzanne to Unity.
The mesh is visible and works as expected, however I can't access the vertex, normal or triangle arrays of the mesh, they all have zero length.
Debugging leaves me with the following:
var suzannemesh = Suzanne.GetComponentInChildren<MeshFilter>().mesh;
vertexCount = 2797
vertexBufferCount = 1
vertexAttributeCount = 4
vertices = Vector3[0]
normals = Vector3[0]
triangles = int[0]
As far as I understand, in this case the information is stored somewhere as a buffer? I need to extract the vertices, normals and triangle indices in order to send them to another machine. How do I get this information? Other meshes simply have these properties directly accessible...
I am making a character model and I have been unable to remove this triangle from my mesh without creating either another triangle, or an n-gon somewhere. I am following an old tutorial so as to get an idea of how to create the model and he has made keeping the lowermost ring at 8 edges seem important so I would like to not change that amount if possible, or if not keep it even. This is the only triangle or n-gon on the mesh (mirrored).
Hello, I'm looking for the names of some algorithms to create a polygon mesh from a set of bounding planes representing a convex hull/volume.
My initial instinct is to:
but I'm not sure if the plane-plane intersection will create precision errors which could make matching line (segments) together difficult. I could use the info about which planes clip the lines in order to match them together, but I want to know if there are existing (simpler) solutions I can look at
I've been messing around in unity making a mesh editor and noticed that a Mesh Collider with a single triangle works in non-convex mode as expected, but in convex mode, it turns the triangle into a quad. I need to be able to use a Rigidbody and so have to use convex mode, but is there a way to keep the triangles?
I've been doing terrain rendering for a long while (decades) and now have a new application that's non-gamedev/rendering related that I've been able to apply terrain rendering strategies to over the last few years. My go-to programming hobby terrain rendering engines has always been a sort of static ROAM type algorithm for generating a mesh from a heightmap, recursively subdividing triangles where the center of their edge deviates from the heightmap at that XY point, per an error threshold.
The situation is that I'd like to generate meshes that are less "quantized" looking, either somehow displacing the final vertex positions horizontally per the heightmap's gradient at that location and then updating the vertices' Z from the heightmap, maybe iteratively shift around the verts along the heightmap and conform them to the mesh after subdividing down to an initial starting mesh, or maybe using some other triangulation technique entirely. The use case I'm looking at is exporting a mesh for CAD purposes, not for rendering, so the processing time is not particularly important, though I'd like to not just create a fully dense mesh and then decimate that - even though that seems to be the sort of result that I am aiming for. The goal is to get rid of extraneous triangles that don't contribute any detail (of course!) without the strategy resulting in telltale artifacts like ROAM-style subdivision does. The sort of meshes being exported are not terrains, they're more like 2.5D CAD models that can have hard edges, smooth curves, undulating contours, etc... and the triangle subdivision strategy just doesn't capture hard edges very well.
I'm probably chasing something that's a waste of time, I just thought I'd put this out there to see if anybody had any thoughts/ideas on alternative ways to generate a mesh from a heightmap without just spitting out a dense mesh or relying on the quantized look that subdivision can produce. The heightmaps can be up to dozens of gigapixels which makes the dense mesh decimation seem like it'd just be painfully slow, and a dense mesh prohibitively gigantic for the hardware my end-users tend to be running (they're not gamers so they're running 10+ year old computers in many cases, fun stuff).
Anyway, thanks for reading :)
Hi.
I hope this is the right place to post to but I figured it is related to graphics programming.
I'm working on a project for which I need to determine whether a triangle (3x Vector3 vertices in world space) is occluded (both partially and fully) by another triangle when given the view matrix of a camera. Currently, I'm only able to conclude whether a triangle is within the camera's view frustrum but not whether it is ACTUALLY visible or if another triangle is placed in front of it. I don't need to perform any calculations afterwards, I'm simply interested in knowing whether triangles collide when viewed from a certain camera position.
I know all the mesh data in world coordinates (triangles, vertices, etc.) as well as camera intrinsics and its view and projection matrix. Now, is there some way for me to determine actual visibility and occlusion of triangles?
Any help is appreciated.Thanks.
EDIT: I forgot to mention that I'm doing all of this in Unity / C#. So, I guess I'm asking if there's a way to implement some sort of occlusion culling using the data I have.
I am trying to represent a car in some drawings but they all have this triangle mesh surface that looks horrible in anything other than a rendering.
I can see the triangles of the same mesh through (some of) the triangles. I'm struggling to find the words to describe it, so I've added a screenshot and a GIF below. I am hoping I can get some suggestions as to what the problem could be.
I've taken a look with RenderDoc and noticed that my depth attachment is either 0 or 1. Never between: https://i.imgur.com/AfWUsmA.png. Is this the problem? If so how do I fix it?
Thanks.
EDIT: I've quickly recreated the problem with 2 cubes (lower cube is in front): https://i.imgur.com/c2mnH1U.png
Edit: I will also note that I have changed my coord system to (forward=+1, up=+1) using glm GLM_FORCE_LEFT_HANDED.
Edit: Depth texture setup:
vk::Format depthFormat = m_context->GetDepthFormat();
vk::ImageCreateInfo imageInfo{};
imageInfo.imageType = vk::ImageType::e2D;
imageInfo.format = depthFormat;
imageInfo.extent.width = m_swapchainWidth;
imageInfo.extent.height = m_swapchainHeight;
imageInfo.extent.depth = 1.0f;
imageInfo.mipLevels = 1;
imageInfo.arrayLayers = 1;
imageInfo.samples = vk::SampleCountFlagBits::e1;
imageInfo.tiling = vk::ImageTiling::eOptimal;
imageInfo.usage = vk::ImageUsageFlagBits::eDepthStencilAttachment;
allocator.Allocate(imageInfo, VMA_MEMORY_USAGE_GPU_ONLY, &m_depthStencil.Image, &m_depthStencil.Allocation);
vk::ImageViewCreateInfo imageViewInfo{};
imageViewInfo.viewType = vk::ImageViewType::e2D;
imageViewInfo.image = m_depthStencil.Image;
imageViewInfo.format = depthFormat;
imageViewInfo.subresourceRange.baseMipLevel = 0;
imageViewInfo.subresourceRange.levelCount = 1;
imageViewInfo.subresourceRange.baseArrayLayer = 0;
imageViewInfo.subresourceRange.layerCount = 1;
imageViewInfo.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eDepth;
if (depthFormat >= vk::Format::eD16UnormS8Uint)
{
imageViewInfo.subresourceRange.aspectMask |= vk::ImageAspectFlagBits::eStencil;
}
m_depthStencil.View = device.createImageView(imageViewInfo);
Renderpass setup:
vk::AttachmentDescription colorAttachment{};
colorAttachment.format = m_swapchainFormat;
colorAttachment.samples = vk::SampleCountFlagBits::e1;
colorAttachment.loadOp = vk::AttachmentLoadOp::eClear;
colorAttachment.storeOp = vk::Atta
... keep reading on reddit β‘I am making a procedural chunked terrain LOD system. I store the chunk data in a quad-tree. Each chunk has 9 vertices but the chunks differ in size. Because the border vertices of the chunks overlap, I do not store information for all 9 vertices in every chunk, but instead use the information from the neighboring chunks.
I want to combine all chunks into a single mesh, but this is really hard to do since indexing the vertices and triangles from 0-n is impossible (the chunks differ in size so there is no particular grid or order for the vertices). One option is to just add 9 vertices from each chunk to the final mesh, but I really want to avoid this since my goal is creating huge terrains and I want to keep the memory consumption to a minimum (8 of the 9 vertices will overlap, essentially doubling the total number of vertices).
Rendering individual triangles from within each chunk is trivial since I have direct access to all 9 vertices.
So my question is: Is there a way to directly render triangles without having to assign the mesh.vertices
field? I want to avoid writing a whole renderer from scratch since I'm better off just writing my own engine at that point.
Any help is appreciated, even just pointing me in the right direction or providing useful resources to learn from. Thank you in advance!
Equilateral Grid on Organic Surface
I have modeled an organic surface and now want to create a mesh of equilateral triangles that closely represents this surface. It does not have to be a perfect match. I am currently creating the mesh using many 3D sketches. Does anyone have any suggestions on how to do this efficiently?
My current workflow:
1.Model the 3D surface
2.Create a 3D sketch of a triangle with vertices on the surface (orange in picture). Place triangle somewhat randomly in the center of the surface. Fix the 3 vertices.
3.Create a 3D sketch containing a 6 sided polygon (it's not planar so I'm not sure polygon is the correct term) with all vertices on the surface and with two vertices fixed to two of the triangle's vertices from step 1. Turn the polygon into 6 equilateral triangles by drawing a line between each vertex of the polygon to a new central point somewhere in 3d space. Set all lines to equal length. The lines are now all defined and the point that was floating now snaps to one of two possible points in space (there are two solutions, convex or concave).
Note that I have filled in some of the gaps between 6 sided polygons with individual triangles as I was experimenting.
Has anyone done this before? Is there a better way?
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.