Set CullFace to Front and Back in Qt3D – issue with ActiveFrameGraph

I want my textured mesh (non-manifold) to display the texture color on both outside and inside faces (it currently displays as completely white inside)
I have found from this 6-year-old post that I should set Cull Face to front and back, which I did, trying to use the guidelines provided (RenderSettings, RenderStateSet). But then, I am stuck at how this all works together, and how it ties to the ActiveFrameGraph.

Below is my code attempt, which still shows inside faces as white (need to set paths to actual files). If I play with ActiveFrameGraph, I either have it crash, or it complains it does not have a SurfaceSelector, leaving me again clueless.

Here is my code, all working except for the CullFace / RenderSettings / RenderStateSet / ActiveFrameGraph part:

from PyQt6.QtWidgets import QMainWindow, QApplication, QWidget, QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QSplitter
from PyQt6.QtGui import QIcon, QPixmap, QPainter, QImage, QMatrix4x4, QQuaternion, QVector3D, QColor, QGuiApplication
from PyQt6.QtCore import QSize, Qt
import sys
from PyQt6.Qt3DCore import QEntity, QTransform, QAspectEngine
from PyQt6 import Qt3DRender
from PyQt6 import QtCore
from PyQt6.Qt3DRender import QCamera, QCameraLens, QRenderAspect, QSceneLoader, QPickingSettings, QFrameGraphNode, QRenderSurfaceSelector
from PyQt6.Qt3DInput import QInputAspect
from PyQt6.Qt3DExtras import QForwardRenderer, QPhongMaterial, QCylinderMesh, QSphereMesh, QTorusMesh, Qt3DWindow, QOrbitCameraController, QDiffuseSpecularMaterial, QTextureMaterial, QNormalDiffuseMapMaterial, QDiffuseMapMaterial 
from PyQt6.Qt3DExtras import QSphereMesh, QPlaneMesh

class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.view = Qt3DWindow()
        self.container = QWidget.createWindowContainer(self.view)
        self.setCentralWidget(self.container)
        
 
        # Create & set layouts
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.container)
        main_widget = QWidget()
        main_widget.setLayout(main_layout)
        self.setCentralWidget(main_widget)

        # Define object paths
        filepath1 = "some_path.obj"
        texture_filepath1 = "some_other_path.jpg"

        # Root entity
        self.rootEntity = QEntity()

        # Load mesh
        mesh_object = Qt3DRender.QMesh()
        mesh_object.setSource(QtCore.QUrl.fromLocalFile(filepath1))
        mesh_entity = QEntity(self.rootEntity)
        mesh_entity.addComponent(mesh_object)
 
        # Load/create textures
        # Using QTexture2D class
        mesh_texture_image = Qt3DRender.QTextureImage(self.rootEntity)
        mesh_texture_image.setSource(QtCore.QUrl.fromLocalFile(texture_filepath1))
        mesh_texture_image.setEnabled(True)
        mesh_texture_2D = Qt3DRender.QTexture2D(self.rootEntity)
        mesh_texture_2D.addTextureImage(mesh_texture_image)


        # Create Materials
        # Using QDiffuseMapMaterial
        diffuse_material = QDiffuseMapMaterial(self.rootEntity)
        diffuse_material.setDiffuse(mesh_texture_2D)
        diffuse_material.setShininess(0)

        # Add material components to entity
        mesh_entity.addComponent(diffuse_material)

        # Cull face
        render_settings = self.view.renderSettings()
        activeframegraph = render_settings.activeFrameGraph
        self.render_state_set = Qt3DRender.QRenderStateSet(render_settings)
        self.cull_face = Qt3DRender.QCullFace(self.render_state_set)
        self.cull_face.setMode(Qt3DRender.QCullFace.CullingMode.FrontAndBack)
        self.render_state_set.addRenderState(self.cull_face)
        #render_settings.setActiveFrameGraph(self.render_state_set)
        self.rootEntity.addComponent(render_settings)


        # Camera.
        camera = self.view.camera()
        camera.lens().setPerspectiveProjection(45.0, 16.0 / 9.0, 1, 1000.0)
        camera.setPosition(QVector3D(0.0, 0, 120.0))
        camera.setViewCenter(QVector3D(0.0, 100.0, 0.0))

        # For camera controls.
        camController = QOrbitCameraController(self.rootEntity)
        camController.setLinearSpeed(200.0)
        camController.setLookSpeed(280.0)
        camController.setCamera(camera)
        
        # Light
        light_entity = QEntity(self.rootEntity)
        light = Qt3DRender.QPointLight(light_entity)
        light.setConstantAttenuation(0)
        light_entity.addComponent(light)
        light_transform = QTransform()
        light_transform.setTranslation(QVector3D(350, 100, 200))
        light_entity.addComponent(light_transform)

        light_entity_2 = QEntity(self.rootEntity)
        light_2 = Qt3DRender.QPointLight(light_entity_2)
        light_2.setConstantAttenuation(0)
        light_entity_2.addComponent(light_2)
        light_transform = QTransform()
        light_transform.setTranslation(QVector3D(-350, 100, 200))
        light_entity_2.addComponent(light_transform)

        
        # Object picker
        self.object_picker = Qt3DRender.QObjectPicker(self.rootEntity)
        self.object_picker.pressed.connect(self.on_object_picked)
        self.rootEntity.addComponent(self.object_picker)        
        self.pick_set = self.view.renderSettings().pickingSettings()
        self.pick_set.setPickMethod(Qt3DRender.QPickingSettings.PickMethod.PrimitivePicking)
        

        self.view.setRootEntity(self.rootEntity)


    def on_object_picked(self, pick_event):
        print("Object picked at:", pick_event.worldIntersection().x(), pick_event.worldIntersection().y(), pick_event.worldIntersection().z())
        


class Application(QMainWindow):
    def __init__(self):
        super().__init__()
        #
        view3d = View3D()
        self.setCentralWidget(view3d)
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    window.setGeometry(100, 100, 800, 600)
    window.setWindowTitle("3D Object Viewer")
    window.show()

    sys.exit(app.exec())

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật