Instancing Lines DX11

Hey guys, playing with instancing geometry on DX11, terrific performance increasing!
It’s possible to do it also with lines? There is someone out there with a Lines that give out Geometry instead of layer?

Here are couple samples, using structured buffers and null geometry, vertex fetch in vs/gs.

Interleaved/Split buffer version, and show either line direct render or point to line expansion in GS.

Have fun

Batch lines (7.6 kB)

thanks, nice compendium

tnx big vux

wooooooooooooooop vux

hey this works on 2D right? how is complicated to make it works with 3D?

Replace float2 by float3 ;)

if only I could define “Line Buffer” as a float6 XD


still playing with the first one (LineBatchFromToInterleaved).
I’m able to let it works (kind of) in this way:

StructuredBuffer<float3> sbLinesFr <string uiname="Line Buffer1";>;
StructuredBuffer<float3> sbLinesTo <string uiname="Line Buffer2";>;

void VS(uint iv : SV_VertexID, out float4 pos : SV_Position)
	float3 linedataFr = sbLinesFr[iv / 2](iv / 2);
	float3 linedataTo = sbLinesTo[iv / 2](iv / 2);
	float3 pl = iv % 3 == 0 ? linedataFr : linedataTo;
	pos = mul(float4(pl,1), tVP);

but still the result is flat, line are traced in 2D even if I give point as float3…

(also, I expected to use iv/3 as index, but it doesn’t works!)

float3 linedataFr = sbLinesFr[iv / 3](iv / 3);
float3 linedataTo = sbLinesTo[iv / 3](iv / 3);

linebatcher2.rar (7.2 kB)

hey Luper, everything works fine in ur patch if change Dynamic Buffer 2d on Dyanmic Buffer 3d ;]

hahahahahaha that was easy! ok now, what if I want to add the “Width” property?

I’ll try to study what is inside Line (DX11) , in the meanwhile let me know if you have some useful hint!

@luper : here shader only outputs line, you need to use a geometry shader version and expand a quad instead of a line (using screen space size to set pixel width)

you made it look so simple XD
ok thanks I’ll try