<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.povray.org/content?action=history&amp;feed=atom&amp;title=Reference%3ABicubic_Patch</id>
	<title>Reference:Bicubic Patch - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.povray.org/content?action=history&amp;feed=atom&amp;title=Reference%3ABicubic_Patch"/>
	<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=Reference:Bicubic_Patch&amp;action=history"/>
	<updated>2026-04-06T20:10:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.povray.org/content?title=Reference:Bicubic_Patch&amp;diff=6766&amp;oldid=prev</id>
		<title>Jholsenback: 1 revision: Reference Migration Initial Load</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=Reference:Bicubic_Patch&amp;diff=6766&amp;oldid=prev"/>
		<updated>2012-03-15T19:05:05Z</updated>

		<summary type="html">&lt;p&gt;1 revision: Reference Migration Initial Load&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:05, 15 March 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Jholsenback</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=Reference:Bicubic_Patch&amp;diff=6765&amp;oldid=prev</id>
		<title>Jholsenback: 1 revision: Initial Load (TF)</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=Reference:Bicubic_Patch&amp;diff=6765&amp;oldid=prev"/>
		<updated>2012-03-11T22:27:03Z</updated>

		<summary type="html">&lt;p&gt;1 revision: Initial Load (TF)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Objects]]&lt;br /&gt;
