I am working on writing an exporter for 3D models which can be viewed in PDF (ie using PRC format), currently I am trying to figure out how to correctly write the normals to that format (which is not really explained very well in the spec). I created some very simple models (in OBJ) made of just a few triangles, with both perpendicular and non-perpendicular normals. However when I add the PRC to the PDF to view it in Adobe Reader, they look wrong (judging by how the light falls on them).
Now I would like to know if there are some kind of tools or debug utils which let me intercept the data as it is rendered by Adobe and somehow visualize the normals (or at least get the numbers)? I think if I can actually see which way the normals go (and if they indeed point in the correct hemisphere) then it might help me greatly to figure out how to encode the data correctly.
I am on Windows 10 and have an nvidia graphics card (GTX 970), and Adobe seems to use DirectX 9, and I use Visual Studio 2012 (but I also have installed VS 2015, just not using it for my projects (yet) as it seems to have a very high memory footprint).
This is an example of how one of my simple models is rendered in Adobe (purple) and also in my test app (showing normals in my app on top):
Even if you grab the vertex buffer
from Adobe you have to know its format to extract normals
. So it seems like too complicated for such task.
Much faster is to guess the normal by color (assuming color is direct propotion of angle between normal
and light direction
).
Using HSV color model:
Values (V
) for points:
Using this values we can say:
Normal
. Maybe other visual style would be better.N6
~ N5
~ N3
. So I would swap normals N6
and N4
.N4
has different color (maybe value is wrong). Maybe you have to normalize them.