Is it possible to access the surface normal (not vertex)?

I would like to write a fragment shader that uses the surface normal rather then the interpolated vertex normal. Is there a way to access that information?

Thanks,
Doug
twitter: @dugla

What kind of shape is it? The common way to get smooth normals is to use point normals on the model and normalize the interpolated point normals in the pixel shader. I’m not sure what you’re looking for when you say surface normal because you’d have to evaluate the equation of a surface like a sphere or something to get that.

I want the normal to the plane of the triangle rather then the interpolated normal.

Ok it sounds like you want flat shading, correct? If that’s the case make sure your triangles are all separate, no indexed triangles. Then make sure your normals for all 3 points in each triangle are all the same.

Unfortunately that is not a viable solution. Non-indexed triangles datas would be unthinkable for the datasets I am working with. I simply want the control - at the shader level - to create a faceted look as one of many different looks. I thought to attach the plane normals as vertex attributes but the won’t work with a shared verted model. Sigh…

I’m pretty sure it’s the only way though. I have a lot of graphics experience. I would love for someone to prove me wrong though and show a novel way to do it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.