POV-Ray : Newsgroups : povray.advanced-users : Gaussian curvature of a surface Server Time21 Jul 2024 12:34:04 EDT (-0400)
 Gaussian curvature of a surface (Message 1 to 10 of 11)
 From: Bald Eagle Subject: Gaussian curvature of a surface Date: 29 Oct 2022 20:15:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.635dc186688805b11f9dae3025979125%40news.povray.org",
"headline": "Gaussian curvature of a surface",
"dateCreated": "2022-10-30T00:15:00+00:00",
"datePublished": "2022-10-30T00:15:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
After a long hiatus, and extensive delays, a failing 1.5 TB drive, and 2
scrapped laptops,  I reviewed enough calculus and read my collection of
differential geometry books and papers for the 50th time, so that I was able to
grasp enough of what I needed to do mathematically, to implement that in code.

It would make things easier if the nomenclature and symbols were consistent
throughout the literature, and some of the operations were better defined in the
papers themselves.  Some of this was like sticking needles in my eyes.

Less than half of the struggle was the math, which turned out to not be that
difficult at all, and the more than half was descrambling all of the i's and j's
and getting the arrays laid out the right way so that the correct array elements
were getting plugged into the right places.

My analytical surface normals weren't right, but my central difference ones were
(?!) , and so I laid out all the tangents and normals and binormals of the
Frenet-Serret frames, which pointed to my curvature-related math being somehow
flipped across the diagonal with respect to my control points and Bezier
surface.  Ugh.

100 renders later, and I have a pretty hacky scene file that maps the Gaussian
curvature of a Bezier surface.

Never mind your p's and q's, pay detailed attention to your u's and v's!

I'm thinking that there MIGHT be a way to use some of the slope or AOI pigment
patterns to calculate the Frenet-Serret frames or any surface.... but that's
gonna require a lot more B12, coffee, and inner peace to puzzle out.

So, after a final week's struggle, here it is, a year later.
```

Attachments:

Preview of image '2022_surfacecurvatureattempt.png'

 From: Bald Eagle Subject: Re: Gaussian curvature of a surface Date: 29 Oct 2022 20:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.635dc3c46f7bb9f1f9dae3025979125%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-10-30T00:25:00+00:00",
"datePublished": "2022-10-30T00:25:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
Using the same parameters that were calculated to obtain the First and Second
Fundamental Forms of the surface, the mean curvature can be mapped to the
surface as well.
```

Attachments:

Preview of image '2022_surfacecurvatureattempt.png'

 From: Mr Subject: Re: Gaussian curvature of a surface Date: 31 Oct 2022 10:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.635fd4da6f7bb9f16086ed06830a892%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-10-31T14:05:00+00:00",
