Conquering JavaScript: Three.js Sufyan Bin Uzayr - Download the ebook now and own the full detailed content
Conquering JavaScript: Three.js Sufyan Bin Uzayr - Download the ebook now and own the full detailed content
com
https://ebookmeta.com/product/conquering-javascript-three-
js-sufyan-bin-uzayr/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookmeta.com/product/conquering-javascript-d3-js-sufyan-bin-
uzayr/
ebookmeta.com
https://ebookmeta.com/product/javascript-frameworks-for-modern-web-
development-2nd-edition-sufyan-bin-uzayr/
ebookmeta.com
https://ebookmeta.com/product/vuepress-quick-start-guide-sufyan-bin-
uzayr/
ebookmeta.com
https://ebookmeta.com/product/young-people-with-migrant-parents-oecd-
publishing/
ebookmeta.com
Growing Up Smith Indian Recipes Every American Will Love
Indian Recipes with Some American Flair 1st Edition Dan
Babel
https://ebookmeta.com/product/growing-up-smith-indian-recipes-every-
american-will-love-indian-recipes-with-some-american-flair-1st-
edition-dan-babel/
ebookmeta.com
https://ebookmeta.com/product/forgotten-people-forgotten-diseases-3rd-
edition-peter-j-hotez/
ebookmeta.com
https://ebookmeta.com/product/wills-estate-planning-for-canadians-for-
dummies-3rd-edition-joann-kurtz-jd/
ebookmeta.com
https://ebookmeta.com/product/authorizing-early-modern-european-women-
from-biography-to-biofiction-1st-edition-james-fitzmaurice/
ebookmeta.com
Demand Forecasting Best Practices (MEAP V02) Nicolas
Vandeput
https://ebookmeta.com/product/demand-forecasting-best-practices-
meap-v02-nicolas-vandeput/
ebookmeta.com
Conquering JavaScript
Have you ever considered how these visuals and games are shown in a web browser? What
technology is at the heart of it? Of course, employing HTML and CSS alone will not be suf-
ficient. Three.js is a free JavaScript toolkit for displaying images, 3D, and 2D objects in web
browsers that enables you to render graphics and 3D objects on a canvas in the web browser
using your GPU (Graphics Processing Unit).
Conquering JavaScript: Three.js helps the reader master the Three.js framework for faster and
robust development. The book is a detailed guide that will help developers and coders do
more with Three.js. It covers the basics in brief, and then moves on to more advanced and
detailed exercises to help readers quickly gain the required knowledge.
Key Features:
This book is a valuable reference for Three.js developers as well as those involved in game
development, mobile apps, progressive applications, and now even desktop apps.
About the Series
https://w w w.routledge.com/Conquering-JavaScript/book-series/
CRCCONJAV
Conquering JavaScript
Three.js
Edited by
Sufyan bin Uzayr
First edition published 2024
by CRC Press
2385 Executive Center Drive, Suite 320, Boca Raton, FL 33431
and by CRC Press
4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN
CRC Press is an imprint of Taylor & Francis Group, LLC
© 2024 Sufyan bin Uzayr
Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of their use.
The authors and publishers have attempted to trace the copyright holders of all material reproduced in
this publication and apologize to copyright holders if permission to publish in this form has not been
obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information
storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access www.copyright.com
or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923,
978-750-8400. For works that are not available on CCC please contact mpkbookspermissions@tandf.co.uk
Trademark Notice: Product or corporate names may be trademarks or registered trademarks and are
used only for identification and explanation without intent to infringe.
DOI: 10.1201/9781003357445
Typeset in Minion
by KnowledgeWorks Global Ltd.
For Dad
Contents
vii
viii ◾ Contents
Servez 29
A Five-Server Node.js 29
Http-Server in Node.js 29
Server in Python 29
Ruby Server 30
Lighttpd 30
IIS 30
FUNDAMENTALS 31
Primitives 31
Box Geometry 31
Flat Circle 31
Solid Cone 32
Cylinder 32
dodecahedron 33
Two Dimension (2D) 33
2D Disc with the Hole in Center 34
Text Geometry 34
Edge Geometry 34
WireframeGeometry 35
Scene Graph 36
MATERIALS 43
TEXTURES 45
Hello Texture 45
Texture Loading Made Simple 45
A Texture Is Being Loaded 45
Textures from Other Sources Are Being Loaded 46
MEMORY UTILIZATION 46
PNG versus JPG 46
TEXTURE REPETITION, OFFSET, ROTATION, AND
WRAPPING 47
Lights 48
x ◾ Contents
AmbientLight 49
HemisphereLight 50
DirectionalLight 50
PointLight 51
SpotLights 51
RectAreaLight 51
CAMERAS 51
Shadows 52
BufferGeometry Custom 52
KEY FEATURES OF Three.js 52
Effects 53
Scenes 53
Animation 53
Mesh Creation 53
Scaling 53
Render 53
Within Three.js, You Can Track Rendering Performance 54
Materials 54
Properties of Common Objects 54
RECAP OF BASICS 54
SUMMARY 55
NOTES 56
Shadows 165
Materials 165
CUSTOM MATERIALS 165
Geometry 165
Textures 166
Anti-Aliasing 166
Postprocessing 166
ARE YOU GETTING RID OF SOMETHING
FROM YOUR SCENE? 166
Set Object in Performance 167
Advanced Tips 168
SUMMARY 168
NOTES 168
BIBLIOGRAPHY, 185
INDEX, 187
About the Editor
Sufyan bin Uzayr is a writer, coder, and entrepreneur with over a decade of
experience in the industry. He has authored several books in the past, per-
taining to a diverse range of topics, ranging from History to Computers/
IT.
Sufyan is the Director of Parakozm, a multinational IT company spe-
cializing in EdTech solutions. He also runs Zeba Academy, an online
learning and teaching vertical with a focus on STEM fields.
Sufyan specializes in a wide variety of technologies, such as JavaScript,
Dart, WordPress, Drupal, Linux, and Python. He holds multiple degrees,
including ones in Management, IT, Literature, and Political Science.
Sufyan is a digital nomad, dividing his time between four countries. He
has lived and taught in numerous universities and educational institutions
around the globe. Sufyan takes a keen interest in technology, politics, lit-
erature, history, and sports, and in his spare time, he enjoys teaching cod-
ing and English to young students.
Learn more at sufyanism.com
xvi
Acknowledgments
There are many people who deserve to be on this page, for this book would
not have come into existence without their support. That said, some names
deserve a special mention, and I am genuinely grateful to:
xvii
Zeba Academy –
Conquering JavaScript
• Divya Sachdeva
• Jaskiran Kaur
• Simran Rao
• Aruqqa Khateib
• Suleymen Fez
• Ibbi Yasmin
• Alexander Izbassar
Zeba Academy is an EdTech venture that develops courses and content for
learners primarily in STEM fields and offers educational consulting and
mentorship to learners and educators worldwide.
xviii
Chapter 1
Introduction
IN THIS CHAPTER
This chapter includes an introductory part that will explore the basic and
core concepts related to Three.js. It will also talk about the advantages and
disadvantages of Three.js.
Every year, web browsers become more powerful, have more capabil-
ities, and perform better. Browsers have grown as a terrific platform for
creating immersive, complicated, and beautiful applications in recent
years. Modern HTML5 technologies like web sockets, local storage, and
advanced CSS approaches for styling are used in the majority of cur-
rent applications. Most recent browsers, on the other hand, support a
technology that may be utilized to produce stunning 3D images and
animations that take full advantage of the GPU (graphics processing
unit). WebGL is the name of the technology, which is supported by the
most recent versions of Firefox, Chrome, Safari, and Internet Explorer.
You may use WebGL to create 3D sceneries that run in your browser
without the use of any plugins. This standard has a lot of support on the
desktop and most recent devices and mobile browsers fully support it.
To make WebGL apps, you’ll need to learn a new language called GLSL
DOI: 10.1201/9781003357445-1 1
2 ◾ Conquering JavaScript: Three.js
and grasp how to use vertex and fragment shaders to render your 3D
geometries.
Fortunately, there are several JavaScript libraries that wrap the WebGL
internals and give a JavaScript API that you may use without having to
comprehend WebGL’s most complicated capabilities. Three.js is one of the
most developed and feature-rich of these libraries.
Three.js was founded in 2010 and offers a huge variety of simple APIs
that expose all of Three.js’ functionality, allowing you to quickly create
complex 3D scenarios and animations in your browser.
Three.js’ APIs allow you to do pretty much anything you want with it.
WHAT IS Three.js?
Three.js is a free JavaScript toolkit for displaying images, 3D, and 2D
objects in web browsers. Behind the scenes, it leverages WebGL API. Three.
js enables you to render graphics and 3D objects on a canvas in the web
browser using your GPU. We can also interact with other HTML compo-
nents because we are utilizing JavaScript. In April 2010, Ricardo Cabello,
computer graphics programmer from Barcelona launched Three.js.
Three.js can be downloaded and the documentation can be found at
https://threejs.org. Because it includes numerous examples and support
materials, the download is fairly huge. Three.js’ primary functionalities
Introduction ◾ 3
are defined in a single huge JavaScript file called “Three.js,” which can be
found in the Three.js download’s build directory.
element. If three.min.js is in the same folder as the web page, for example,
the script element would be
<script src="three.min.js"></script>
• Three.js,
• three.min.js, and
• three.module.js.
npm i three
Then, by referring to the three packages, you may import Three.js from
the three.module.js file into your JavaScript file: (“Introduction to Three.
js – GeeksforGeeks”)
You may also add the package using the following command in the
terminal window if you prefer Yarn to NPM:
<script src="https://threejs.org/build/three.js">
</script>
• cdnjs.com
• www.jsdelivr.com
A Computer
First and foremost, you will require a computer; but it does not need to be
fast, fancy, or equipped with a strong graphics card. It might be better to
have a slow PC with a bad GPU because you’ll be able to experience your
programs the same way the majority of your users do.
Three.js Developer
As a Three.js developer, you’ll require a basic understanding of HTML and
CSS, as well as some JavaScript. You do not have to be a professional in any
of these fields, though.
Web Browser
Almost any online browser can execute Three.js, and the percentage of
outdated browsers that can’t is small and shrinking fast. You can even run
a Three.js app on Internet Explorer 9, which was published in 2011 and
only accounts for less than 0.1% of all web users at the time of writing this
chapter. The majority of people nowadays use a modern browser to access
the Internet, so browser support isn’t a concern.
You can also run Three.js programs in a variety of exotic settings, such
as Node.js, Electron.js, or React Native; however, this requires some effort
and is beyond the scope of this book. We’ll concentrate on using modern
web browsers like Firefox, Chrome, Edge, and Safari to execute your app.
Web Server
Any JavaScript mentioned in an HTML file will run when opened directly
in a web browser. This is how many simple Three.js examples work. Due
to browser security restrictions, you cannot load graphics or 3D models
without first setting up a web server. You need to establish a local devel-
opment server if you wish to run a Three.js scene with assets like mod-
els or textures. All of the examples in this book use a fancy custom-built
inline code editor within the page to bypass this requirement, but you’ll
need to set up a server once you start constructing your own apps. Many
simple web servers for development are available. These are simple to put
up; however, they can only accommodate a small number of simultaneous
visitors. They are, nevertheless, ideal for testing your work locally before
publishing it. When you’re ready to launch your website, you’ll switch to a
high-performance production server like Apache or Nginx (pronounced
engine-x, apparently).
These can accommodate hundreds or even millions of simultaneous
visitors to your site, but they are difficult to set up. Fortunately, there are
numerous web hosting businesses that can handle this for you. When
you’re ready to set up a development server, consult the Three.js docu-
mentation’s how to run things locally guide, which contains a wealth of
information on the subject.
development, and it’s typically the only one you’ll need. Every major
browser includes one, which you can normally access by using the F12 key.
WebGL-Supported Device
WebGL is a programmable interface, or JavaScript API, for generating
dynamic 2D and 3D graphics in web pages. WebGL connects your web
browser to your device’s graphics hardware, giving you significantly more
graphical processing power than a standard website can offer.
WebGL is utilized by Three.js to display 3D visuals, but it can also be
used for 2D graphics, as in Alexander Perrin’s wonderful Short Trip, or
even General Purpose GPU computing, as in these flocking behavior and
protoplanetary examples.
To use WebGL, you’ll need a compatible device and browser. This was
once something to be concerned about, but nowadays you can assume that
all devices support WebGL and that every current smartphone, tablet, PC,
laptop, and even smartwatch has a graphics card capable of executing a
simple 3D scene. According to caniuse.com and webglstats.com, roughly
98% of Internet users use WebGL-compatible devices at the time of writ-
ing this chapter. If you do need to support the last 2%, the WebGL com-
patibility check explains how to deliver a fallback or warning message to
users whose devices don’t support WebGL.
This is a great illustration of how Three.js can be used to not only create
virtual experiences but also to construct businesses based on 3D design.
Advantages
We have now learned a lot about the Three.js; so here are few advantages
that are mentioned below:
Disadvantages
Three.js is associated with few disadvantages that are mentioned below:
CORE CONCEPT
Three.js is a free JavaScript library that lets you create and render three-
dimensional scenarios right in your browser. Three.js has a big collec-
tion of functions and a rich API for this. Three.js is a 3D toolkit that
aims to make displaying 3D material on a webpage as simple as pos-
sible. Three.js’ source code is available on a GitHub repository. JavaScript
can be used to create GPU-accelerated 3D animations. Three.js is fre-
quently confused with WebGL since it frequently, but not always, uses
WebGL to draw 3D. WebGL is a low-level graphics system that can only
draw points, lines, and triangles. To achieve anything worthwhile with
WebGL, you’ll almost always need a lot of code, which is where Three.js
comes in. Scenes, lights, shadows, materials, textures, and 3d math are
all handled by it, which you’d have to code yourself if you used WebGL
directly.
Let’s start by trying to give you an understanding of how a Three.js
project is structured. A Three.js project necessitates the creation of a num-
ber of objects and their connections.
ADAPTIVE DESIGN
It will teach you how to make your Three.js app respond to any cir-
cumstance. Making a webpage responsive means that it works effec-
tively on a variety of screen sizes, from computers to tablets to phones.
There are even more scenarios to explore with Three.js. We might want
to handle a 3D editor with controls on the left, right, top, or bottom,
for example. Another example is a live diagram in the center of a docu-
ment. We used a plain canvas with no CSS and no size in the previous
example.
<canvas id="c"></canvas>
The default canvas size is 300 × 150 CSS pixels. CSS is the recommended
method for setting the size of something on the web platform.
Introduction ◾ 13
<style>
html, body {
margin: 0;
height: 100%;
}
#c {
width: 100%;
height: 100%;
display: block;
}
</style>
function render(time) {
time *= 0.001;
14 ◾ Conquering JavaScript: Three.js
The result can be visualized on the page.2 Now let us fix the problem of
blockiness.
There are two sizes of canvas elements. The canvas is presented on the
page in a single size. That’s what CSS allows us to do. The amount of pixels
in the canvas itself is the other size. This is similar to a photograph. For
instance, a 128 × 64-pixel image may be shown as 400 × 200 pixels using
CSS.
Drawing buffer size refers to the internal size of a canvas, or its resolu-
tion. By executing renderer.setSize in Three.js, we may change the drawing
buffer size of the canvas. Which size should we choose? “The same size as
the canvas depicted” is the most obvious response. Again, we can use the
canvas’s client Width and client Height parameters to do this.
Let’s construct a function that checks if the renderer’s canvas isn’t
already the size it’s being displayed as and sets it to that size if it isn’t.
function resizeRendererToDisplaySize(renderer) {
const canvas = renderer.domElement;
const width = canvas.clientWidth;
const height = canvas.clientHeight;
const needResize = canvas.width !== width || canvas.
height !== height;
if (needResize) {
renderer.setSize(width, height, false);
}
return needResize;
}
sets the canvas’s CSS size by default, but this isn’t what we want. We want
the browser to behave as it does for all other elements, which is to utilize
CSS to decide the element’s display size. We don’t want the three canvases
to be different from the other pieces.
If the canvas was resized, our function returns true. We can utilize
this to see if there are any additional items that need to be updated. Let’s
update our render loop to take advantage of the new function.
function render(time) {
time *= 0.001;
if (resizeRendererToDisplaySize(renderer)) {
const canvas = renderer.domElement;
camera.aspect = canvas.clientWidth / canvas.
clientHeight;
camera.updateProjectionMatrix();
}
renderer.setPixelRatio(window.devicePixelRatio);
Any calls to renderer after that. setSize will utilize the size you specified
multiplied by the pixel ratio you specified. This is strictly discouraged. See
what follows. You can also do it yourself while resizing the canvas.
function resizeRendererToDisplaySize(renderer) {
const canvas = renderer.domElement;
const pixelRatio = window.devicePixelRatio;
const width = canvas.clientWidth * pixelRatio
| 0;
const height = canvas.clientHeight * pixelRatio
| 0;
const needResize = canvas.width !== width ||
canvas.height !== height;
if (needResize) {
renderer.setSize(width, height, false);
}
return needResize;
}
Prerequisites
They assume you’re familiar with JavaScript programming. They pre-
sume you understand the DOM, HTML, and how to build DOM ele-
ments in JavaScript. They assume you’re familiar with es6 modules and
how to utilize them using import and <script type=“module”> tags. They
assume you’re familiar with CSS and know what CSS selectors are. They
also assume you’re familiar with ES5, ES6, and possibly ES7. They assume
you’re aware that JavaScript is only executed via events and callbacks in
the browser. They think you’re familiar with the term “closure.”
Here are some quick reminders and notes.
Modules es6
The import keyword in a script or the <script type=“module”> tag can be
used to load es6 modules inline. Here’s an illustration of both.
<script type="module">
import * as THREE from '../../build/three.module.js';
...
</script>
<body onload="somefunction()"
<html>
<head>
...
</head>
Introduction ◾ 19
<body>
...
</body>
<script>
// inline javascript
</script>
</html>
function a(v) {
const foo = v;
return function() {
return foo;
};
}
const f = a(120);
const g = a(556);
console.log(f()); // prints 120
console.log(g()); // prints 556
The function “an” in the code above produces a new function each time it
is invoked. Over the variable “foo,” that function ends.
When you call a function with the dot operator, this will be null (in
strict mode or in a module). Similar to this.
someobject.somefunction(d, e, f);
Because loader.load does not use the dot. operator when calling the
callback, this will be null by default (unless the loader explicitly sets it to
something). You must notify JavaScript that this will be someobject when
the callback occurs by binding it to the function.
ES5/ES6/ES7 Stuff
The stuff var in ES5/ES6/ES7 is obsolete. Make use of const and/or let.
There is never a good reason to use var. It’s also considered bad
practice to use it at this time. If the variable will never be reallocated,
which is the case most of the time, use const. In circumstances where
the value changes, use let. This will aid in the prevention of numerous
bugs.
Employ Destructuring
Assume an object with the following dimensions: width: 300, height: 150.
Earliest code
New code
const a = position[3];
const b = position[4];
New code
const [, a, b] = position;
It was the Indian woman herself that settled the matter of the
interview with Sergeant Starr. After a day’s pain more acute than
usual she sent for the missionary.
“I have something to tell you. Can you receive my confession and
give me absolution?” she asked him, acute anxiety shining in her
dark eyes.
The missionary, being more man than missionary and having had
large experience of the soul with its burdens of sin and terror,
answered quietly, “Tell me your trouble. Do not fear. There is
forgiveness for you, and peace.”
“I have done a very wicked thing. I want absolution and the holy
oil before I—go away. And I want you to put it on paper for the
police at Edmonton. It is for Paul—it may hurt him. It is—for Paul,”
she added, clutching the missionary’s arm. “Nothing must hurt Paul.”
“Dear sister, tell me your sin, and if you wish you may tell the
police yourself. He is here.”
“Here? Here?” A momentary fear leaped into her eyes, then faded
out. “Ah, good! Let him come. Let him come, quick! And Paul. Quick!
Quick!”
“He will come at once,” said the missionary, and hastened to bring
the sergeant. At the door he met Paul. “She has asked to see the
sergeant,” said Chambers.
“Wait,” said Paul, and went to her. He found her in a fever of
eagerness and impatience.
“Ah—Paul—” she panted, “now I know the blessed Mother hears
my prayer. Bring the man—the policeman to me—quick! I have a
heavy load here,” she struck her breast, “I wish to give it to him.”
“Why not tell the missionary, Onawata?” said Paul. “You need not
tell the policeman.”
“No, Paul. The policeman is best. Oh, I have prayed to get to
Edmonton to tell the police. Bring him, Paul. Bring him. I am strong,
and I must tell him. Go, Paul, quick.”
Without delay Paul did her bidding. And in a few minutes the three
men were at her bedside.
“You have found me,” said the Indian woman, smiling
triumphantly at the sergeant.
He gazed at her in amazement. Indian women of all types he had
known, good and bad. But this type was unknown to him. Indian she
was, but the soul looking through her dark eyes was the soul of a
refined and gentle woman, and her voice and speech suggested a
lady of his own race.
“You need not fear,” he said gently.
“Fear?” she said, still smiling. “Oh, no, I have no fear of you. You
cannot hurt me. But I am glad you are here. I asked the priest to
bring you. He is a good man. He will listen and you will listen. I have
something to tell you. And Paul will listen too. It is for Paul I speak.”
Her breath began to come in gasps.
“Do not distress yourself; wait till tomorrow,” said the missionary.
“No! no! Now! now! You will put it down for the police.” Her eyes
carried her appeal to the missionary’s heart.
“I will put it down,” he said in a quiet voice, “if you will speak
quietly.”
“I will speak quietly and will speak only the truth.” She fumbled at
her bosom, drew forth a crucifix, kissed it, and in a voice calm and
devoid of all trace of emotion told her story.
“It was his fault that my man was killed,” she concluded. “I
planned to kill him. It was right that he should die, but for Paul I
changed my mind. That night it was not in my heart to kill. I went to
his house to get back from him money he had taken from my man,
for Paul. Then I would go away, with my children, back to my
people. He tried to do me wrong in his house. I struck him with my
knife. The Chippewayan strikes but once. Then I was afraid. I put
fire to the house, that my trail might not be found, and, like the
storm wind, my pony carried me home. Before we could go Paul
found us and came with us. He would not let us go alone. It was
folly. Now I have brought him back before the light goes out of my
sky. For these long, long years we have been like the wild deer, or
the fox in the forests and mountains.” She paused, exhausted.
“Yes,” said the sergeant, “we could find no trace of you.”
“My father’s people would leave no trail of the daughter of their
chief,” she said proudly. “Now,” she continued, after she had rested a
few minutes, “I bring the son of my man back to his people. He is
not Indian, and he must not join himself to my people. I have kept
him clean. He will be great among his own people. This his father
would wish. I have brought him back. You will take him to his
people.” She turned her eyes upon the sergeant, waiting his answer.
“I will bring him back,” he said. “I give you my word.”
“Good! That is all. My work is done now,” she said with a little
sigh. “I have spoken true words.” Once more she kissed the crucifix.
“Listen,” said the sergeant. “The man you struck did not die. One
of our men pulled him from the burning house. He lives today.”
“Sleeman is alive?” exclaimed Paul.
“Alive?” said the Indian woman. “Wait, Paul. You will let me
speak.” She lay for some moments with eyes closed, then in a voice
which shook with emotion she cried, “Alive? Ah! ah! I was glad he
was dead, now I am glad he is alive. The good Father told me it was
not good to go—to pass—with blood on the hands. The Holy Mother
was praying for me! It is good!” She turned her dark eyes upon Paul.
“No, Paul. You remember your word to your father. That is done.”
She put her hand on his arm. “No! no! That is not the way of your
people. For me? Perhaps. For you? No! It is not your law.” Again her
eyes searched his pale set face.
“He would have wronged you, Onawata, my father’s wife. There is
only one thing for me—only one.”
“Paul, I have brought you back to your people. I have kept you
clean. You will be a great man among your people. You will promise
me.” She raised herself on her arm. “I go—perhaps I shall see your
father, my chief. I cannot go without your word. A-a-ah!” her voice
rose in a wailing cry. “To him, to you, I brought only sorrow and
shame. Lay on me no more, Paul. I have suffered much.” She
fumbled under the pillow and drew out and unwrapped a small
parcel, carefully wrapped in deer skin. “Take it, Paul. It is your
mother’s good book. You will kiss it and say you will not kill the man
—for her, for her, Paul!” Her voice rose in a cry, her hands reached
trembling toward him.
The boy was terribly shaken with the struggle going on in his soul.
He knew the book well. He took and turned it over in his hands,
opened it at the fly-leaf, read in faded lettering the words written, he
well remembered when, “For my son Paul, from his mother. ‘Blessed
are the pure in heart, for they shall see God.’” The scene flooded his
memory—the Pine Croft living room, his mother’s face with its
wondering, tremulous smile as he told her how up through the tops
of the pines, between the little white clouds he could see God
looking down at him. He remembered how, as she was tucking him
in that night, she brought him a new Bible, with his name in it and
her name and the beautiful words about seeing God, and how she
kissed the book and kissed him as she gave it into his hands. Like a
mountain torrent sweeping away a dam, the surging tide of his
emotion swept away his control. He dropped on his knees by the
bed, pressed the words to his lips, sobbing.
“Oh, Mother, Mother! dear, dear Mother! For your sake! Yes, yes!
for your sake!”
The men turned away and moved softly from the hut, leaving the
two alone. The Indian woman lay back, spent and done. She had
fulfilled her trust. She had brought back to his people, clean from
lust and from blood, the son of the man who was to her as God
Himself. Next day the sergeant went north on his quest, carrying a
message to the Athabascan chief from his daughter.
The passing of Onawata was all peace. An hour with the
missionary, even though he was not of her faith, brought her
something of the peace that passeth understanding. There was still
her anxiety for the future of her children, which she had settled in
her own way. There only remained the telling of it to them, and that
she deferred till the very last.
They were together in the little hut after a day of quiet rest and
freedom from pain.
“Here, Tanna,” she called in her soft Chippewayan tongue. “Come
hither, little Singing Water, light of my eyes. Come in beside me.” She
gathered the child in her arms and held her close. “Peter, come too.”
The boy came and knelt by her bed, his dark face set as if cast in
bronze. He well knew what was before them all. His mother’s arm
went round his shoulders.
“Little ones, your mother is going away,” she began, her voice
coming softly and evenly, like the flowing of quietly running water,
“away to a good country—ah! a good country!—where the warm sun
is always shining, no frost, no snow, no hunger, no pain, no sickness,
no fear, no fighting, no blood. Oh, it is a good country.” She lay quiet
a few moments, her dark face growing young and beautiful. The
little girl’s fingers crept over her face.
“Oh, Mammy, you are smiling. When will we go? I do not love the
cold and the hunger, and I want no more pain for you, Mammy
dear.” The little one spoke in her father’s tongue. Her mother had
seen to that. “And, Mammy, there will be no more dark. I know! I
know!”
The mother drew the little one close to her with a low moaning
cry and again she lay silent, drinking slowly to the dregs that last
bitter cup that all mothers must drink. But having drunk, she set
herself to her last service for them.
“Not today will you come, Singing Water,” she said, her voice
flowing softly again. “I will go and later you will come, and Peter and
Paul. And now you will listen and remember, you and Peter, while the
sun shines and the winds blow you will not forget.”
“Yes, Mammy,” whispered the child.
“You and Peter will go back to my people.”
“No,” said Paul, speaking with sharp decision. “Where I go they
will go.”
“They are not your people, Paul.”
“They are my father’s children.”
An eager light came into the woman’s eyes.
“Paul! Paul!” she cried in English. “You do not know what you say.
They are of my blood. They will be a burden on you. They will spoil
your life. Your father, Paul, did not wish that, I know. Peter will be a
great chief. He will care for Tanna. I have planned this with my
father. They will drag you down as I dragged your father down. I—
who would have given him the blood from my heart! You must not
do this.” Her voice was eager and tremulous with pain. “I will not
spoil your life too.”
“They are my father’s children. They are my brother and sister,”
said Paul, in a voice steady and strong. “Do you think I can leave
Tanna to go back to the blanket and the wigwam? Tanna! my little
blind sister!” His voice rang out in indignant scorn. “No, no, Mammy,”
he added, using Tanna’s form of address, rare with him, “say no
more. It is settled. They go with me.”
A look of great wonder dawned in the woman’s eyes—wonder and
joy. Raising herself she held out her hands to him.
“Paul!” she cried, her voice broken with sobs, the tears flowing
down her cheeks. “Your God hears! Now I know, I know! Oh, I
feared to lay this burden on you, but now I know He hears. I was
afraid for Tanna, my Tanna living in the dark. I feared for her. But
now——”
Paul took her hands in his, leaned over and, for the first time in
his life, kissed her.
“Have no fear, Mammy,” he said softly. “I will keep her with me
always—always.”
The blood slowly came up into her dark face, touching it with rare
beauty. Passionately she kissed his hands.
“My chief!” she whispered. “You will do this!” She turned to the
children. “Peter! Tannawita!” she said, reverting to her own tongue,
“listen to me now.” Her voice was solemn, almost stern. “Give Paul
your hands, quick!” Wondering, the children put their hands in
Paul’s. “You are going with Paul, your brother. He is your chief, to
obey, to love, to serve with your lives, always.” She plucked the
crucifix from her breast. “The Holy Jesu, the Jesu of the Cross hears
your promise.” She pressed the crucifix to their lips, then to her own,
and lay back, pale, upon the pillow. When she had rested a little she
opened her eyes.
“Paul,” she whispered, raising her arms toward him, while into her
eyes came a look of shy, adoring love. “You are a good man. God
will always go with you and them.” She drew him down and kissed
him.
“Yes, Mammy, I know,” said Paul, kissing her in return.
In a few moments, exhausted but with a great peace in her heart,
the mother fell asleep, her children beside her and Paul watching by
the fire. An hour later the missionary came in, his wife following.
“She is asleep,” said Paul.
The missionary leaned over her. “Yes, she will rest quiet now,” he
said, gathering up the little girl in his arms. “Take the children with
you, Mother,” he added, giving the sleeping Tanna to his wife. “You
go too, Paul, I will watch now.”
They laid the Indian woman under a clump of spruce trees near to
the lake shore, the little crucifix on her breast, and on her face,
made beautiful with the beauty of youth, a great peace.
Before a month had passed a tall eagle-faced Chippewayan
warrior, splendid in his chief’s dress and decked in the colors for the
dead, and with him six tall Chippewayan braves, came stalking into
the Post. Gravely he greeted Paul.
“Wah-na-ta-hi-ta comes for his dead,” he announced.
“She lies under the spruce trees there,” said Paul. “She gave me
much love for you. She was at peace when she went away.” And
then, bringing him in to the hut, he told him the story of his
daughter’s passing. The old chief listened with face unmoved.
“I would see this man who gave her peace,” he said gravely.
To the missionary the old chief brought rich gifts in furs and
curiously wrought garments, refusing all gifts in return. It was not
seemly that his dead should be in debt for any service done. Then
the missionary, reading the grief and haughty pride in the piercing
dark eyes, told him of his daughter’s last days, of her peace, her
hope, and her willingness to go. And as he told the story the stern
lines in the bronze face grew soft, the piercing eyes grew kind.
“Good man!” he said in English, offering his hand. “Good heart!”
touching the missionary on the breast. “The Great Spirit will
remember.” And in token of his gratitude he and his six men deigned
to break bread at the missionary’s table and to accept gifts at the
missionary’s hands.
After two days he made ready to go. Peter and Singing Water he
was for taking with him.
“She gave them to me,” he said in his own speech, which Paul
knew as well as he. “The little one will be in my heart and keep it
warm. The boy will be my son. He will be chief of my people when
my camp fire is cold.”
“No!” said Paul gently, but looking straight into the fierce old eyes.
“They are my father’s children, my brother and my sister. Their
mother put their hands in mine. They will tell you.”
Peter and Tanna were called.
“She gave me to him. I put my hands in his. I kissed the Holy
Cross. He is my chief,” said Peter simply.
“And you, Singing Water?” inquired the chief, his voice soft and
tender.
The little blind girl moved quickly to the old chief’s side, passed
her fingers over the hard bronze face.
“I love my mother’s father,” she said gently, “and my mother’s
people. You were all so good, so good to me. But—but——” here the
tears ran down from the beautiful sightless eyes, “my mother gave
me to Paul. I—I—oh! I must go with Paul.”
The chief stood staring toward the spruce trees, his face fixed in
every line.
“It is good,” he said. “I shall go back to my people with my dead—
alone! My heart is cold. Soon the light in my eyes will become night
and in my ears will be no song of the Singing Water.” Then, with a
sudden and stern solemnity, he turned to Paul. “They have given
their hands to you. You are their chief. The chief hunts, fights, lives,
dies for his people. Will you?” He thrust his eagle face into Paul’s, his
fierce old eyes piercing to the young man’s very soul.
Not for an instant did Paul flinch or falter, but, giving glance for
glance, and yet with a grave and gentle courtesy, made answer, “I
have promised.”
For some moments the eyes of each held the other’s, then
sweeping in one all-embracing gesture earth and sky, the old chief
intoned as in a solemn ritual, “The sun, the sky, the earth, these
have heard. These will remember. The eyes of the Great Spirit are
never shut. They will follow the trail through the forests, over the
mountains and down the valleys, while the winds blow and the rivers
run.”
For a moment he held Paul’s hand in his, then gave both hands to
the boy Peter, kissing him on both cheeks. For a long time he stood,
obviously striving to get hold of himself, then, in a voice that in spite
of his iron control faltered and broke, he said, “Come, Singing
Water.”
With a cry the child sprang toward him. Lifting her in his arms he
kissed her eyes, her forehead, her lips, while she clung sobbing.
Then giving her to Paul he turned away. With stately grace he waved
farewell to the group at the missionary’s door, and, followed by his
six tall Chippewayans, he set his face toward his own North land,
with never a look behind, taking his dead with him.
CHAPTER XIX