Outline Rendering of 3D Models (POV-Ray)

Perm url with updates: http://xahlee.org/3d/outline_rendering.html

Outline Rendering of 3D Models (POV-Ray)

Xah Lee, 2010-11-09

Here are some images:

Deer POV scene crop small dragon vert mini obj POV scene2 small pose tortoise small crop

Outline rendering of 3D models. Source

The interesting thing about these is that they are computer rendered 3D models (in POV-Ray), not created in 2D drawing programs such as photoshop or Inkscape. Am surprised to learn, that this is not possible with POV-Ray (See: Introduction to POV-Ray) Instead, you have to use a special add-on software.

The outline rendering is significant, because it has a lot applications, especially in illustration or technical drawing. The essence is that this illustration-style shows the important aspects and hides away irrelevant details, such as complex meshes in wireframe rendering or the realism detail from ray-tracing. (much like black'n'white photos make you see the composition) My need for 3D modeling is mostly illustration of geometry, so i really want to render 3D objects like this. (See: Illustrating Geometry with POV-Ray, • Requirements For A Visualization Software System For 2020)

Here's a example of illustration of so-called “stereographic projection”.

sphere proj illus

A illustration done in Mathematica. (See: Stereographic Projection.)

It is rendered in a wireframe mode. Note, a desired rendering, is to actually hide the meshes behind the sphere.

It's somewhat surprising that POV-Ray can't do it, thinking about all the trouble it went thru with ray-tracing. If you think about it, it does make sense, because the essence of illustration-style drawing is a parallel projection from the camera, but realistic 3D rendering is about tracing every light ray to render every point on the object. However, i think the 2 issues are still quite related and is not something totally separate. I think the fact POV-Ray cannot do it is just a particular historical or idiosyncratic reason. Because, for example, when rendering in POV-Ray or any 3D modeler, you have to have algorithms that hide invisible parts. (that is, you shouldn't see what's behind a box) The hiding invisible object algorithm is part of the parallel projection from the camera, same with rendering in outline mode.

Mr monopoly

A screenshot of a character in Second Life (outline renedering in real time).

Note that Second Life (a virtual world 3D “game” application), is capable of outline rendering, in real time. See: Toons in Second Life.

(thanks to namejuseijin for mentioning the POV-Ray outline-rendering add-on.)


Thanks to meowcat for mentioning Penguin3D at. It's a plug-in for Rhinoceros 3D and AutoCAD. It does outline rendering. Penguin3D has a gallery at penguin3d.com. Here's a example:

outline rendering of a mall

A mall, rendered in outline. Animation courtesy of Heath Satow. Source


Wandering Stars

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/sanga_pemci/wandering_stars.html

Wandering Stars

Xah Lee, 2005-05

Title: Wandering Stars
Singer: Beth Gibbons
Lyrics: Beth Gibbons
「• Wandering stars = “... for whom it is reserved”, is a quote from a passage of Western God-believing sect's scripture. The passage connotes punishment, damnation. (See full excerpt at the end of this page.)」
「• needle's eye = Needle's eye refers to the narrow slit hole in the end of a needle, and is a ancient phrase in Western God-believing sect's scripture, as in “... it is easier for a camel to go through the eye of a needle than for a rich man to enter the kingdom of God.”」
「• husk = A shell or outer covering, especially when considered worthless. (AHD)」
Please could you stay awhile to share my grief
For its such a lovely day
To have to always feel this way
And the time that I will suffer less
Is when I never have to wake

Wandering stars, for whom it is reserved
The blackness of darkness forever
Wandering stars, for whom it is reserved
The blackness of darkness forever

Those who have seen the needle's eye, now tread
Like a husk, from which all that was, now has fled
And the masks, that the monsters wear
To feed, upon their prey


Doubled up inside
Take awhile to shed my grief
Always doubled up inside
Taunted, cruel.... ...

Beth Gibbons's Wandering Stars is a depressing fantasy, the cries and joy of masochistic women, happy in the perpetual depression of love. (i ♥ this song)

Note the chorus about “wandering stars for whom it is reserved...” is from the scripture of Western God-Believing sects. Here's a full excerpt of the section containing the line.

