POV-Ray : Newsgroups : povray.off-topic : The most common 3D mesh file format? Server Time
6 Sep 2024 13:20:48 EDT (-0400)
  The most common 3D mesh file format? (Message 11 to 20 of 40)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Severi Salminen
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 03:03:27
Message: <497ebfcf$1@news.povray.org>
andrel wrote:

> use blender, wings3d or something like that and export a few basic
> shapes as obj

Thanks, that was a good idea! I exported and imported the Blender monkey
model (in .obj) and here is the result:

http://www.saunalahti.fi/~sevesalm/ssRay/ShowImage.php?img=27

w00t, it works :D It is slow but looks to render quite properly.
However, my system crashed at 7am for some reason (blinking keyboard
leds - kernel panic, maybe?). Still don't know what was the reason.


Post a reply to this message

From: scott
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 03:23:08
Message: <497ec46c@news.povray.org>
>> Another advantage of OBJ is that it support quads. I think 3DS only 
>> supports
>> triangles?
>
>  Rendering a (non-rectangular) textured quad is not an unambiguous 
> process.
> How do you do that? Dividing it into two triangles will get you a 
> texturing
> artifact.

To be clearer, there is no expected or obvious way how the inside of a quad 
should be textured given the four vertex texture coordinates.  Converting to 
two triangles does it one way, but there are other possibilities.  In 
practise every modeller and renderer will convert it to two triangles, so I 
guess that can be thought of the "standard" way.

However, a more fundamental problem with quads is if the vertices are 
non-planar.  Now, depending on how you triangulate it, you will actually get 
different geometry.  For this reason, when you model using quads you should 
try to keep them as close to planar as possible, otherwise you might be 
surprised at the output, or when you come to smooth the mesh you will get 
some funny results.


Post a reply to this message

From: scott
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 03:26:26
Message: <497ec532$1@news.povray.org>
>> Thanks. OBJ seems fine. Any idea where I could find very simple .obj
>> files which contain (say) less than 100 triangles?
>>
>> ssRay still lacks kd-trees so I don't want to wait millions of years
>> rendering that cool dragon model...
> use blender, wings3d or something like that and export a few basic shapes 
> as obj

Just as a warning, I came across something weird with Blender and .obj 
files, I can't remember exactly, but it was something like if no vertex 
positions had a decimal point it wouldn't like the file.  Putting a ".0" on 
the end of just one number in the file made it load ok.  ???


Post a reply to this message

From: Warp
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 04:57:19
Message: <497eda7e@news.povray.org>
clipka <nomail@nomail> wrote:
> [-- text/plain, encoding 8bit, charset: iso-8859-1, 34 lines --]

> Warp <war### [at] tagpovrayorg> wrote:
> >   Rendering a (non-rectangular) textured quad is not an unambiguous process.
> > How do you do that? Dividing it into two triangles will get you a texturing
> > artifact.

> Should be not too difficult: Just triangulate the nasty things.

> As long as we're "only" talking about quads and not generic N-gons that should
> not be a big deal. Find the shortest diagonal and cut it in two.

  But if you do that, you will get a texturing artifact, as I said.
Specifically this:

