Jump to content


Tottel

Member Since 18 Sep 2010
Offline Last Active Mar 31 2013 09:41 AM
-----

Topics I've Started

Run geometry shader over newly-created geometry?

08 June 2012 - 11:02 AM

I'm trying to subdivide a quad (2 triangles) multiple times.

I send it to the geometry as triangleadj and ouput 8 triangles from that.
However, I want to subdivide multiple times and someone told me I can send the geometry output back to the vertex shader and run the geometry shader again on that new geometry. He couldn't tell me how though.

Does anyone have any experience, or tips about this? I'm using DirectX10, so I cannot use tesselation instead.

Thanks.

HLSL Geometry shader normals problem

07 June 2012 - 09:21 AM

Hello,
I'm making a geometry shader that generates waves on a mesh (preferably a flat plane), using a heightMap.
Everything is working fine, except the normals don't really work out.


http://i.imgur.com/2WGoT.png


I set the normal for each vertex using the crossproduct, which is correct for each triangle individually.
However, the geometry shader goes over every vertex multiple times, so it will assign a different normal for every triangle (right?).
Which means it cannot interpolate correctly.


I tried to be creative and check for every vertex if its normal is default (0,1,0), like so:
if ((vertices[0].Normal.y >= 1.01f && vertices[0].Normal.y <= 0.99f)) normal0 = vertices[0].Normal;
else normal0 = normalize(cross(top0 - top1, top0 - top2));

So that it will reuse the normal if it's already assigned to that vertex. However, it's still giving me the same problem. Any ideas how to solve this?