Passage of Abrahamic Religion Scripture

「• Jude = Jude, brother of Jesus.」

Jude, the servant of Jesus Christ, and brother of James, to them that are sanctified by God the Father, and preserved in Jesus Christ, and called: Mercy unto you, and peace, and love, be multiplied.

Beloved, when I gave all diligence to write unto you of the common salvation, it was needful for me to write unto you, and exhort you that ye should earnestly contend for the faith which was once delivered unto the saints. For there are certain men crept in unawares, who were before of old ordained to this condemnation, ungodly men, turning the grace of our God into lasciviousness, and denying the only Lord God, and our Lord Jesus Christ.

「• Sodom = A city that was allegedly destroyed along with Gomorrah because of its wickedness and depravity. From which, we have the word Sodomy, refering to ass-fucking or cock-sucking, which has recently become legal activities in United States of America. Sodom and Gomorrah, Lawrence v. Texas.」
「• Michael = The guardian archangel; the field commander of the Army of God. Michael (archangel).」
「• Moses = A prophet, lawgiver, and military commander. Moses.」
「• Cain = The eldest son of Adam and Eve, who murdered his brother Abel out of jealousy and was condemned to be a fugitive. Cain.」
「• Balaam = A prophet, reviled as a “wicked man” in the major story concerning him. Balaam.」
「• Core = A rebel. Korah

I will therefore put you in remembrance, though ye once knew this, how that the Lord, having saved the people out of the land of Egypt, afterward destroyed them that believed not. And the angels which kept not their first estate, but left their own habitation, he hath reserved in everlasting chains under darkness unto the judgment of the great day. Even as Sodom and Gomorrha, and the cities about them in like manner, giving themselves over to fornication, and going after strange flesh, are set forth for an example, suffering the vengeance of eternal fire. Likewise also these filthy dreamers defile the flesh, despise dominion, and speak evil of dignities. Yet Michael the archangel, when contending with the devil he disputed about the body of Moses, durst not bring against him a railing accusation, but said, The Lord rebuke thee. But these speak evil of those things which they know not: but what they know naturally, as brute beasts, in those things they corrupt themselves. Woe unto them! for they have gone in the way of Cain, and ran greedily after the error of Balaam for reward, and perished in the gainsaying of Core.

「• Enoch = A prophet, a descendant of Adam. Enoch.」

These are spots in your feasts of charity, when they feast with you, feeding themselves without fear: clouds they are without water, carried about of winds; trees whose fruit withereth, without fruit, twice dead, plucked up by the roots; Raging waves of the sea, foaming out their own shame; wandering stars, to whom is reserved the blackness of darkness for ever. And Enoch also, the seventh from Adam, prophesied of these, saying, Behold, the Lord cometh with ten thousands of his saints, To execute judgment upon all, and to convince all that are ungodly among them of all their ungodly deeds which they have ungodly committed, and of all their hard speeches which ungodly sinners have spoken against him.

These are murmurers, complainers, walking after their own lusts; and their mouth speaketh great swelling words, having men's persons in admiration because of advantage. But, beloved, remember ye the words which were spoken before of the apostles of our Lord Jesus Christ; How that they told you there should be mockers in the last time, who should walk after their own ungodly lusts.

These be they who separate themselves, sensual, having not the Spirit. But ye, beloved, building up yourselves on your most holy faith, praying in the Holy Ghost, Keep yourselves in the love of God, looking for the mercy of our Lord Jesus Christ unto eternal life. And of some have compassion, making a difference: And others save with fear, pulling them out of the fire; hating even the garment spotted by the flesh. Now unto him that is able to keep you from falling, and to present you faultless before the presence of his glory with exceeding joy, To the only wise God our Saviour, be glory and majesty, dominion and power, both now and ever. Amen.


What's Point-free Programing?

Perm url with updates: http://xahlee.org/comp/point-free_programing.html

What's Point-free Programing?

Xah Lee, 2010-11-07

This page explains what's point-free programing, and how is it possible.

Discovered a new programing language. Factor (programming language). Quote:

