Hello,
I try to implement my custom shader technique; In order to get it works, every objects in the scene must be preprocessed in this way: object geometry is split in two part, one part (let's called A) has its own shader, vertex/index buffers, primitivetopology, also the other part (let's called B) has its own shader, buffers.
Now, to apply this technique correctly, I have to render A first and the B in this order. This must be done for every objects so, for example, if I have 3 objects in scene I have to render: A1 B1 A2 B2 A3 B3.
How could manage this in Helix? I think about create two nodes (one for A and one for B) and append both as child of an "empty" parent-Object node
Hi everyone, I loaded a low-polygon STL model into my viewport. Now I want to highlight any facet of the model whenever my mouse cursor hovers on the surface → After that, I want to get that facet's information such as: normal vector, center's position... I don't know what to do now. Here is part of my code so far:
private void viewPort3D_MouseMove(object sender, MouseEventArgs e)
{
findFacet();
}
void findFacet()
{
Vector3D vector3D;
var mousePosition = Mouse.GetPosition(viewPort3D);
var source = FindSource(mousePosition, out vector3D); // Return Model3D
}
Model3D FindSource(Point point, out Vector3D normalVector)
{
var hits = Viewport3DHelper.FindHits(viewPort3D.Viewport, point);
foreach (var hit in hits)
{
if (hit.Model == our_model3D)
continue;
normalVector = hit.Normal;
Console.WriteLine("normalVector: " + normalVector.ToString());
return hit.Model;
}
normalVector = new Vector3D();
return null;
}
Thank you!
@atlesg You need a separate model to render your highlighted triangles. Just create a different mesh model and create your geometry you want to highlight on the fly.
I see, but how can I get the clicked triangle? The only info I can get now is position of Rayhit, normals, and triangle indices. I mean I need to return 3 points of the facet when event MouseDown happens, how can I seize that info? Thank you