Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 May 2009
Offline Last Active Today, 05:28 AM

Posts I've Made

In Topic: Dynamic GPU Instancing

11 July 2016 - 03:44 PM

I sort like this: http://www.socoso.com.au/tiogra/trees.html you could still render as meshes, I just pack em all for simplicity.

In Topic: Subdividing triangles using a GS

28 June 2016 - 04:18 PM

Hi, A long hand version:

PSIn MidPoint(PSIn a, PSIn b)
	PSIn result;
	result.pos = (a.pos + b.pos) / 2.0f;
	result.tex = (a.tex + b.tex) / 2.0f;
// project pos to the same radius as the other points here
	return result;

void GS(triangle PSIn input[3], inout TriangleStream<PSIn> triStream)
	PSIn pointA = input[0];
	PSIn pointB = input[1];
	PSIn pointC = input[2];

	PSIn pointAB = MidPoint(pointA, pointB);
	PSIn pointAC = MidPoint(pointA, pointC);
	PSIn pointBC = MidPoint(pointB, pointC);

	pointA.pos = mul(pointA.pos, viewMatrix);
	pointA.pos = mul(pointA.pos, projectionMatrix);
	pointB.pos = mul(pointB.pos, viewMatrix);
	pointB.pos = mul(pointB.pos, projectionMatrix);
	pointC.pos = mul(pointC.pos, viewMatrix);
	pointC.pos = mul(pointC.pos, projectionMatrix);
	pointAB.pos = mul(pointAB.pos, viewMatrix);
	pointAB.pos = mul(pointAB.pos, projectionMatrix);
	pointAC.pos = mul(pointAC.pos, viewMatrix);
	pointAC.pos = mul(pointAC.pos, projectionMatrix);
	pointBC.pos = mul(pointBC.pos, viewMatrix);
	pointBC.pos = mul(pointBC.pos, projectionMatrix);





Using triangle strip just seems silly to me, I'd use list and it would make more logical sense but the above will work, you'd need to project the mid points to the sphere as well though. I stand by my original point that I think your order is incorrect, and add the second restart strip like I did.

In Topic: Subdividing triangles using a GS

26 June 2016 - 11:04 PM



This order:

    outVerts[0] = inVerts[0];
    outVerts[1] = m[0];
    outVerts[2] = m[2];
    outVerts[3] = m[1];
    outVerts[4] = inVerts[2];
    outVerts[5] = inVerts[1];

Doesn't look right. m[1] is between inVert[1] and inVert[2] so a triangle made up from them doesn't seem correct. You should state, are you using triangle list or strip, because you have a restart strip command in there. Also a pic of what you expect would help.


PS: Why is max vertex count 8?

In Topic: Help with UV mapping procedural game

18 June 2016 - 05:07 PM

Just use the normal in the pixel shader. If the normal is float3(0, 0, 1) then use world coordinates x and y for the texture coordinates. The point of tri-planar is to merge plane aligned samples based on which plane you are closest to. In your case you are aligned on one only.

In Topic: Depth Buffer in D3D9 for Volumetric Fog

02 June 2016 - 08:56 PM

I don't think its so much about getting depth in the same pass (INTZ) as the hurdle being adding different fog sources together. Depth will be what ever is closest even if it is partly transparent and then you have order of drawing issues.  If you sum all back and front face depths of fog you can then calculate the final depth of fog. The author of that article glossed over the important bits; notice he refers to fog "sprites" not volumes. This is how I do it: http://socoso.com.au/Tiogra/fog.html