"datePublished": "2022-10-31T14:05:00+00:00",
"author": {
"@type": "Person",
"name": "Mr"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Using the same parameters that were calculated to obtain the First and Second
> Fundamental Forms of the surface, the mean curvature can be mapped to the
> surface as well.

Could possible use of this if generalized  be ? ...

dirt maps,
wear maps,
AO maps,

how does it differ from current AOI ? Is it able to reach further object space
angles?
```
 From: Bald Eagle Subject: Re: Gaussian curvature of a surface Date: 31 Oct 2022 14:10:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.63600f396f7bb9f1f9dae3025979125%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-10-31T18:10:00+00:00",
"datePublished": "2022-10-31T18:10:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Mr" <m******r******at_hotmail_dot_fr> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > Using the same parameters that were calculated to obtain the First and Second
> > Fundamental Forms of the surface, the mean curvature can be mapped to the
> > surface as well.
>
> Could possible use of this if generalized  be ? ...
>
> dirt maps,
> wear maps,
> AO maps,

Well, it's just an extension of the spline/surface matching that I was doing for
the monograph to make sure everything flows from one spline/surface to another
smoothly - and there are many levels of "smoothness".
Sometimes referred to as "fairing of a surface", techically referred to as C0,
C1, C2, ... and G0, G1, G2 ....

As for what its other possible us is, you know how we roll around here.  People
might adapt it to anything they might think of.

>
> how does it differ from current AOI ?

AOI is just the angle between the surface normal and the camera
position-to-look-at vector.  This is a function pattern that calculates the
curvature of the surface at every vertex (point) of a Bezier patch, given the 16
control points. It answers the (perhaps unasked) question, "How tightly is this
surface curled or dimpled?"

> Is it able to reach further object space angles?

Er.....   I dunno.

Digging about in the archives of my HDD and the forums, I answered my question
about using uv maps and regular textures on the same object - clipka said that
was not currently possible.   :(
I also re-answered my question about using the slope pattern in functions - it
can't be done, because it always returns zero, since it only truly gets
implemented and assigned values once it gets applied to the surface of an
object, under-the-hood.
I also found my re-write of TOK's VPerp_To_Vector macro, which had something to
do with Kenneth and greebles, but in typical fashion, I can't find the original
thread that started all of that.

So, it _might_ be able to be generalized, but it would be (yet another)
source-code level thing - so maybe Jerome Grimbert or Bill Pokorny could make it
happen in their respective forks.

Aside from that, I'm thinking that it could work sort of like the way you've
made carpets from image maps - we'd feed an object into a macro, and build a
surface in a piecewise fashion based on that.  The only way I can currently see
doing that is using trace ().

I have a scene where I can plot the entire Frenet-Serret frame for all the
points on a Bezier surface just using trace (), but at the the moment, the
results are probably only valid because the points are on an axis-aligned grid.

The 2 vectors perpendicular to the normal give me the tangent and binormal,
which I'm treating as du and dv, and I'm assuming that a normalized vector
addition of those will give me duv.  I still need the second partial derivatives
to get the curvature - and I have no real idea how to get that numerically or
geometrically except to do a sort of central differences type thing to assess
the concavity/convexity at each point.

No idea if any of that will work, but in typical fashion, I'll just plow ahead
like a blind bull in a china shop, and see what else I can break.  :D

Attached is my WIP, with the surface texture an average of the x y and z slope
{} patterns, which I was naively hoping to use to encode the surface normal in a
function.

The stock VPerp_To_Vector gave me tangents and binormals pointing every which
way, but the rewrite made them all line up consistently.
```

Attachments:

Preview of image 'surfacepropertiespattern.png'

 From: Bald Eagle Subject: Re: Gaussian curvature of a surface Date: 2 Nov 2022 16:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6362d41a6f7bb9f1f9dae3025979125%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-11-02T20:35:00+00:00",
"datePublished": "2022-11-02T20:35:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Aside from that, I'm thinking that it could work sort of like the way you've
> made carpets from image maps - we'd feed an object into a macro, and build a
> surface in a piecewise fashion based on that.  The only way I can currently see
> doing that is using trace ().
>
> I have a scene where I can plot the entire Frenet-Serret frame for all the
> points on a Bezier surface just using trace (), but at the the moment, the
> results are probably only valid because the points are on an axis-aligned grid.
>
> The 2 vectors perpendicular to the normal give me the tangent and binormal,
> which I'm treating as du and dv, and I'm assuming that a normalized vector
> addition of those will give me duv.  I still need the second partial derivatives
> to get the curvature - and I have no real idea how to get that numerically or
> geometrically except to do a sort of central differences type thing to assess
> the concavity/convexity at each point.
>
> No idea if any of that will work, but in typical fashion, I'll just plow ahead
> like a blind bull in a china shop, and see what else I can break.  :D

So, I rode the struggle bus and after a whole lot of plotting black spheres,
finally jiggled things so that I get some sort of color differentiation.  I
suppose it very loosely resembles the Gaussian curvature render, so it's a step
in the right direction.

It's gonna need to store all of the results in an array so I can get the min &
max and normalize the result for the color map.   But the biggest limitation is
of course the usual problems involving trace () - you just can't get into
overhangs and other occluded areas that the trace () ray hits first.

Probably gonna be one of those things where it's only good for Bezier patches
and parametric objects.   Possibly isosurfaces.
```

Attachments:

Preview of image 'surfacepropertiespattern.png'

 From: jr Subject: Re: Gaussian curvature of a surface Date: 3 Nov 2022 08:20:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6363b0d86f7bb9fc0ce110b6cde94f1%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-11-03T12:20:00+00:00",
"datePublished": "2022-11-03T12:20:00+00:00",
"author": {
"@type": "Person",
"name": "jr"
}
}
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> ...
> So, I rode the struggle bus and after a whole lot of plotting black spheres,
> finally jiggled things so that I get some sort of color differentiation. ...

no idea what it might be "good for" but looks intriguing.  (the 2nd image made
me wonder, could the data be used to simulate something like a marble run :-))

regards, jr.
```
 From: Tor Olav Kristensen Subject: Re: Gaussian curvature of a surface Date: 3 Nov 2022 10:55:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6363d5156f7bb9f4086e33b89db30a9%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-11-03T14:55:00+00:00",
"datePublished": "2022-11-03T14:55:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:
> ...
> I also found my re-write of TOK's VPerp_To_Vector macro, which had something to
> do with Kenneth and greebles, but in typical fashion, I can't find the original
> thread that started all of that.
> ...

I guess that you are looking for this thread:

From: Robert McGregor
Subject: Sci-Fi Scene Assets
Date and time: 2021-02-17 22:25:01

It can be found with this Google search:

;-)