Factor is a stack-oriented programming language created by Slava Pestov. Factor is dynamically typed and has automatic memory management, as well as powerful metaprogramming features. The language has a single implementation featuring a self-hosted optimizing compiler and an interactive development environment. The Factor distribution includes a large standard library.

What's interesting is that it's called Concatenative programming language. Quote:

A concatenative programming language is one in which all terms denote functions and the juxtaposition of terms denotes function composition.[dead link][1] The combination of a compositional semantics with a syntax that mirrors such a semantics makes concatenative languages highly amenable to algebraic manipulation and formal analysis.[2]

Basically, it's another interesting advance of functional programing. Now, every “word” is a function, and a sequence of words effective means function chaining or composition. So, it's like a strict postfix or prefix syntax but without operators. (See: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations)

Point-free programming

Another new jargon i learned is Point-free programming (aka “tacit programing”, “pointless programing”). Here's a quote:

Tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition (but not λ-abstraction) instead of variables. The simplicity behind this idea allows its use on several programming languages, such as J programming language and APL and especially in stack or concatenative languages, such as PostScript, Forth, Joy or Factor. Outside of the APL and J communities, tacit programming is referred to as point-free style[1], or more pithily as pointless programming. This is because of the relation between how definitions are done in pointless topology and how they are done in this style.

Basically, what that means is the elimination of formal parameters in function definitions. (similar to what Combinator notation is trying to do.)

How is It Possible to Not Have Variables in Function Definition?

here's a typical form of a function definition (using javascript):

function f(x,y) { return x+y;}

How is it possible to eliminate the variables? How do you specify where the argument goes?

Answer: thru some “tricks” of syntax, and theory of function.

Allow Functions of 1 Parameter Only

First, is to allow definition of functions of 1 parameter only. And all functions in the lang are all just single-parameter functions. This is done in 2 basic ways.

Multi-parameter as a List

The most simple way, is to consider multi-parameters function as function of a single parameter of a list. So, for example, if you need to define 「f(x,y)」, you can define it as a function that takes a list 「f(mylist)」, where the “mylist” is a list of 2 elements.

Function De-composition (aka Currying)

We'll discuss this later, below.

Linear Notation

Once the language allows only function of 1 parameter, then the syntax can be made into a linear form, either as prefix or postfix, and the paren to mark parameters are no longer necessary. The following are examples of linear syntax.

The most familiar linear notation is unix pipe. For exmaple:

x | h | g | f

means 「f(g(h(x)))」 or in lisp nested notation as 「(f (g (h x)))」.

In other functional languages, this can be written simply as:

f g h x


x h g f

In the above, the space is a implicit operator, meaning function application.

In some lang with object oriented flavor, a “dot” syntax is popular (e.g. javascript, ruby, java), like this:


or like this (perl):

x -> h -> g-> h

Those starting with the argument x and apply functions from left to right (e.g. 「x h g f」), are postfix notations, because argument comes first, functions come after. Those starting with argument at the right (e.g. 「f g h x」) are prefix notations. (See: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations)

Here's Mathematica's prefix syntax:

f @ g @ h @ x

And the following is Mathematica's postfix syntax:

x // h // g // f

Dropping the Parameter

Now, if a functional lang allows only functions of one single parameter, and if its syntax is a uniform prefix or postfix linear syntax, then a function definition may be like this in postfix notation:

# square function

or prefix notation:

function square #

This defines a function that squares a number. That is, it computes “x^2”. Now, notice, that every function definition will always have a dummy variable at the end of the line. So, it is syntactically redundant. We can simply drop it, and change the semantics of the “function” keyword to always assume there's a parameter.

Function Decomposition (Currying)

There is another technique for point-free programing syntax, by the theory of function decomposition. That is, instead of requiring multi-parameter function to take a list as argument, the lang automatically decompose any function of multi-parameter into a sequence of 1-param function application. (aka function chaining)

