Search the Community
Showing results for tags 'custom'.
-
[SOLVED] Derived custom material sometimes crashes.
sebastian.vesenmayer posted a topic in Rendering
Hello, we have a custom Material with a custom Shader and a Unigine::ObjectDynamic with custom attributes. Sometimes Engine::do_render() function will halt when call to RenderState::setMaterial(int pass, Material * mat) Line 216 happens with following Error code. Unhandled exception thrown: read access violation. texture-> was 0xFFFFFFFFFFFFFF3F. We update the texture in this material frequently with a new image. What can cause this crash? If it helps I can provide a crash dump. We are runnin 2.14.1 Thanks, Sebastian -
Hello, I just installed Unigine on Linux and followed this tutorial step by step to create a custom material with a deferred pass shader. I don't get any compilation errors. I assigned the custom_mesh_material to a cube and it is not rendering (as in the sceenshot bellow): Is there something I have missed? Thanks in advance
-
[SOLVED] Changing and replacing indices during runtime in ObjectDynamic
sebastian.vesenmayer posted a topic in C++ Programming
Hello together, I try to change the indices of an ObjectDynamic during runtime to discard some points in Unigine 2.11. I can call clearIndices() on this object and all geometry vanish. But when I change the index array and set it again. the changed data won't get uploaded and the geometry still looks the same. Any ideas? int AppWorldLogic::init() { // Write here code to be called on world initialization: initialize resources for your world scene during the world start. m_dynamicObject = Unigine::ObjectDynamic::create(); m_dynamicObject->setMaterialNodeType(Unigine::Node::TYPE::OBJECT_MESH_STATIC); m_dynamicObject->setWorldTransform(Unigine::Math::translate(Unigine::Math::Vec3(0.0, -4.0, 1.0))); m_dynamicObject->setMaterial("custom_forward_material","*"); const Unigine::ObjectDynamic::Attribute attributes[]={{ 0, Unigine::ObjectDynamic::TYPE_FLOAT, 3 }}; m_dynamicObject->setVertexFormat(attributes, 1); m_dynamicObject->setSurfaceMode(Unigine::ObjectDynamic::MODE::MODE_POINTS, 0); m_dynamicObject->setBoundBox(Unigine::BoundBox(Unigine::Math::vec3(-10000.f, -10000.f, -10000.f), Unigine::Math::vec3(10000.f, 10000.f, 10000.f))); Unigine::Math::vec3 position; for (int i = 0; i < 1000; ++i) { for (int j = 0; j < 100; ++j) { position = Unigine::Math::vec3(i, j, 1.f); m_dynamicObject->addVertexFloat(0, position, 3); } } m_indices = new int[100000]; for (int index = 0; index < 100000; ++index) { m_indices[index] = index; } m_dynamicObject->setIndicesArray(m_indices, 100000); return 1; } //////////////////////////////////////////////////////////////////////////////// // start of the main loop //////////////////////////////////////////////////////////////////////////////// int AppWorldLogic::update() { static int counter=1; if (counter % 120 == 0) { m_dynamicObject->clearIndices(); } else if(counter % 120 == 60) { for (int i = 0; i < 100000; ++i) { m_indices[i] = (rand() % 2 == 1) ? i : 0; } m_dynamicObject->setIndicesArray(m_indices, 100000); } counter++; return 1; } -
[SOLVED] Support for custom/not official DIS PDUs
ivan.cuevas posted a topic in Sim IG (Image Generator)
Hi all, Very similar to this topic, I want to known if it's possible to create and process custom packets, in this case for DIS using the IG Template. Thanks. -
Creating child material of "mesh_base" and write custom ambient Shader
Akshay.Patil posted a topic in Rendering
Hello , I have written a material <material name="my_custom_material" parent="mesh_base" > <options object="mesh_dynamic" transparent="2" order="1"/> <state name="workflow">1</state> <state name="auxiliary" defines="name" pass_defines="auxiliary"/> <blend src="src_alpha" dest="one_minus_src_alpha"/> <state name="deferred">0</state> <state name="ambient" type="switch" items="none,opacity,transparent" transparent="2">2</state> <parameter name="auxiliary_color" auxiliary="1" type="color">1.0 1.0 1.0 1.0</parameter> <parameter name="my_param_a" workflow="1" shared="1" type="slider">1</parameter> <parameter name="my_param_b" workflow="1" shared="1" type="slider">0</parameter> <parameter name="my_param_c" workflow="1" shared="1" type="slider">0.0</parameter> <parameter name="my_param_d" workflow="1" shared="1" type="slider">0</parameter> <shader pass="ambient" ambient="2" object="mesh_dynamic" defines="BASE_AMBIENT,AMBIENT,ZERO_DEPTH" vertex="shaders/my_custom_material.vert" fragment="shaders/my_custom_material.frag" geometry="shaders/my_custom_material.geom"/> </material> But my shader specified in shader tag are not used while rendering , but when i remove the parent material "mesh_base" they are used in rendering . Can you help me ? Can we override the shaders in child material ? -
Hello Community, i have a little problem, the most is said in the topic-title, but here a little longer explanations: First i want to load a defined gui: engine.gui.addUserInterface ( engine.getGui(), "myGui.ui" ); After this, i do: Gui gui = engine.getGui(); Now my gui is visible. And now my problems begins: I have a Button called "Add a Tab", with this i want to change the myGui.ui, and add a new Tab dynamic to the .ui, of course i want to remove a tab again too, this needs to be dynamlicy, so i could add more then one tab, and remove more then one tab. The second thing is, when i added a dynamic tab, i want to input some buttons into the tab too. (Maybe this both things needs to be added together, i dont know?) I've searched the API and https://developer.unigine.com/docs but i didnt find anything. Is there any point to help me? Maybe someone have a example to me, how to do this? Greetings