Forum

How does Triangle (DX9 Indexed) works?

I’been trying a lot entering diferent values in the x y z fields, trying with spreads and I can’t get to draw to the triangle I want. Even with checking the F1’s node. Some can get a little light on me?

can you upload a simple patch that you tried and does not work for you? then we can probably give you a better hint…

like that, I only get that triangle with that spread count, otherwise it renders a line at diferent length. And without the linearspread it renders nothing

ok, so:
the Triangle node most importantly takes Vertices (ie. corner-points for the triangles) via pins: X, Z, Z and Indices via pins: Index 1, Index 2, Index 3.

you can feed it a spread of vertices in any order and then use always 3 indices to select 3 corner-points from the pool of vertices to draw one triangle.

the Index pins are initialized to 0, 1 and 2 and will thus select the first, second and third vertex in the spread to draw a triangle.

in your example you use a LinearSpread which creates linearly distributed values and use always three consecutive of those values as a vertex for your triangles. the resulting triangle is rather unpredictable…

for 3 vertices you need 9 (= 3 * XYZ) values. it is in the nature of the Vector (Split) that if you feed it 6 values it will return 2 split vertices, as 6 values make 2 vertices. if you feed it 7 values it will already return 3 split vertices even though it is actually missing 2 more values. instead of complaining it simply takes the first two (of the seven) values again…

i suggest you replace the LinearSpread with a RandomSpread for a more meaningful test…

if you want to draw more than one triangle you need to specify more indices. to select more of the vertices you provide…

thank you so much for taking the time to answer, it was helpful. I didn’t understood 100% of the explanation part because I don’t speak english hahaha, but it gave me some light so I draw a simple triangle this way. :)