Suppose you have a function of 2 parameters 「(f x y)」 (using lisp syntax here). Here, the “x” and “y” are called formal parameters (aka dummy variables). In a trivial math theory, any function of 2 parameters can be reduced to sequential application of functions of 1 parameter. That is, for any function f of 2 parameters, there exist functions g and h, such that 「(f x y) = ((g x) y)」, where the result of 「(g x)」 is a function we'll call “h”, and result of 「(h y)」 will equal to 「(f x y)」.

It's hard to think how could one concretly define g, or what g could be in some abstract function mapping model, but it's easy to think of it as the result of evaluating f with one of its parameter assumed as a constant. When you evaluate f with one of its parameter given, say 「(f 2 y)」 you get a function with 1 single parameter the y. That's your h, which is g evaluated at 2: 「(g 2)」.

(The process of de-composing function is sometimes called “currying” in computer science. (See: What is Currying in a Computer Language?))

By this argument of reducing 2 parameters to 1, it follows that a function of n parameters can be expressed by a composition of functions that all have just 1 parameter. In other words, functions with 1 parameter is all you need, when thinking about the theoretical aspects of functions.

Languages like Haskell and OCaml, functions of multiple parameters are automatically de-composed into a sequence of functions of 1 parameter, in the syntax as well as at compiler level. In fact, the syntax used to define multi-param function, is just a variant syntax that is syntactically equivalent to the syntax for sequential application functions of 1 parameter. (See: OCaml Tutorial: Function )

So now, the task of making point-free syntax for function definition, is reduced to making a syntax for functions of 1 variable, but without using a symbol to represent dummy variable at all. This is now trivial, because you simply don't need to write that dummy variable, and always assume there's a variable to go with the function.

For example, in 「(function (x) (g (f x)))」, we have in traditional math notation 「 f(x) := g(f(x))」. Now, since all functions have just 1 parameter, we simply don't need to write it anymore. So, we write 「(function (g (f)))」, and it's assumed that in the deepest level it's always a function, and some argument is to be fed to it.

In functonal langs like Haskell, OCaml, Mathematica, they have prefix or postfix syntax. For example, 「g f x」 means 「(g (f x))」. In this linear syntax, with point-free style, you simply don't need to write the x anymore, because it's always just the last part. You automatically assume the last part will be a argument. So you simply write 「g f」.


Here's a few things to remember what “point-free programing” is:

  • It is about a particular syntax for function definition.
  • When defining a function, no symbol is used for function parameter.

And this syntax is made possible by:

  • All functions in the lang are functions of one parameter only.
  • Support linear notation. (prefix or postfix)

And allowing function of 1 parameter only is made possible by:

  • Multi-param are just functions of 1 param of a list (APL, J).
  • Support function decomposition (OCaml, Haskell)

花样的年华 (Age of Blossom)

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/sanga_pemci/hua3yang4nian2hua2.html

花样的年华 (Age of Blossom)

Xah Recommends:
iPod Nano
iPod Nano

Xah Lee, 2005-04, 2010-11-07

Title: 花樣的年華 (from movie 《长相思》)
Lyrics: 范烟橋
Music: 陈歌辛
Date: 1946
Singer: 周璇
Translation: 李杀 (Xah Lee)






an age of blossom
affectionate as the moon

bright as the snow
splendid is living

caring is spring water
in union are families

the lonely islands in the graveyard,
shrouded in torn clouds and grief-stricken mists 

O my dearly beloved country,
when would i be in your embrace

to see clouds dissipate
and see you shine again

an age of blossom
affectionate as the moon

Clip of from the movie 长相思. Amazon music at amazon

The Poem

Note the sudden twist in this poem.

I was listening to this song and like it fairly and have been listening to it repeatedly. Though, i was not quite sure what it is singing. I thought it is a song for lovers. Then, i searched and found the lyrics.

Note how the lyrics made a about-face at line 7: “the lonely islands in the graveyard...” This immediately changed the nature of the poem. All lines before that is tame and serene. The “torn clouds and grief-stricken mist” drives the misery into the readers in a terse dismay. Then, the next line “O my dearly beloved country...” is another sharp twist that immediately adds the context, to the misery of the previous line, and as well as fixing the beginning six serene lines into a sublimely beautiful quality by context. Such lines as these (8th, 9th) have incredible weight, making this a heavy poem.

