Front/Back Map?

Is there some map that will give me black and white for front or back faces (e.g. White for front faces black for back faces) or similar?

I would like to use with with a VRayExtraTex render element, so a map is idea. I could render a separate pass if I had to, but was trying to do it in one.

Thanks in advance.

By back faces, do you mean flipped faces or faces facing away from the camera?

If you mean flipped - you can use a VRay2SidedMtl and bake the result onto a texture.
If you mean facing away - a Solid Gradient Ramp mapped with a Falloff (Towards/Away)

I mean backfaces in the old school sense of the back side of a polygon. So every polygon has a normal facing a certain direction, and the backface would be the opposite side from the normal.

Basically I just want a different map for side A and side B of the polygons.

I ended up solving it with an additional pass with a VRay2SidedMtl set to do VRayColors. But would still like to know if there is an easy way to get that with a map.

Not sure how VRay would handle it, but back in the LightWave days you would duplicate your polys and flip them so you had a copy facing each way. It shaded free of artifacts because the coplanar polys were identical except for their normals (and because LIghtWave was designed to work like this). I wonder can VRay shade such things without issues? I suppose it could. And then each side could have its own material ID I suppose. But in my case I already have a bunch of polys with different IDs. Maybe an ID offset…

You can use a standard 2-sided material…maybe similar to a Vray2sided but simpler at least.

Good call. Still doesn’t give me a map, though (and the VRay2SidedMtl rendered fast with solid colors and no translucency).

Check my edited post (didn’t refresh, sorry).

Ah, baking the VRay2sidedMtl is a good idea! I think that would actually do it. Thanks.

I usually use this simple OSL map - OSL-Shaders/FrontBack.osl at master · gkmotu/OSL-Shaders · GitHub

Excellent. I was looking through the included OSL files, but didn’t do a web search. Also, OSL is pretty simple code sometimes. That is sweet. Thanks.