Forum

Read back vertices after culling


#1

Hallo is it possible to read back vertices information after a mesh has been culled?
tx
Simone


#2

Hi, if you mean “cull” in Rasterizer then that would not really change anything…
You can manually reverse vertex order in GS, then it would change…


#3

I mean getting the vertices that are facing the camera with Rasterizer on back cull.


#4

Rasterizer cull doesn’t change anything geometry wise…
You have three vertices describing a triangle, so culling with Rasterizer would only change the side of triangle that is being rendered by a renderer…

You have triangle with vertices described in order (Clockwise (CW) or Counterclockwise (CCW)) so if you want to reverse cull on mesh, you have to do that in a geometry shader by rewersing vertex order on output. i’ll do you an example later…


#5

I know that rasterizer cull does not modify the mesh, I understand that it just says to the shader which vertices have to be rendered and which not. What I am trying to achieve is to read back the positions of the vertices that are passed to the rendering pipe after the rasterizer filtered them by culling, or any other way to achieve the same result, it may even be something like calculating the distance from camera to object and then average out the vertices one can suppose to be hidden, although this is not obviously neither correct nor elegant.
tx


#6

So… maybe you can provide a patch and a screenshot with descriptions, with exactly what you want…

Rasterizer is a stage when geometry gets rasterized - e.g. rendered to a pixels in our terms it’s somewhere in between pixel shader and everything else…


#7

getvisiblevertices.v4p (6.5 KB)


#8

Hey again ;)

I don’t really think that it’s easily possible to simulate depth test, the easiest way i guess would be to render your mesh to position texture, then do the test in GS if vertex position = sampled world texture then keep vertex else discard …

Anyways check that one out and if you need still that per vertex it’s not gonna take much time…
getvisiblevertices2.v4p (24.8 KB)