Skip to Content
Real-Time 3D Graphics with WebGL 2 - Second Edition
book

Real-Time 3D Graphics with WebGL 2 - Second Edition

by Farhad Ghayour, Diego Cantor
October 2018
Intermediate to advanced
500 pages
12h 40m
English
Packt Publishing
Content preview from Real-Time 3D Graphics with WebGL 2 - Second Edition

Vertex//Normal

There can also be cases where normals are defined but texture coordinates are not. In this case, the second part of the face configuration is missing:

f i1//n1 i2//n2 i3//n3...

This is the case for square.obj, which looks like this:

f 6//1 4//1 3//1f 6//1 3//1 5//1

Note that faces are defined using indices. In our example, we have defined a square divided into two parts. Here, we can see that all of the vertices share the same normal, which has been identified with index 1.

The remaining lines in this file represent the red group:

g squares_mesh_redusemtl redf 1//1 6//1 5//1f 1//1 5//1 2//1

As we mentioned previously, groups belonging to the same object share indices.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WebGL Programming Guide: Interactive 3D Graphics Programming with WebGL

WebGL Programming Guide: Interactive 3D Graphics Programming with WebGL

Kouichi Matsuda, Rodger Lea
3D Graphics Rendering Cookbook

3D Graphics Rendering Cookbook

Sergey Kosarevsky, Viktor Latypov

Publisher Resources

ISBN: 9781788629690Supplemental Content