Home › Forum › SofaPython3 › Programming with SofaPython3 › Segmentation Fault when addings Shadows
Tagged: oglshadowshader, shadows, SOFA_2006, Windows_10
- This topic has 5 replies, 3 voices, and was last updated 2 years, 10 months ago by
Hugo.
-
AuthorPosts
-
14 October 2021 at 15:51 #20612
Johannes Z.
BlockedHello,
I am trying to add Shadows to my Scene. It would overall be great if there was an example in the Python3 Plugin including shadows.
I have 2 Spotlights in my scene and it works just fine until I add an OglShadowShader. When I try to display the scene I get the following error:
########## SIG 11 – SIGSEGV: segfault ##########
74: sofa::helper::BackTrace::dump – 0x7ffb5e075f2073: sofa::helper::BackTrace::sig – 0x7ffb5e0760a072: seh_filter_exe – 0x7ffbac0b0cc071: seh_filter_exe – 0x7ffbac0b0cc070: _C_specific_handler – 0x7ffba889e2f069: _chkstk – 0x7ffbae2f1fb068: RtlRaiseException – 0x7ffbae2a102067: KiUserExceptionDispatcher – 0x7ffbae2f0bd066: memcpy – 0x7ffba88912f065: sofa::component::visualmodel::LightManager::makeShadowMatrix – 0x7ffb163b451064: sofa::component::visualmodel::LightManager::fwdDraw – 0x7ffb163b319063: sofa::simulation::VisitorScheduler::doExecuteVisitor – 0x7ffb5dd62d6062: sofa::simulation::VisualDrawVisitor::processNodeTopDown – 0x7ffb5dd633b061: sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal – 0x7ffb8a0a7c7060: sofa::simulation::graph::DAGNode::doExecuteVisitor – 0x7ffb8a0a6ec059: sofa::simulation::DefaultVisualManagerLoop::drawStep – 0x7ffb5dd3097058: sofa::simulation::Simulation::draw – 0x7ffb5dd5898057: PyInit_SofaGL – 0x7ffb7820990056: PyInit_SofaGL – 0x7ffb7820990055: PyMethodDef_RawFastCallKeywords – 0x7ffb4cf1cce054: PyMethodDef_RawFastCallKeywords – 0x7ffb4cf1cce053: PyEval_EvalFrameDefault – 0x7ffb4cf1db3052: PyFunction_FastCallDict – 0x7ffb4cf070a051: PyMethodDef_RawFastCallDict – 0x7ffb4cf05e6050: PyObject_Call – 0x7ffb4cefae4449: PyObject_Call – 0x7ffb4cefae4448: PyObject_Call – 0x7ffb4cefae4447: PyObject_Call – 0x7ffb4cefae4446: QOpenGLWidget::redirected – 0x7ffb3d0646d045: QOpenGLWidget::redirected – 0x7ffb3d0646d044: QWidget::event – 0x7ffb3d03788043: QWidget::event – 0x7ffb3d03788042: QApplicationPrivate::notify_helper – 0x7ffb3d01488041:
QApplication::notify – 0x7ffb3d01216040: PyInit_QtWidgets – 0x7ffb3d696fb039: QCoreApplication::notifyInternal2 –
0x7ffb3dbf2a1038: QWidgetPrivate::sendPaintEvent – 0x7ffb3d04234037: QOpenGLWidget::resizeEvent – 0x7ffb3d064a1036: QOpenGLWidget::resizeEvent – 0x7ffb3d064a1035: QWidget::event – 0x7ffb3d03788034: QWidget::event – 0x7ffb3d03788033: QApplicationPrivate::notify_helper – 0x7ffb3d01488032: QApplication::notify – 0x7ffb3d01216031: PyInit_QtWidgets – 0x7ffb3d696fb030: QCoreApplication::notifyInternal2 – 0x7ffb3dbf2a1029: QWidgetPrivate::sendPendingMoveAndResizeEvents – 0x7ffb3d0423a028: QWidgetPrivate::show_helper – 0x7ffb3d049c4027: QWidgetPrivate::setVisible – 0x7ffb3d047f5026: QWidget::setVisible – 0x7ffb3d047ef025: QWidget::setVisible – 0x7ffb3d047ef024: QWidgetPrivate::showChildren – 0x7ffb3d0498a023: QWidgetPrivate::show_helper – 0x7ffb3d049c4022: QWidgetPrivate::setVisible – 0x7ffb3d047f5021: QWidget::setVisible – 0x7ffb3d047ef020: QWidget::setVisible – 0x7ffb3d047ef019: QWidget::showFullScreen –
0x7ffb3d049b2018: PyInit_QtWidgets – 0x7ffb3d696fb017: PyMethodDef_RawFastCallKeywords – 0x7ffb4cf1cce016: PyMethodDef_RawFastCallKeywords – 0x7ffb4cf1cce015: PyEval_EvalFrameDefault – 0x7ffb4cf1db3014: PyEval_EvalCodeWithName – 0x7ffb4cf0743013: PyEval_EvalCodeEx – 0x7ffb4cf21edc12: PyEval_EvalCode – 0x7ffb4cf21ea811: PyArena_Free – 0x7ffb4cf21dd810: PyRun_FileExFlags – 0x7ffb4d085d749: PyRun_SimpleFileExFlags – 0x7ffb4d0864148: PyRun_AnyFileExFlags – 0x7ffb4d085ca47: Py_UnixMain – 0x7ffb4cfd11746: Py_UnixMain – 0x7ffb4cfd11745: PyErr_NoMemory – 0x7ffb4cf3e8a04:
PyBytes_AsString – 0x7ffb4cf223d83: Py_Main – 0x7ffb4cf211f02: Py_Main – 0x7ffb4cf211f01: BaseThreadInitThunk – 0x7ffbacdc70200: RtlUserThreadStart – 0x7ffbae2a263014 October 2021 at 15:55 #20613Johannes Z.
BlockedHere is a bit of my code to illustrate. If I leave the OglShadowShader out everything works just fine
self.root = SCore.Node("Root") root.addObject("LightManager", listening=True, shadows=True, softShadows=False) root.addObject("OglShadowShader", name="shadowShader") endo = self.root.addChild("Endoscope") light = endo.addChild("light") light.addObject("SpotLight", name='spotlight', direction=f"offset_engine.positions", lookat=True, cutoff=90, # angle in degrees position=f"@{name}_camera_system.output_position", attenuation = "0.15", shadowTextureSize="128", exponent=1, shadowsEnabled=True))
14 October 2021 at 20:51 #20619Hugo
KeymasterHi @cereven
This piece of code does not crash on my end (with a few modif to make it a real script):
import Sofa def createScene(root): root.addObject("LightManager", listening=True, shadows=True, softShadows=False) root.addObject("OglShadowShader", name="shadowShader") endo = self.root.addChild("Endoscope") light = endo.addChild("light") light.addObject("SpotLight", name='spotlight', direction=f"offset_engine.positions", lookat=True, cutoff=90, # angle in degrees position=f"@{name}_camera_system.output_position", attenuation = "0.15", shadowTextureSize="128", exponent=1, shadowsEnabled=True)
However, OglShadowShader is a very old component because rendering is not any more performed within SOFA but rather within Blender or Unity. A tutorial should soon come out explaining how to do such a rendering in Blender !
Best wishes,
15 October 2021 at 07:07 #20621psomers
BlockedHi @Hugo,
I think the problem only occurs when using the Sofa.GL python bindings (not through runSofa). But I am very curious as to how this Blender tutorial will work. Will it retain standalone SOFA in python capabilities or will it need to be used with runSofa?
Thanks,
Peter
15 October 2021 at 09:17 #20622Johannes Z.
BlockedI am also very excited to see how the rendering through blender will be done 🙂
15 October 2021 at 10:24 #20624 -
AuthorPosts
- You must be logged in to reply to this topic.