|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello everyone,
I was trying to create a grid of 4x4 using bicubic_patch but unfortunately, I
was unable to figure out how to achieve that. I was able to follow up with the
documentation and created a 3x3 grid, Any suggestion on how that can be achieved
would be really helpful.
I have attached the rendered image of the 3x3 grid along with the code.
//code
global_settings {assumed_gamma 1.0}
background {rgb <1,0.9,0.9>}
camera { location <3.1,7,-8> look_at <3,-2,1.5> angle 40 }
light_source {<500,500,-500> rgb 1 }
#declare B11=<0,0,3>; #declare B12=<1,0,3>; #declare B13=<2,0,3>; #declare
B14=<3,0,3>;// row 1
#declare B21=<0,0,2>; #declare B22=<1,0,2>; #declare B23=<2,0,2>; #declare
B24=<3,0,2>; // row 2
#declare B31=<0,0,1>; #declare B32=<1,0,1>; #declare B33=<2,0,1>; #declare
B34=<3,0,1>; // row 3
#declare B41=<0,0,0>; #declare B42=<1,0,0>; #declare B43=<2,0,0>; #declare
B44=<3,0,0>; // row 4
bicubic_patch {
type 1 flatness 0.001
u_steps 128 v_steps 128
uv_vectors
<0,0> <1,0> <1,1> <0,1>
B11, B12, B13, B14//, B14
B21, B22, B23, B24//, B25
B31, B32, B33, B34//, B35
B41, B42, B43, B44//, B45
uv_mapping
texture {
pigment {
checker
color rgbf <1,1,1,0.5>
color rgbf <0,0,1,0.7>
scale 1/3
}
finish {phong 0.6 phong_size 20}
}
no_shadow
}
Post a reply to this message
Attachments:
Download 'learning_patch.png' (18 KB)
Preview of image 'learning_patch.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"Aj" <nomail@nomail> wrote:
> Hello everyone,
>
> I was trying to create a grid of 4x4 using bicubic_patch ...
user Bald Eagle did this, comprehensively. cannot currently find the thread
where he published a PDF on the subject, only this:
<http://news.povray.org/povray.binaries.tutorials/attachment/%3Cweb.56e6e3e9eb37b7785e7df57c0%40news.povray.org%3E/bezi
er%20uv%20mapping.png>
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Aj" <nomail@nomail> wrote:
You have knots ('fixed points') and handles. Define a grid of fixed points. Now
you can think of each row and column as the fixed points in a bezier curve. The
handles of the bezier curves have to be equally long and need to have the
opposite direction to keep the curve smooth. A Bezier patch is just a lattice of
Bezier curves, the same rules apply.
Altough I don't think it is helpfull, I dug op some very old code t create a
bezier cylinder with dimples:
---%<------%<------%<----
// Ingo Janssen
// 1999-04-22
// bicubic patch generation
#version 3.1;
global_settings{assumed_gamma 1.0}
light_source{<100,50,-500> rgb 1}
camera{
location <0,0,-20.0>
look_at <0,0, 0.0>
}
#macro GetRadius1(R)
#local Range=R*0.1;
#local Variation=Range+(((-Range)-Range)*rand(S));
#declare Rr=R+Variation;
#end
#macro BuildArray(H,R,NrBPH,NrBPC)
// H= height; R= radius
// NrBPH= number of patches in height
// NrBPC= number of patches in circumference
#local PH=((NrBPH*4)-NrBPH)+1;
#local PC=((NrBPC*4)-NrBPC)+1;
#local Ystep=H/PH;
// need one extra element in the array for C1 continuity.
#local BP_arr=array[PH+1][PC+1]
#local Ypos=0;
#local I=0;
#local J=0;
#while (I<PH+1)
#while (J<PC-1)
#local Phi=(J*(360/PC));//+(I*((-180+clock*360)/PH));
GetRadius1(R)
#declare BP_arr[I][J]=vrotate(<Rr,Ypos,0>,<0,Phi,0>);
#local J=J+1;
#end //while
// closed shape so last point is first point.
#local BP_arr[I][J]= BP_arr[I][0];
// the last-plus-one point must be the same as the second point, too.
#local BP_arr[I][J+1]= BP_arr[I][1];
#local J=0;
#local Ypos=Ypos+Ystep;
#local I=I+1;
#end //while
#declare OutArray= BP_arr
#end //macro
#macro BuildPatch(InArray)
// the arrays were made an element larger, so here we must compensate.
#local PH= dimension_size (InArray,1)-1;
#local PC= dimension_size (InArray,2)-1;
#local I= 0;
#local J= 0;
#while (I<PH-1)
#while (J<PC-1)
bicubic_patch {
type 1
u_steps 4
v_steps 4,
InArray[I][J],
InArray[I][J+1],
// notice that the third point in each row is constrained such
// that it, the last point in the row, and the second point
// in the equivalent row in the next patch are in a straight line.(Ron Parker)
2*InArray[I][J+3]-InArray[I][J+4],
InArray[I][J+3],
InArray[I+1][J],
InArray[I+1][J+1],
2*InArray[I+1][J+3]-InArray[I+1][J+4],
InArray[I+1][J+3],
// notice, too, that each point in the entire third row is
// constrained in this way with respect to the last row and
// to the second row of the next patch. Note the lack of any
// +2 terms in the whole patch definition. We calculated them
// above, but we never use them because we no longer have as
// much freedom as we did before we wanted smoothness.(Ron Parker)
2*InArray[I+3][J]-InArray[I+4][J],
2*InArray[I+3][J+1]-InArray[I+4][J+1],
2*(2*InArray[I+3][J+3]-InArray[I+4][J+3])-(2*InArray[I+3][J+4]-InArray[I+4][J+4]),
2*InArray[I+3][J+3]-InArray[I+4][J+3],
InArray[I+3][J],
InArray[I+3][J+1],
2*InArray[I+3][J+3]-InArray[I+3][J+4],
InArray[I+3][J+3]
pigment {rgb 1}
}
#local J=J+3;
#end //while
#local J=0;
#local I=I+3;
#end //while
#end //macro
#macro ScaleArray(InArray)
#local PH= dimension_size (InArray,1);
#local PC= dimension_size (InArray,2);
#local I= 0;
#local J= 0;
#local Phi= 0;
#while (I<PH)
#while (J<PC)
#local Scale=sin(Phi)+0.5;
#local InArray[I][J]=InArray[I][J]*<Scale,1,Scale>;
#local J= J+1;
#end //while
#local J= 0;
#local Phi=Phi+(pi/(PH-2));
#local I= I+1;
#end //while
#declare OutArray= InArray
#end //macro
#declare S=seed(7);
BuildArray(15,5,25,15)
ScaleArray(OutArray)
union{
BuildPatch(OutArray)
rotate <0,0,90>
translate <7.5,0,0>
}
---%<------%<------%<----
> I was trying to create a grid of 4x4 using bicubic_patch but unfortunately, I
> was unable to figure out how to achieve that. I was able to follow up with the
> documentation and created a 3x3 grid, Any suggestion on how that can be achieved
> would be really helpful.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Aj" <nomail@nomail> wrote:
> Hello everyone,
>
> I was trying to create a grid of 4x4 using bicubic_patch but unfortunately, I
> was unable to figure out how to achieve that. I was able to follow up with the
> documentation and created a 3x3 grid, Any suggestion on how that can be achieved
> would be really helpful.
Do you want a 4 patch by 4 patch (16 patches total), or do you just want your
patch to have a 4x4 grid as its pattern?
The former is going to require some learning about the underlying
Bezier/Bernstein splines that form the patches. I can email you the PDF, which
is currently too large to post as an attachment here (which is why jr can't find
it).
But if all you want is the pattern, then simple replace
> scale 1/3
with scale 1/4
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Aj" <nomail@nomail> wrote:
> > Hello everyone,
> >
> > I was trying to create a grid of 4x4 using bicubic_patch but unfortunately, I
> > was unable to figure out how to achieve that. I was able to follow up with the
> > documentation and created a 3x3 grid, Any suggestion on how that can be achieved
> > would be really helpful.
>
> Do you want a 4 patch by 4 patch (16 patches total), or do you just want your
> patch to have a 4x4 grid as its pattern?
>
> The former is going to require some learning about the underlying
> Bezier/Bernstein splines that form the patches. I can email you the PDF, which
> is currently too large to post as an attachment here (which is why jr can't find
> it).
>
> But if all you want is the pattern, then simple replace
>
> > scale 1/3
>
> with scale 1/4
Thank you so much, I think that has solved the problem.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|