x


Does a mesh need normals in order for backface culling to occur?

I kept getting errors about some of my procedural meshes not having normals, despite the "shader wanting them". So I just manually used BindChannels to not deal with the normals. For meshes that are 2D GUI elements, I think that's dandy. However, what if not? Does a "real 3D" mesh require the vertex normals to be bound, for backface culling to happen?

more ▼

asked Apr 02 '10 at 09:06 PM

Jessy gravatar image

Jessy
15.6k 72 95 196

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Normals are required by most shaders in order to determine which color to give to each pixel of the triangle. Most shaders do this by comparing the interpolated normal of the three vertices with the direction of the light.

For backface culling, you do not need normals. the "face winding" of the triangle is used. If your triangles happen to be culled "the wrong way around", change the triangle indices from 1,2,3 to 1,3,2

more ▼

answered Apr 02 '10 at 11:13 PM

Lucas Meijer 1 gravatar image

Lucas Meijer 1 ♦♦
7.9k 19 43 85

Fantastic. I'm not using lights on anything these days, in order to squeeze performance out on the iPhone. Do you know if it will give me any performance gains on everything, if I don't bind the normals? As in, just use BindChannels {"vertex" = vertex; "texcoord" = texcoord} ?

Apr 04 '10 at 02:29 AM Jessy

Try it :). I suspect not having any normals in your meshdata would help. Then again, the only way is to try.

Apr 04 '10 at 10:25 AM Lucas Meijer 1 ♦♦
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1651
x147

asked: Apr 02 '10 at 09:06 PM

Seen: 1371 times

Last Updated: Apr 02 '10 at 09:06 PM