Learning three.js 04 :: Textures, Normal, and Bump Maps

Channel:
Subscribers:
1,090
Published on ● Video Link: https://www.youtube.com/watch?v=VdnN5nuxj-s



Duration: 4:22
25,190 views
192


The process of adding texture, normal, and bump maps to a Mesh's material. Sources included below.

Source code - https://github.com/saucecode/threejs-demos/tree/master/04_Textures

These textures were downloaded online. You don't need to have bump or normal maps, but they help to make surfaces look more pleasant.
They were downloaded from http://opengameart.org/

If you are running this from the file (opening index.html in your browser) it will not work in Chrome. Chrome doesn't allow local files to load local images via Javascript. You must run this demo in Firefox OR run a local HTTP server and connect to it.

The textures are loaded with a TextureLoader object, and added to the MeshPhongMaterial. Because Javascript is very asynchronous, so your code will run while the texture is loading. So when you play the live demo, the crate will appear black while the textures are downloaded.

I burned my finger shortly after I uploaded video 3, and typing has been painfully impossible for a while.


https://rawr.nz/

Email me: cahill.julian@gmail.com







Tags:
javascript
webgl
opengl
textures
bump
normal
maps
map
images
threejs
three.js
three
js
chrome
firefox