[[Category:Finite Patch Primitives]]&lt;br /&gt;
{{#indexentry:bezier}}&lt;br /&gt;
{{#indexentry:bezier patch}}&lt;br /&gt;
{{#indexentry:bicubic_patch, keyword}}&lt;br /&gt;
{{#indexentry:keyword, bicubic_patch}}&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;code&amp;gt;bicubic_patch&amp;lt;/code&amp;gt; is a 3D curved surface created from a mesh of&lt;br /&gt;
triangles. POV-Ray supports a type of bicubic patch called a &amp;lt;em&amp;gt;Bezier&lt;br /&gt;
patch&amp;lt;/em&amp;gt;. A bicubic patch is defined as follows:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BICUBIC_PATCH:&lt;br /&gt;
  bicubic_patch {&lt;br /&gt;
    PATCH_ITEMS...&lt;br /&gt;
    &amp;amp;lt;Point_1&amp;amp;gt;,&amp;amp;lt;Point_2&amp;amp;gt;,&amp;amp;lt;Point_3&amp;amp;gt;,&amp;amp;lt;Point_4&amp;amp;gt;,&lt;br /&gt;
    &amp;amp;lt;Point_5&amp;amp;gt;,&amp;amp;lt;Point_6&amp;amp;gt;,&amp;amp;lt;Point_7&amp;amp;gt;,&amp;amp;lt;Point_8&amp;amp;gt;,&lt;br /&gt;
    &amp;amp;lt;Point_9&amp;amp;gt;,&amp;amp;lt;Point_10&amp;amp;gt;,&amp;amp;lt;Point_11&amp;amp;gt;,&amp;amp;lt;Point_12&amp;amp;gt;,&lt;br /&gt;
    &amp;amp;lt;Point_13&amp;amp;gt;,&amp;amp;lt;Point_14&amp;amp;gt;,&amp;amp;lt;Point_15&amp;amp;gt;,&amp;amp;lt;Point_16&amp;amp;gt;&lt;br /&gt;
    [OBJECT_MODIFIERS...]&lt;br /&gt;
    }&lt;br /&gt;
PATCH_ITEMS:&lt;br /&gt;
  type Patch_Type | u_steps Num_U_Steps | v_steps Num_V_Steps |&lt;br /&gt;
  flatness Flatness&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{#indexentry:default values, bicubic_patch}}&lt;br /&gt;
&amp;lt;p&amp;gt;Bicubic patch default values:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flatness : 0.0&lt;br /&gt;
u_steps  : 0&lt;br /&gt;
v_steps  : 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{#indexentry:type, bicubic_patch}}&lt;br /&gt;
{{#indexentry:keyword, type}}&lt;br /&gt;
&amp;lt;p&amp;gt;The keyword &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; is followed by a float &amp;lt;em&amp;gt;&amp;lt;code&amp;gt;&lt;br /&gt;
Patch_Type&amp;lt;/code&amp;gt;&amp;lt;/em&amp;gt; which currently must be either 0 or 1. For type 0 only&lt;br /&gt;
the control points are retained within POV-Ray. This means that a minimal&lt;br /&gt;
amount of memory is needed but POV-Ray will need to perform many extra&lt;br /&gt;
calculations when trying to render the patch. Type 1 preprocesses the patch&lt;br /&gt;
into many subpatches. This results in a significant speedup in rendering at&lt;br /&gt;
the cost of memory.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{#indexentry:u_steps, bicubic_patch}}&lt;br /&gt;
{{#indexentry:keyword, u_steps}} &lt;br /&gt;
{{#indexentry:v_steps, bicubic_patch}}&lt;br /&gt;
{{#indexentry:keyword, v_steps}} &lt;br /&gt;
{{#indexentry:flatness, bicubic_patch}}&lt;br /&gt;
{{#indexentry:keyword, flatness}}&lt;br /&gt;
&amp;lt;p&amp;gt;The four parameters &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flatness&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&lt;br /&gt;
u_steps&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;v_steps&amp;lt;/code&amp;gt; may appear in any order. Only&lt;br /&gt;
&amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; is required. They are followed by 16 vectors (4 rows&lt;br /&gt;
of 4) that define the x, y, z coordinates of the 16 control points which&lt;br /&gt;
define the patch. The patch touches the four corner points &amp;lt;em&amp;gt;&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;Point_1&amp;amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/em&amp;gt;, &amp;lt;em&amp;gt;&amp;lt;code&amp;gt;&amp;amp;lt;Point_4&amp;amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/em&amp;gt;, &amp;lt;em&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;Point_13&amp;amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/em&amp;gt; and &amp;lt;em&amp;gt; &amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;Point_16&amp;amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/em&amp;gt; while the other 12 points pull and stretch the&lt;br /&gt;
patch into shape. The Bezier surface is enclosed by the convex hull formed by&lt;br /&gt;
the 16 control points, this is known as the &amp;lt;em&amp;gt;convex hull property&amp;lt;/em&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The keywords &amp;lt;code&amp;gt;u_steps&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;v_steps&amp;lt;/code&amp;gt; are each followed&lt;br /&gt;
by integer values which tell how many rows and columns of triangles are the&lt;br /&gt;
minimum to use to create the surface, both default to 0. The maximum number of individual pieces&lt;br /&gt;
of the patch that are tested by POV-Ray can be calculated from the following:&lt;br /&gt;
&amp;lt;em&amp;gt;pieces = 2^u_steps * 2^v_steps&amp;lt;/em&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This means that you really should keep &amp;lt;code&amp;gt;u_steps&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&lt;br /&gt;
v_steps&amp;lt;/code&amp;gt; under 4. Most patches look just fine with &amp;lt;code&amp;gt;u_steps&lt;br /&gt;
3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;v_steps 3&amp;lt;/code&amp;gt;, which translates to 64 sub-patches (128&lt;br /&gt;
smooth triangles).&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;As POV-Ray processes the Bezier patch it makes a test of the current piece&lt;br /&gt;
of the patch to see if it is flat enough to just pretend it is a rectangle.&lt;br /&gt;
The statement that controls this test is specified with the &amp;lt;code&amp;gt;&lt;br /&gt;
flatness&amp;lt;/code&amp;gt; keyword followed by a float. Typical flatness values range&lt;br /&gt;
from 0 to 1 (the lower the slower). The default if none is specified is&lt;br /&gt;
0.0.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;If the value for flatness is 0 POV-Ray will always subdivide the patch to&lt;br /&gt;
the extend specified by &amp;lt;code&amp;gt;u_steps&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;v_steps&amp;lt;/code&amp;gt;. If&lt;br /&gt;
flatness is greater than 0 then every time the patch is split, POV-Ray will&lt;br /&gt;
check to see if there is any need to split further.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;There are both advantages and disadvantages to using a non-zero flatness.&lt;br /&gt;
The advantages include:&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;- If the patch is not very curved, then this will be detected and&lt;br /&gt;
POV-Ray will not waste a lot of time looking at the wrong pieces.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;- If the patch is only highly curved in a couple of places, POV-Ray will keep&lt;br /&gt;
subdividing there and concentrate its efforts on the hard part.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The biggest disadvantage is that if POV-Ray stops subdividing at a&lt;br /&gt;
particular level on one part of the patch and at a different level on an&lt;br /&gt;
adjacent part of the patch there is the potential for cracking. This is&lt;br /&gt;
typically visible as spots within the patch where you can see through. How&lt;br /&gt;
bad this appears depends very highly on the angle at which you are viewing&lt;br /&gt;
the patch.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Like triangles, the bicubic patch is not meant to be generated by hand. These&lt;br /&gt;
shapes should be created by a special utility. You may be able to acquire&lt;br /&gt;
utilities to generate these shapes from the same source from which you&lt;br /&gt;
obtained POV-Ray. Here is an example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bicubic_patch {&lt;br /&gt;
  type 0&lt;br /&gt;
  flatness 0.01&lt;br /&gt;
  u_steps 4&lt;br /&gt;
  v_steps 4&lt;br /&gt;
  &amp;amp;lt;0, 0, 2&amp;amp;gt;, &amp;amp;lt;1, 0, 0&amp;amp;gt;, &amp;amp;lt;2, 0, 0&amp;amp;gt;, &amp;amp;lt;3, 0,-2&amp;amp;gt;,&lt;br /&gt;
  &amp;amp;lt;0, 1  0&amp;amp;gt;, &amp;amp;lt;1, 1, 0&amp;amp;gt;, &amp;amp;lt;2, 1, 0&amp;amp;gt;, &amp;amp;lt;3, 1, 0&amp;amp;gt;,&lt;br /&gt;
  &amp;amp;lt;0, 2, 0&amp;amp;gt;, &amp;amp;lt;1, 2, 0&amp;amp;gt;, &amp;amp;lt;2, 2, 0&amp;amp;gt;, &amp;amp;lt;3, 2, 0&amp;amp;gt;,&lt;br /&gt;
  &amp;amp;lt;0, 3, 2&amp;amp;gt;, &amp;amp;lt;1, 3, 0&amp;amp;gt;, &amp;amp;lt;2, 3, 0&amp;amp;gt;, &amp;amp;lt;3, 3, -2&amp;amp;gt;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The triangles in a POV-Ray &amp;lt;code&amp;gt;bicubic_patch&amp;lt;/code&amp;gt; are automatically&lt;br /&gt;
smoothed using normal interpolation but it is up to the user (or the&lt;br /&gt;
user's utility program) to create control points which smoothly stitch&lt;br /&gt;
together groups of patches.&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jholsenback</name></author>
	</entry>
</feed>