Now if we go back and look at the beginning serene lines. “An Age of Blossom, affectionate as the moon”. When lives are at stake, one does not wish to have lots of money or fancy cars, but as simple as a loving and prosperous society. “Bright as snow, splendid is living”. How the good things are chosen to be cited tells us a lot about the wisher's situation. Note the way it is said: “splendid is living”, as oppose to, say, “all are rich”, or “life is great”, or “party every day”. The next line “caring is spring water”. This is a critical verse, because of all needs and desires in a human animal, nothing is more precious than clean, drinkable water. This fact cannot be known until subsistence is on the brink. Then “in union are families”, again, a universal yearning not to surface in peace time.

Note: there's some discrepancies in the lyrics that i wasn't sure which is correct. In the line 月样的情深, alternative version found on the web is 月样的精神, which seems to be the phrase sung. Also, i used 冰雪样的聰颖 and there's 冰雪樣的聰明, and i used 多情的泉 水 and elsewhere i've found 多情的眷顾. In all cases, i prefer the one i used. Not sure which ones are the original lyrics. If you know, please let me know.

Wartime China

This song says so much. It is sung by 周璇 (Zhou Xuan, 1918-1957), a Shanghai superstar. During the early 1900s, China was in a state of devastation, besieged by Western invasions, World War Two with Japan , and more civil wars. Modern people in affluent states couldn't imagine this, especially the fat WASPs in USA. In such a era, one lives in blood, in famine, in broken families, missing members and limbs, in perpetual flight and fear. This song is very sad, sung by a feminine high-pitched style idiosyncratic to Shanghai. In this era, there are many such songs like this, usually in a extremely beautiful, serene, tune, and the lyrics are often exceedingly sad in a poetic way. (many of these are de facto poems) The contents are often about separation, or the wish for peace and union. Many songs of sexual love are also in this bleak, masochistic depressive style.

As time moved on, eras and sentiments come and go. Songs like this do not get written as much today, but the devastation of war and misery have left a indelible mark in Chinese people, still can be seen in their thoughts, aspirations, culture, and songs today. (after Nationalist/Communist Civil War, then China is devastated by Great Leap Forward and Cultural Revolution of Mao).

It is interesting a psychological phenomenon, where one will like what's deep in a person's life. As in, if one suffers thru hardship, one tends to like songs that sang their wishes and dreams. A culture sacked by prolonged war, will not, for example, develop into Rock'n'Roll or Heavy Metal. In other words, different era and cultural make up instigates its music. Here, we might presume that Heavy Metal, was born in a environment of rich boredom and modern technology.

baby sitting alone in a rail track among destruction

A very popular photo, of a baby sitting amidst destruction, published by LIFE magazine . (photo may depict Shanghai in 1937. The LIFE Mag publication date may be 1937-10-04.)

Singer Zhou Xuan

Zhou Xuan

Photo of the singer, Zhou Xuan (周璇 1918-1957).

Zhou Xuan herself is a interesting story. She was a orphan, and throughout her life she searched for her parents to no avail. Although a superstar, she did not live a happy life, and ended up in a mental institution and died young. For more info about the singer, see Zhou Xuan (周璇)

For some other wartime era songs of this period, see:

Apocalypse Now; Ride of the Valkyries

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/skina/apocalypse_now.html

Apocalypse Now; Ride of the Valkyries

Xah Lee, 2010-11-06

apocalypse now poster

Apocalypse Now amazon

Apocalypse Now (1979).

The helicopter scene.

The music is “The Ride Of The Valkyries” amazon by Richard Wagner.

What is a Valkyrie? Quote:

In Norse mythology, a valkyrie (from Old Norse valkyrja “chooser of the slain”) is one of a host of female figures who decide who will die in battle.

Valkyrie on horse

«Valkyrie On Horse Statue of a warlike valkyrie, riding a horse and carrying a spear. Labeled as “SINDING VALKYRIE” and located in a roadside park in Copenhagen, Denmark.» Source

Walkyrien by Emil Doepler

Walkyrien by Emil Doepler. Source