http://warp.povusers.org/images/uvproblem.gif

  (And if someone mentions the term "perspective" as a reply to this post,
I'll smash his face.)

  I suppose that if you subdivide the quad into four triangles (with one
extra vertex at the center of the quad) the artifact will be greatly
lessened, but it would still not be correct. (Basically the triangles
at the top and bottom edges would have their texture completely vertical,
even though it shouldn't be.)

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 04:58:38
Message: <497edacd@news.povray.org>
scott <sco### [at] scottcom> wrote:
> In 
> practise every modeller and renderer will convert it to two triangles, so I 
> guess that can be thought of the "standard" way.

  It might be the "standard" way, but it produces an incorrect texturing
(with non-rectangular quads). The texture would require a non-linear
transformation to be rendered correctly on such a quad.

-- 
                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 05:11:18
Message: <497eddc6$1@news.povray.org>
>> In
>> practise every modeller and renderer will convert it to two triangles, so 
>> I
>> guess that can be thought of the "standard" way.
>
>  It might be the "standard" way, but it produces an incorrect texturing
> (with non-rectangular quads).

More specifically, when trying to map a rectangular section of a texture 
onto a non-rectangular quad in model-space.  In practise this rarely happens 
because you usually match your texture coordinates to the mesh (so that the 
texture does not get distorted) - ie your 2 and 3 in texture space would be 
moved to match how they look in model space.

In screen-space, when quads pretty much always become distorted and 
non-rectangular due to perspective, the GPU accounts for this by 
interpolating the texture coordinates divided by w (the homogenous 
coordinate) to ensure the problem you illustrated in the other reply is 
avoided.


Post a reply to this message

From: Warp
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 05:20:26
Message: <497edfea@news.povray.org>
scott <sco### [at] scottcom> wrote:
> More specifically, when trying to map a rectangular section of a texture 
> onto a non-rectangular quad in model-space.  In practise this rarely happens 
> because you usually match your texture coordinates to the mesh (so that the 
> texture does not get distorted) - ie your 2 and 3 in texture space would be 
> moved to match how they look in model space.

  That's not always possible. Simple example: A torus composed of quads,
and a rectangular texture image wrapped onto its surface. The texture will
be distorted at the places where the quads are non-rectangular.

  I suppose you could tansform the texture image so that it matches the
shape of the quads at each point. It would make the texture irregular and
larger, but I suppose it might work. OTOH, if you ever decide to change
the resolution of your torus (ie. change the number of quads it's composed
of), you'll have to re-calculate the texture as well, which might not be
practical.

> In screen-space, when quads pretty much always become distorted and 
> non-rectangular due to perspective, the GPU accounts for this by 
> interpolating the texture coordinates divided by w (the homogenous 
> coordinate) to ensure the problem you illustrated in the other reply is 
> avoided.

  Perspective has nothing to do with what I'm talking about.

-- 
                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 05:54:16
Message: <497ee7d8$1@news.povray.org>
>  That's not always possible. Simple example: A torus composed of quads,
> and a rectangular texture image wrapped onto its surface. The texture will
> be distorted at the places where the quads are non-rectangular.

True, but if you use enough quads that your torus looks like a torus and not 
like a jaggedy square wheel the distortion is going to be minimal.  And 
anyway, won't you have exactly the same problem using triangles instead of 
quads - the renderer can only interpolate linearly and a rectangular texture 
on a torus needs a non-linear interpolation to be correct.

>  I suppose you could tansform the texture image so that it matches the
> shape of the quads at each point. It would make the texture irregular and
> larger, but I suppose it might work. OTOH, if you ever decide to change
> the resolution of your torus (ie. change the number of quads it's composed
> of), you'll have to re-calculate the texture as well, which might not be
> practical.

In most modellers I've seen you apply your texture in certain ways to the 
mesh and the modeller automatically calculates the texture coordinates at 
each vertex for you, so you don't have to concern yourself with making sure 
the textures are distortion free.

>  Perspective has nothing to do with what I'm talking about.

I mentioned it because it's the most common situation when you need to map a 
rectangular texture onto an often hugely non-rectangular quad, and it's 
important it looks right.


Post a reply to this message

From: Warp
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 07:03:30
Message: <497ef811@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >  That's not always possible. Simple example: A torus composed of quads,
> > and a rectangular texture image wrapped onto its surface. The texture will
> > be distorted at the places where the quads are non-rectangular.

> True, but if you use enough quads that your torus looks like a torus and not 
> like a jaggedy square wheel the distortion is going to be minimal.

  May be feasible for non-realtime rendering, but not real-time games
where you need such shapes.

>  And 
> anyway, won't you have exactly the same problem using triangles instead of 
> quads - the renderer can only interpolate linearly and a rectangular texture 
> on a torus needs a non-linear interpolation to be correct.

  At least with triangles you can lessen the problem by making the
triangles as equilateral as possible (iow. each "row" (in torus
coordinates) of vertices is at the middle of the previous "row" of
vertices). Sure, the texturing will still not be technically perfect,
but at least the error is much less glaring, at least on a torus shape.
With quads the error becomes very visible, especially if the quads are
large.

-- 
                                                          - Warp


Post a reply to this message

From: nemesis
Subject: Re: The most common 3D mesh file format?
Date: 27 Jan 2009 11:52:57
Message: <497f3be9@news.povray.org>
Severi Salminen escreveu:
> andrel wrote:
> 
>> use blender, wings3d or something like that and export a few basic
>> shapes as obj
> 
> Thanks, that was a good idea! I exported and imported the Blender monkey
> model (in .obj) and here is the result:
> 
> http://www.saunalahti.fi/~sevesalm/ssRay/ShowImage.php?img=27

Nice too see a renderer built from scratch specially as I remember its 
birth here in past threads... :)


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.