 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Working on a data converter from ZBrush's GoZ to Povray's mesh2 format
I found that GoZ does not contain normal vectors, so all mesh renderings
are flat. Is there some ready-to-use code or utility for normal vectors
calculation for meshes ?
Present mesh2 example is attached.
--
YB
Post a reply to this message
Attachments:
Download 'test_zb.zip' (19 KB)
Download 'scene.png' (26 KB)
Preview of image 'scene.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
yesbird <sya### [at] gmail com> wrote:
> Working on a data converter from ZBrush's GoZ to Povray's mesh2 format
> I found that GoZ does not contain normal vectors, so all mesh renderings
> are flat. Is there some ready-to-use code or utility for normal vectors
> calculation for meshes ?
>
> Present mesh2 example is attached.
> --
> YB
Interested if there is one, but meanwhile you could import your pov file into
Blender using POV@Ble (https://extensions.blender.org/add-ons/povable) and
re-export pov file after using the shade smooth command from Object menu
(https://docs.blender.org/manual/en/2.91/scene_layout/object/editing/shading.html).
If anything goes wrong it now has its own issue tracker, and reporting any
trouble may help these to get priority over other issues or regressions.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
yesbird <sya### [at] gmail com> wrote:
> Is there some ready-to-use code or utility for normal vectors
> calculation for meshes ?
You'd think there was. And I suppose that there really ought to be some
existing under-the-hood calculation of normals for smooth_triangles.
(Maybe Pose-Ray does it? Silo? TdG would know)
I'd say that what you're going to have to do is take all of your triangle data
and put it into an array, and then cycle through the array to make your smooth
triangles and calculate normals manually.
I'm at work for the next 7 hours, but I can post working code from one of my
mesh / mesh2 scenes if no one beats me to it.
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Op 14/03/2025 om 13:52 schreef Bald Eagle:
> yesbird <sya### [at] gmail com> wrote:
>
>> Is there some ready-to-use code or utility for normal vectors
>> calculation for meshes ?
>
> You'd think there was. And I suppose that there really ought to be some
> existing under-the-hood calculation of normals for smooth_triangles.
>
> (Maybe Pose-Ray does it? Silo? TdG would know)
>
Yes indeed: Poseray does the job and is easy to use.
https://sites.google.com/site/poseray/
Not sure about Silo. It can manipulate them though, and it is a complex
program. However, it is not free software as Poseray is.
--
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 14/03/2025 14:59, yesbird wrote:
> Working on a data converter from ZBrush's GoZ to Povray's mesh2 format
> ...
Thanks for your suggestions, I have Poseray, but for unknown reasons
it doesn't like my mesh (please, see attached image). Looks like the
the best solution will be to calculate normals myself in the converter's
code.
Bill, I will be glad to look at your code for reference.
--
YB
Post a reply to this message
Attachments:
Download 'poseray.png' (34 KB)
Preview of image 'poseray.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
yesbird <sya### [at] gmail com> wrote:
> Thanks for your suggestions, I have Poseray, but for unknown reasons
> it doesn't like my mesh (please, see attached image).
Hmm. That's interesting.
Maybe there's a hole in the mesh, and it needs to get repaired?
Perhaps try:
https://www.meshlab.net/
and see if that, or another similar tool helps after a round of fixing?
- BW
Are you generating your mesh programmatically?
Are you using an implicit or parametric equation to define the surface?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 14/03/2025 18:36, Bald Eagle wrote:
> Hmm. That's interesting.
> Maybe there's a hole in the mesh, and it needs to get repaired?
> ...
Yes, the mesh produced by my converter, but a workaround with Blender
solved all the problems. Thank you for your assistance.
--
YB
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Op 14/03/2025 om 15:17 schreef yesbird:
> On 14/03/2025 14:59, yesbird wrote:
>> Working on a data converter from ZBrush's GoZ to Povray's mesh2 format
>> ...
>
> Thanks for your suggestions, I have Poseray, but for unknown reasons
> it doesn't like my mesh (please, see attached image). Looks like the
> the best solution will be to calculate normals myself in the converter's
> code.
>
That mesh looks definitely to be corrupt and needs repairing first!
> Bill, I will be glad to look at your code for reference.
> --
> YB
--
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 15/03/2025 11:57, Thomas de Groot wrote:
> That mesh looks definitely to be corrupt and needs repairing first!
Maybe, but POV-Ray renders it without problems and I don't see any
issues in syntax. Moreover, I found alternative solution already.
--
YB
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
yesbird <sya### [at] gmail com> wrote:
> On 15/03/2025 11:57, Thomas de Groot wrote:
> > That mesh looks definitely to be corrupt and needs repairing first!
>
> Maybe, but POV-Ray renders it without problems and I don't see any
> issues in syntax. Moreover, I found alternative solution already.
> --
> YB
This is my easy code for the normals
easy to translate to any language
xVD=(FACE.y1-FACE.y0)*(FACE.z2-FACE.z0)-(FACE.z1-FACE.z0)*(FACE.y2-FACE.y0)
yVD=(FACE.z1-FACE.z0)*(FACE.x2-FACE.x0)-(FACE.x1-FACE.x0)*(FACE.z2-FACE.z0)
zVD=(FACE.x1-FACE.x0)*(FACE.y2-FACE.y0)-(FACE.y1-FACE.y0)*(FACE.x2-FACE.x0)
NoDivBy0=xVD*xVD+yVD*yVD+zVD*zVD
IF NoDivBy0=0 THEN NoDivBy0=0.000000000001
xND=xVD/sqr(NoDivBy0)
yND=yVD/sqr(NoDivBy0)
zND=zVD/sqr(NoDivBy0)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |