POV-Ray : Newsgroups : povray.advanced-users : bigPatch update : Re: bigPatch update Server Time
15 May 2024 08:57:50 EDT (-0400)
  Re: bigPatch update  
From: Tor Olav Kristensen
Date: 30 Mar 2003 15:12:36
Message: <Xns934EE229A6CAtorolavkhotmailcom@204.213.191.226>
"Will W" <wil### [at] NOSPAMwizzardsnet> wrote in
news:3e86277b@news.povray.org: 

...
> The only remaining problem I am aware of at this moment is that
> uv_mapping is not as well controlled as I'd like it to be. That is,
> I've got it working, but I would like to be able to fine tune the
> image map to the contours of the mesh-- is there a way to do this? You
> can see the problem on the example images at the web site.
> 
> I think I've made the licensing more clear-- that bigPatch is to be
> free for individual use, including modifications and extensions, but
> is not public domain. I've read the discussion about licensing issues
> that happened last autumn (thanks for the pointer to those, Tor) and I
> think what I now have would satisfy the objections I saw in that
> thread. I'm open to more discussion on this if need be.
> 
> Please take a look and give me your feedback. Especially about the
> uv_mapping stuff.

OK, I have some further comments for you...

The first one is about the same two lines that I
commented on earlier:

#local dX = (toPt.x-fromPt.x)/Cols;
#local dZ = (toPt.z-fromPt.z)/Rows;

Remember that when you have N on a line, then there
are only N - 1 intervals between them.

So the resulting patch will be more "correct" if you
change these lines to:

#local dX = (toPt.x - fromPt.x)/(Cols - 1);
#local dZ = (toPt.z - fromPt.z)/(Rows - 1);

You will see the effect from this better if you
temporarily remove your clipped_by statemnt and add
a colored sphere at each of the four corners of the
patch. The pacth will now have an equally wide flat
"border" at all the edges.


The next one is about this uv vectors statement:

uv_vectors <(C-dX)/Cols,(R-dZ)/Rows>

Here you have <Columns, Rows> while you have
[Rows][Columns] when indexing your array:

A[R][C][Y]

This looks a little bit odd to me, and I'm not sure
if the result is what the user expects. (But I might
be wrong here.)


And another comment is about your intensive use of
array lookups. This can be a very time consuming
task for POV-Ray to do, so often it is better to
look up a value once and put it in a 'plain' variable
for later use.


My last comment (for now) is about repeating calcu-
lations that POV-Ray has already done earlier.

Have a look at the code below code. (It does the same
as yours but calculates iX + dX*C and iZ + dZ*R only
once in each loop instead of 16 times.)


// This first line should be placed outside the loops
#local vXYZ = <dX, dY, dZ>;
.
<snip>
.
  bicubic_patch {
    type 1  flatness 0 u_steps 3 v_steps 3
.
<snip>
.
    <0.0, A[R  ][C  ][Y]                 , 0.0>*vXYZ
    <0.5, A[R  ][C  ][Y] + A[R  ][C  ][X], 0.0>*vXYZ
.
<snip>
.
    <0.5, A[R+1][C+1][Y] - A[R+1][C+1][X], 1.0>*vXYZ
    <1.0, A[R+1][C+1][Y]                 , 1.0>*vXYZ
    translate <iX + dX*C, 0, iZ + dZ*R>
  }



Tor Olav


Post a reply to this message

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