POV-Ray : Newsgroups : povray.unofficial.patches : Calling all uv experts... Server Time
2 Nov 2024 15:26:19 EDT (-0400)
  Calling all uv experts... (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Cliff Bowman
Subject: Calling all uv experts...
Date: 24 Aug 1999 07:38:49
Message: <37c28377.46981874@news.povray.org>
Hi. I'm trying to write an OBJ to POv converter. I'm currently using
VBA (as found in MS Office programs as well as a slew of others
nowadays) although I'll probably switch to Visual Basic 5 (which I
have lying around and so can install) in the nearish future. It's not
fast, but it IS flexible and easy to use.

OK, right, now then. It's going remarkably well so far. It can convert
an OBJ file exported from Poser4 with normals and - apparently - uv
Mapping data. However, I'm struggling with the uv mapping syntax of
mesh2 OR I'm doing something silly. By default the texture map of the
model I was aiming for doesn't line up at all well. Switching to a
simpler model (a set of stairs) I managed to get the texture to line
up the same (AFAICS) in both Poser and POV by tweaking the image map
statement to translate and scale the texture map thus:

texture_list
    {
        1,
        texture { pigment { image_map { tga "OBJuvPOV.tga" } }
            translate <0.5,0.0,0.0> scale 0.75}
    }

Apologies for the formatting - by default the "texture { pigment ...
0.75}" is all one line and I'm no good at formatting anyway.

However - changing back to the original model and re-testing with the
same parameters - doesn't work. Should the texture be scaled relative
to some aspect(s) of the model's size?

Obviously some of the details are hand-coded - the image map name (for
example) isn't read from the .OBJ (or .MTL) file but I'm using "fixed
parameters" for many things until I'm SURE I've got them working - and
I'm floundering unexpectedly on uv Mapping. If the texture should be
scaled and moved like this then I'm fine - as long as I know why I'm
doing what I'm doing (and how to calculate the relevant
"modifications).

I'm using what I beleive is the latest (3.1e) variant of SuperPatch
POV. Can anyone tell me if the translation and scaling I've applied is
"as intended", or a result of a buglette in SPPOV, or "well it all
works well here" (in which case its probably something to do with my
interpretation of the .OBJ file format).

Curiously, I've compared a few co-ordinates between the output of my
"OBJuvPOV" and "OBJ2POV". While the latter uses smooth triangles and
mine uses the "mesh2" syntax (or tries to) the co-ordinates appear, at
a quick glance, to be near identical (OBJ2POV actually rounds the
co-ordinates up slightly where OBJuvPOV doesn't - at least, not yet).

Help? Anyone? I'm going mad!



Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Vahur Krouverk
Subject: Re: Calling all uv experts...
Date: 24 Aug 1999 11:06:11
Message: <37C2B517.9596A23C@fv.aetec.ee>
Cliff Bowman wrote:
> 
> Hi. I'm trying to write an OBJ to POv converter.
[snip]

Hi!
First I have to say, that I ain't UV expert and don't own Poser, but if
all you want to do is to have Poser=>POVRay conversion, then I believe,
that the solution already exists. Gilles Tran has claimed, that he uses
obj2pov and 3DS2pov to convert Poser objects to POVRay. I guess, that he
exports Poser to 3DS format (although i don't know, whether is it
possible, as I don't have Poser) and then uses 3DS2POV utility to
convert it to mesh2 with all uv information. I think that he is at the
moment on vacation and therefore he can't share his experience. 
I personally have used 3DS2POV for exporting Rhino models to POVRay
quite successfully.


Post a reply to this message

From: Cliff Bowman
Subject: Re: Calling all uv experts...
Date: 24 Aug 1999 15:01:00
Message: <37c2ebff.15445907@news.povray.org>
On Tue, 24 Aug 1999 18:07:03 +0300, Vahur Krouverk <vah### [at] fvaetecee>
wrote:

>Cliff Bowman wrote:
>> 
>> Hi. I'm trying to write an OBJ to POv converter.
>[snip]
>
>Hi!
>First I have to say, that I ain't UV expert and don't own Poser, but if
>all you want to do is to have Poser=>POVRay conversion, then I believe,
>that the solution already exists. Gilles Tran has claimed, that he uses
>obj2pov and 3DS2pov to convert Poser objects to POVRay. I guess, that he
>exports Poser to 3DS format (although i don't know, whether is it
>possible, as I don't have Poser) and then uses 3DS2POV utility to
>convert it to mesh2 with all uv information. I think that he is at the
>moment on vacation and therefore he can't share his experience. 
>I personally have used 3DS2POV for exporting Rhino models to POVRay
>quite successfully.

Yup but doesn't have the flexibility I need alas - I need batch
conversion with UV mapping. 3DS to POV does batch conversions - but
Poserd to 3DS introduces texture problems which need hand fixing.

I've a strong impression that the problem is a bug of my making, which
I'm continuing to investigate :(


Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Calling all uv experts...
Date: 24 Aug 1999 17:35:36
Message: <37c31028@news.povray.org>
The Problem is that Poser won't export models WITH clothes in 3ds format
correctly.

However export in obj format is perfect.

Getting the uv data to map on to the figures is very hard. I've played with
both rotation( have you tried that Cliff, Both Giles and I found that it was
necessary to turn the uv map upside down!) and scaling with little success.

I hear that Thomas Baier is bringing out a new version of win3d which will
incorporate uv mapping/mesh2 for obj files.

Mick

Vahur Krouverk <vah### [at] fvaetecee> wrote in message
news:37C2B517.9596A23C@fv.aetec.ee...
> Cliff Bowman wrote:
> >
> > Hi. I'm trying to write an OBJ to POv converter.
> [snip]
>
> Hi!
> First I have to say, that I ain't UV expert and don't own Poser, but if
> all you want to do is to have Poser=>POVRay conversion, then I believe,
> that the solution already exists. Gilles Tran has claimed, that he uses
> obj2pov and 3DS2pov to convert Poser objects to POVRay. I guess, that he
> exports Poser to 3DS format (although i don't know, whether is it
> possible, as I don't have Poser) and then uses 3DS2POV utility to
> convert it to mesh2 with all uv information. I think that he is at the
> moment on vacation and therefore he can't share his experience.
> I personally have used 3DS2POV for exporting Rhino models to POVRay
> quite successfully.


Post a reply to this message

From: Cliff Bowman
Subject: Re: Calling all uv experts...
Date: 24 Aug 1999 18:42:17
Message: <37c31fbe.12090262@news.povray.org>
On Tue, 24 Aug 1999 22:33:39 +0100, "Mick Hazelgrove"
<mha### [at] mindaswinternetcouk> wrote:

>The Problem is that Poser won't export models WITH clothes in 3ds format
>correctly.
>
>However export in obj format is perfect.
>
>Getting the uv data to map on to the figures is very hard. I've played with
>both rotation( have you tried that Cliff, Both Giles and I found that it was
>necessary to turn the uv map upside down!) and scaling with little success.

I've reversed the Z co-ordinates (z=-z - or scale <1,1,-1>) which
brings the model over nicely (basically Poser had Z "going the other
way" to POV) but... alas, not much help.

>I hear that Thomas Baier is bringing out a new version of win3d which will
>incorporate uv mapping/mesh2 for obj files.
>
Well - hopefully someone will beat me to it. I just feel about "this"
close and it's a tad frustrating to "miss" at that stage :(


Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Cliff Bowman
Subject: Re: Calling all uv experts...
Date: 24 Aug 1999 21:19:13
Message: <37c342ac.21033067@news.povray.org>
[snip]

>Getting the uv data to map on to the figures is very hard. I've played with
>both rotation( have you tried that Cliff, Both Giles and I found that it was
>necessary to turn the uv map upside down!) and scaling with little success.
>
[snip]

I think I'm probably going to have to switch to the "mesh" syntax
(instead of mesh2). I've tried the following 2 examples, which I think
should look identical - but they don't. They're wildly different here
(with regard to uv mapping):

mesh2
{
  vertex_vectors
   {
    4,
    <-0.5,-0.5,-0.5>,
    <-0.5,0.5,-0.5>,
    <0.5,0.5,-0.5>,
    <0.5,-0.5,-0.5>
  }
  uv_vectors
  {
    4,
    <0,0>,<0,1>,<1,1>,<1,0>
  }
  texture_list
  {
    1,
    texture { OBJuvPOV_Texture },
  }
  face_indices
  {
    2,
    <0, 1, 2>, 0,
    <0, 2, 3>, 0
  }
}

Doesn't appear the same as:

mesh {

	smooth_triangle {
		<-0.5, -0.5, -0.5> <0,0,1> // Normals just faked
		<-0.5, 0.5, -0.5> <0,0,1>  // Normals just faked
		<0.5, 0.5, -0.5> <0,0,1>   // Normals just faked
		uv_vectors
			<0,0>, <0,1>, <1,1>
	}
	smooth_triangle {
		<-0.5, -0.5, -0.5> <0,0,1> // Normals just faked
		<0.5, 0.5, -0.5> <0,0,1>   // Normals just faked
		<0.5, -0.5, -0.5> <0,0,1>  // Normals just faked
		uv_vectors
			<0,0>, <1,1>, <1,0>
	}
	uv_mapping
	texture { OBJuvPOV_Texture }
}


What's more - the second example renders differently in uvPov (alpha
5) than it does in SuperPatch POV. No - really, it does. It renders
*exactly* as I'd hoped they both would...

Methinks if nothing else I've spotted a problem with SuperPatch
POV...?


Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Cliff Bowman
Subject: Re: Calling all uv experts...
Date: 25 Aug 1999 13:22:58
Message: <37c41de5.11960634@news.povray.org>
On Wed, 25 Aug 1999 01:20:38 GMT, c.b### [at] cwcomnet (Cliff Bowman)
wrote:

[snip]>
>I think I'm probably going to have to switch to the "mesh" syntax
>(instead of mesh2). 

[snip]

Well I HAVE switched to mesh, tidied my code up a bit (including
renaming some variables - drastically - to make the code easier to
read), found a bug or two and now it's working perfectly. At least, as
far as it's got. Aside from the speed (it's interpreted BASIC so it
runs like glue off a cold shovel - plus my coding's a mess) it's a
slight improvement on OBJ2POV (at least - for me). It produces 2 files
for a given .OBJ - one containing the meshes (an .inc) and a "sampe
scene file" with a camera, couple of lights, and texture declarations.

You don't have to pre-process the .OBJ file, the model is
automatically adjusted to POV orientation (assuming Poser was the
source) and I've a ton of features to write yet.

The source of my problems? Well aside from a few bugs (silly things -
mainly typos exacerbated by poor naming of variables) was that neither
uvPOV not Superpatch POV seem to get on well with adjacent triangles
having their U and V co-ordinates (at the same vertex) wildly
different. This happens a lot with .OBJ files and with both mesh2 and
mesh statements I was trying to make 1 big mesh in the hopes that it'd
be faster. Bad move. Keep the original groupings (and cut existing
groups into subgroups where more than 1 material is used, just to be
on the safe side) and it comes together swimmingly.

Still don't know why uv mapping the mesh syntax works better under
uvPOV than SuperPatch POV though :(

I'll post a test render of the female nude (but cleaned up slightly,
this is a family group after all - I think) at the same time as this
post.

Mick - if you want the code at any stage just holler, but there's
plenty more I want to include *if I can* so it might be worth waiting
until I've either reached at least version 0.5a or (better still) have
an executable Visual Basic 5 version (I don't have VB6 which
supposedly produces faster code than VB5).

However - reasons to wait (or "things I'd like to implement but no
idea if I'll succeed).
Mesh2 format (as an option if nothing else)
Batch conversions for animations (my MAIN reason for writing OBJuvPOV
- vying with the ability not to have to pre-edit the .OBJ files and
post-edit the .POV files)
Read image_map names, and possibly colours and ambience (and whatever
else I can decode and get working) from the .mtl file that Poser
exports along with any .OBJ
Oh - some error handling would be nice. At the moment it pretty much
works with files which are structured exactly as it expects them to be
- I need to build in more exceptions-to-the-rule... for example
sometimes Poser doesn't export vertex, UV AND normal data for a given
"face" but only two (for some objects) - and I'm not sure which two.
Clothes and/or hair seem to be the likely candidates, so I need to do
some delving to double-check what Poser's doing.


However - that lot's going to take some work (with my skill level) so
don't be afraid to holler if you want it "as it is" - whenever.




Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Ken
Subject: Re: Calling all uv experts...
Date: 25 Aug 1999 13:32:39
Message: <37C42882.9C684FC3@pacbell.net>
Cliff Bowman wrote:

> However - that lot's going to take some work (with my skill level) so
> don't be afraid to holler if you want it "as it is" - whenever.
> 
> Cheers,

When you get an executable working in the future let me know and I'll
give it a trial. I have several links to Poser models w/textures and
would like to see how well it works. I too have had some serious problems
with UVmapping and would like to learn how to take advantage of it.
I hear it's supposed to be a high end feature :)

-- 
Ken Tyler

See my 850+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Cliff Bowman
Subject: Re: Calling all uv experts...
Date: 26 Aug 1999 16:16:28
Message: <37c4914b.23403606@news.povray.org>
On Wed, 25 Aug 1999 10:31:46 -0700, Ken <tyl### [at] pacbellnet> wrote:

[snip]
>
>When you get an executable working in the future let me know and I'll
>give it a trial. I have several links to Poser models w/textures and
>would like to see how well it works. I too have had some serious problems
>with UVmapping and would like to learn how to take advantage of it.
>I hear it's supposed to be a high end feature :)
>
>-- 
You think I'm going to keep mum if I actually put together something
useful for POV? <eg> This'll be this millenium's biggest contribution
from me, I suspect. Certainly the most work (aside from my Dr Who
title animation and that helps no-one but me & mine).

Oh - and pls give me a yell if you find any Poser-ready dinosaurs.
They seem to be low on the ground (well actually one of the pertinent
aspects of dinosaurs was that they stood with their legs below them
rather than splayed out lizard-like - but you know what I mean).

Once you get "the knack" (and IMO you need it) the actual application
of UV mapping is pretty easy. I might need to call on people for help
with some stuff though - like how to impliment Poser's "transparancy
maps" (or whether to rule them out as an option). Still, we'll see.

</dumb question>
You likely to be around this weekend? I hope to have a *BASIC* working
copy by then and feedback would naturally be helpful in developing it
further.
</dumb question>

O-er. Hm... have to write some instructions too I guess.


Cheers,

Cliff Bowman
Why not pay my 3D Dr Who site a visit at http://www.who3d.cwc.net/


Post a reply to this message

From: Gilles Tran
Subject: Re: Calling all uv experts...
Date: 27 Aug 1999 12:59:52
Message: <37C6C4B5.96F91401@inapg.inra.fr>
Being back from vacation for a few hours, some comments on uv-mapping.
First I'm very happy that it's finally getting the interest of many
people. There are many little problems in all the converters I found so
it's handy to have several of them. Recently I had to remove all the
degenerate triangles from a Poser mesh because the Superpatch refused it
(mesh2 accepted it though) ! It's not a completely straightforward
technique but it's worth it. So many thanks and best of luck for your
converter.
Second, I'm now using 3DS instead of obj. As Mick Hazelgrove reported,
there are some problems involved with the 3DS export plugin in Poser 4
(and 3 in fact), and I reported them to Metacreations. One workaround is
to export the file in the obj format, import it again in Poser and export
it as 3DS. I also noticed the seam problem, but usually adding some color
on the white part of the map fixes it. I like 3DS2pov better though
because it uses the mesh2 syntax, it's easier to use than obj2pov (no need
to change anything in the obj file). Also, I had some problems with animal
textures with obj2pov (the texture was messed up on the animal spine and
on some parts of the flanks) that I do not have with 3DS2pov.
Of course obj export already works fine in Poser so an obj -> mesh 2
converter will be great.

Gilles Tran

Cliff Bowman wrote:

> Hi. I'm trying to write an OBJ to POv converter. I'm currently using
> VBA (as found in MS Office programs as well as a slew of others
> nowadays) although I'll probably switch to Visual Basic 5 (which I
> have lying around and so can install) in the nearish future. It's not
> fast, but it IS flexible and easy to use.
>


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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