# What is the difference between Front/Back Face Color in MaterialMappingControl class?

**URL:** <https://forum.techsoft3d.com/t/what-is-the-difference-between-front-back-face-color-in-materialmappingcontrol-class/4396>\
**Category:** HOOPS Visualize Desktop\
**Tags:** learn\
**Created:** [February 18, 2025, 8:24am UTC](https://forum.techsoft3d.com/t/what-is-the-difference-between-front-back-face-color-in-materialmappingcontrol-class/4396 "2025-02-18T08:24:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mini](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@mini](https://forum.techsoft3d.com/u/mini)\
**Post date:** [February 18, 2025, 8:24am UTC](https://forum.techsoft3d.com/t/what-is-the-difference-between-front-back-face-color-in-materialmappingcontrol-class/4396/1 "2025-02-18T08:24:48Z")

</div>

I’m not sure what the difference is. If you have any references or explanations, please let me know.

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [February 18, 2025, 12:45pm UTC](https://forum.techsoft3d.com/t/what-is-the-difference-between-front-back-face-color-in-materialmappingcontrol-class/4396/2 "2025-02-18T12:45:01Z")

</div>

Hello @mini,

The functions [SetFrontFaceColor](https://docs.techsoft3d.com/hps/latest/api_ref/cpp/class_h_p_s_1_1_material_mapping_control.html#_CPPv4N3HPS22MaterialMappingControl17SetFrontFaceColorERK9RGBAColorN8Material5Color7ChannelE) and [SetBackFaceColor](https://docs.techsoft3d.com/hps/latest/api_ref/cpp/class_h_p_s_1_1_material_mapping_control.html#_CPPv4N3HPS22MaterialMappingControl16SetBackFaceColorERK9RGBAColorN8Material5Color7ChannelE) allow you to specify separate colors for the two sides of a shell. Since polygon handedness and culling determine how the front and back faces are rendered, ensure that you have set those parameters appropriately. Below is a sample code:

```auto
void CHPSView::OnUserCode2()
{
	SegmentKey model_key = GetCanvas().GetAttachedLayout().GetAttachedView().GetAttachedModel().GetSegmentKey();
	SegmentKey quad_key = model_key.Subsegment("quad");
	quad_key.GetDrawingAttributeControl().SetPolygonHandedness(HPS::Drawing::Handedness::Right);
	quad_key.GetCullingControl().SetBackFace(false);

	quad_key.GetMaterialMappingControl().SetFrontFaceColor(HPS::RGBAColor(1, 0, 0)); //set front face color to red
	quad_key.GetMaterialMappingControl().SetBackFaceColor(HPS::RGBAColor(0, 1, 0)); //set back face color to green

	Point points[4] = { Point(-0.5, -0.5, 0), Point(0.5, -0.5, 0), Point(0.5, 0.5, 0), Point(-0.5, 0.5, 0) };
	int faceList[5] = { 4, 0, 1, 2, 3 };

	quad_key.InsertShell(4, points, 5, faceList);

	_canvas.UpdateWithNotifier().Wait();
}

```

Here is the result:  
 ![forum_post](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/3/3fecec1cb894f96f1624b9a83a56c2438c99b12b.gif)

Thanks,  
Tino

---

<div class="post-metadata">

**Author:** ![mini](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@mini](https://forum.techsoft3d.com/u/mini)\
**Post date:** [February 27, 2025, 4:47am UTC](https://forum.techsoft3d.com/t/what-is-the-difference-between-front-back-face-color-in-materialmappingcontrol-class/4396/3 "2025-02-27T04:47:13Z")

</div>

Thank you for your response.