Here's a part in this that thread that seems relevant:

8&moff=37

I posted this message in that thread:

From: Tor Olav Kristensen
Subject: Re: Sci-Fi Scene Assets
Date and time: 2021-04-16 23:55:00

- and some more in this part of the thread:

8&moff=87

From: Bald Eagle
Subject: Re: Sci-Fi Scene Assets
Date and time: 2021-03-01 15:35:06

Btw: Your gaussian curvature work seem interesting.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: Bald Eagle Subject: Re: Gaussian curvature of a surface Date: 3 Nov 2022 19:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.63644e8c6f7bb9f1f9dae3025979125%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-11-03T23:30:00+00:00",
"datePublished": "2022-11-03T23:30:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> It can be found with this Google search:
>

That is totally what I did, in like 7 different ways.   I didn't get that thread
as a search result though.

> Btw: Your gaussian curvature work seem interesting.

Thanks - just needed to clear my head and have enough free time and mental
energy to trudge through all of the steps to get everything to play together
nicely.

I'll have to look into what other surface attributes can be color-mapped.

Wondering if there's a simple/quick way to "reverse uv-map" a curvature-textured
Bezier patch to yield a rectangular image map for further use.
```
 From: Tor Olav Kristensen Subject: Re: Gaussian curvature of a surface Date: 6 Nov 2022 13:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2022-11-06T18:25:00+00:00",
"datePublished": "2022-11-06T18:25:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:
>...
> I'll have to look into what other surface attributes can be color-mapped.
>
> Wondering if there's a simple/quick way to "reverse uv-map" a curvature-textured
> Bezier patch to yield a rectangular image map for further use.

If you are able to store the color for each vertex in an array, then you can
just insert the same colors into a mesh2 within a plane in front of the camera,
with the coordinates within that plane equal to the UV-coordinates for the
colors.

POV-Ray can then interpolate the colors (texture) within each mesh2 triangle in
that plane from the color (texture) for each vertex.

See the last section at this page; about "a texture per vertex":

http://www.povray.org/documentation/view/3.7.1/68/

I did something similar in the TexturedTriangle() macro in this file:

https://github.com/t-o-k/POV-Ray-icosahedron/blob/main/Icosahedron_Coloured.pov

- in this repository:

https://github.com/t-o-k/POV-Ray-icosahedron

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: Bald Eagle Subject: Re: Gaussian curvature of a surface Date: 2 Jun 2023 13:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.647a25126f7bb9f1f9dae3025979125%40news.povray.org",
"headline": "Re: Gaussian curvature of a surface",
"dateCreated": "2023-06-02T17:25:00+00:00",
"datePublished": "2023-06-02T17:25:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"jr" <cre### [at] gmailcom> wrote:

> no idea what it might be "good for" but looks intriguing.  (the 2nd image made
> me wonder, could the data be used to simulate something like a marble run :-))

So, this is a video with information pertaining to Blender, but aside from the
general workflow and texture mapping/layering tricks, what caught my interest
was the "curvature map".