Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Tomas Ayi
    Hi, is adding Wayland support in the plans for the future? I'm trying to add it by myself but it's too difficult for me right now
    1 reply
    I can't manage to understand completely how to implement it
    1 reply

    I'm struggling to find why I can't assign the Marble material to my test cube. The Ogre log says:

    Parsing script PbsMaterials.material

    I use:

    auto et{m_staticEntities.emplace(ann.id, ann.meshName)};
    ann.gfxEntity = &*et;
    auto& sceneMgr{m_renderer.sceneManager()};
    auto item{sceneMgr.createItem(ann.meshName,
        Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::SCENE_DYNAMIC)};
    auto node{sceneMgr.getRootSceneNode(Ogre::SCENE_DYNAMIC)
    et->sceneNode = node;

    Yet it tells me:

    Can't assign material Marble because this Material does not exist. Have you forgotten to define it in a .material script?

    This is the file I'm loading: https://github.com/OGRECave/ogre-next/blob/master/Samples/Media/2.0/scripts/materials/PbsMaterials/PbsMaterials.material

    Moreover, how does Ogre know/decide whether to render something with PBS or Unlit at all?
    Matías N. Goldberg

    Hi! It's strange the log says the script is being parsed but then it's not found.

    The most reasonable explanation I can think of is that you're creating the item before calling initialiseAllResourceGroups

    Or for some reason Hlms::destroyDatablock is being called on that material before it is assigned. (that would be very strange)

    Moreover, how does Ogre know/decide whether to render something with PBS or Unlit at all?

    That's in the material script. As the scipt says:
    'hlms Marble pbs'

    The last word could be either pbs or unlit, and that tells Ogre which implementation you wish to use.

    OH Wait!!!

    I realize now. You're calling setMaterialName, you should be calling setDatablockOrMaterialName.

    Hlms materials are called 'datablocks' to distinguish v1-era materials from the new ones.

    The reason it's failing is because setMaterialName only looks for the older v1 materials
    Change the call to setDatablockOrMaterialName and you should be set
    @matiasgoldberg_twitter Thank you for your answer. I think it works. At least the error message is gone. I can't see it, because apparently I have a lighting issue (cube is just black), although I set an ambient color of (0.5, 0.5, 0.5) and create a light above the cube.
    Matías N. Goldberg
    If the light is not directional (e.g. spot or point) and shadow maps are not enabled, you will have to use Forward+ (there is a sample about that). Since you're still starting up, it's best that you first set that light to directional to check things work as intended

    Btw take a look at the 2.1+ FAQ

    It contains solutions for common issues such as this one (e.g. see questions "I've added a Point/Spot light but it won't show up." and "I'm creating custom geometry but it shows black/white with PBS."

    Erik Ogenvik
    Hi, there's a bug in Ogre 1.12.12. It's caused by the addition of "mesh->buildEdgeList();" to InstanceManager::unshareVertices, and it affects meshes with shared geometry and LOD. Basically, what happens is that the shared geometry is unshared, and split into separate geometries. But this is only done for the top level mesh (lod=0), the rest of the LOD data is untouched. This leaves the data in an inconsistent state since the lod data now refers to vertices where they were in the shared geometry.
    And when Mesh::buildEdgeList then is called this will lead to a segfault, since it will try to access vertices that are out of bounds.
    9 replies
    Hello everyone! Trying to run 1.12.12 on MacOS. Successfully compiled. I have setup a sample project using simply BasicTutorial1. So I literally have it in my main file. When I launch the app the logs look fine but the window is not showing. So basically the app is not responding. I have attached the log:
    16 replies
    Hi - I've set the diffuse texture of a HlmsPbs datablock in Ogre 2.3 to a texture with transparency. What is the simplest way to add a solid colour underneath this texture? I'd like to be able to update the solid colour at any time, too.
    Matías N. Goldberg
    @crjc use HlmsPbsDatablock::setBackgroundDiffuse
    and assign the texture as a detail map diffuse instead of 'just diffuse' texture
    1 reply
    Hello, does anyone happen to have any experience with compute shaders and shader storage buffer objects or UAVs in Ogre1.12.9? I have a working particle system in a pure OpenGL demo that uses a compute shader to update particles. The particle data is stored in a SSBO. After updating I draw the particles by using the SSBO in the particle vertex shader (with instancing). I’m trying to translate this OpenGL demo to Ogre now but I’m having some difficulties. I know that I should use compute compositors and I have gotten a test compute shader running each frame as a “full screen post effect” compositor, but I’d want to ensure that my compute shaders are run before any rendering (or at least before I use the SSBO in a vertex shader). Is there a way to enforce my compute compositor to be run before rendering?
    9 replies

    Hi, I'm having problems with updating a compute program named constant (v. 1.12.5). The value gets updated the first time but not after that. I have verified this with Nvidia Nsight.
    What I'm doing is that I'm trying to update a particle buffer in a compute shader. The particles have an age and the age is increased every frame with the time since the last frame which is passed to the shader as an uniform.
    Here is how I create my compute compositor:

    // Creating a compute & render compositor
    auto compositor = Ogre::CompositorManager::getSingleton().create(COMPUTE_COMPOSITOR_NAME, RESOURCE_GROUP_NAME);
    Ogre::CompositionTechnique* technique = compositor->createTechnique();
    Ogre::CompositionTargetPass* compositionTargetPass = technique->getOutputTargetPass();
    // Creating the compute pass
    m_computeCompositionPass = compositionTargetPass->createPass(Ogre::CompositionPass::PT_COMPUTE);
    m_computeCompositionPass->setThreadGroups(Ogre::Vector3i(2, 0, 0));
    // Rendering the contents of the scene after compute the pass
    // Activating the compositor
    Ogre::CompositorManager::getSingleton().addCompositor(m_viewport, COMPUTE_COMPOSITOR_NAME);
    Ogre::CompositorManager::getSingleton().setCompositorEnabled(m_viewport, COMPUTE_COMPOSITOR_NAME, true);

    Here is how I try to update the named constant for my compute material every frame. The uniform value does not change each frame like it's supposed to.

    // udt is supposed to be the time since the last frame but putting in a frame dependent value instead for debugging. Nsight shows that this value does not change between frames.
    m_computeCompositionPass->getMaterial()->getTechnique(0)->getPass(0)->getGpuProgramParameters(Ogre::GPT_COMPUTE_PROGRAM)->setNamedConstant("udt", callCount * .001f);
    3 replies
    Is Caelum still a thing to use with Ogre 2? There is only ancient stuff to find about it.
    How can set variable like OGRE_MEDIA_DIR to build this in a custom directory ?
    making only export OGRE_MEDIA_DIR=./Media in linux seems doesn't works
    2 replies
    I'm trying to change a Mesh's AABB after creating an Item from it and adding that to the scene. But it doesn't work. I tried calling notifyStaticAabbDirty() afterwards with a static mesh and I also tried making it a dynamic one. I'm tracking the AABB with a WireAabb. Now either that one is not updating the visuals or the AABB really does not bother to change. Any ideas?
    Matías N. Goldberg
    Call Item::setLocalAabb
    That works, thank you. I think I understand why my approach didn't work now.
    I’ve got OGRE.sln on visual studio, and got these errors when building ‘ALL_BUILD’.
    How can this be fixed?
    as the error implies, you're mixing debug and release libraries which is not allowed in C++
    Guillermo Ojea Quintana
    Thats a known issue
    Hi. Is @paroj active here?
    Pavel Rojtberg
    Ah, nice, just wanted to inform you that Rigs of Rods 2021.10 is out, so maybe you could update the snap package
    8 replies

    Hello, I'm trying to get instancing to work but struggling (v. 1.12.9). I have a very simple mesh with no animations and I'm basically aiming to call glDrawElementsInstanced for this mesh with some instance count.

    This is what I've tried thus far:

    Creating an instance manager with instance count 1000:

    Ogre::InstanceManager* m_instanceManager = m_sceneManager->createInstanceManager(INSTANCE_MANAGER_NAME, MESH_NAME, RESOURCE_GROUP_NAME, Ogre::InstanceManager::HWInstancingBasic, 1000);

    I've created multiple instanced entitys that use this instance manager like below. The material is copied from the same material for each instanced entity.

    Ogre::InstancedEntity* instancedEntity = m_instanceManager->createInstancedEntity(materialName);
    Ogre::SceneNode* node = m_sceneManager->getRootSceneNode()->createChildSceneNode();

    The issues that I have are...

    • Only some instanced entities I have created lead to calling glDrawElementsInstanced (and uniform updates) each frame
    • When looking at the calls of glDrawElementsInstanced the instance count is always 1 instead of 1000
    • The material copies use world matrix which is given as an auto parameter. The world matrix is not updated according to the scene node for some reason. Manual parameters seem to update fine though.

    I think I'm doing pretty much the same stuff as in the instancing sample. If someone knew how to set the right instance count I would be really grateful.

    Pavel Rojtberg

    The material is copied from the same material for each instanced entity.

    you must use the same material

    Amlal El Mahrouss
    Hello everyone!
    I'm currently wondering if there is any bindings of imgui
    (any that are not deprecated)

    Thanks for replying @paroj. I don't quite understand what you mean by using the same material.
    I tried to use the same material for every instanced entity I create and this will give me no glDrawElementsInstanced calls.
    Additionally I don't quite see how to update instanced entity specific shader uniforms without cloning the original material and giving every instanced element a clone.

    How I did the cloning was:

    Ogre::String materialName = Ogre::StringUtil::format("CloneMaterial%d", m_instancedEntityCounter);
    Ogre::MaterialManager::getSingleton().getByName("OriginalMaterial", RESOURCE_GROUP_NAME)->clone(materialName);

    materialName refers to the code in my previous post.

    I looked at the samples a bit more and it looks as if the instancing samples might not produce the kind of instancing I'm trying to achieve.
    What I'm trying to do is draw the same mesh multiple times with a single call of glDrawElementsInstanced with some number of instances.
    Later in shaders I'd use gl_InstanceID to determine which instance is being drawn and operate on that.
    gl_InstanceID is never used in the samples though.

    Pavel Rojtberg

    Additionally I don't quite see how to update instanced entity specific shader uniforms without cloning the original material and giving every instanced element a clone.

    see https://ogrecave.github.io/ogre/api/latest/_what_is_instancing.html#InstancingCustomParameters

    you must not clone the material.

    Only the "HW Basic" method will give you a gl_InstanceID. The instanced matrices will be still passed through a "attribute" though.

    I am drawing two parallel lines (Ogre::OT_LINE_LIST) exactly at the same position. Obvisouly I'm getting z fighting now. Can I set one of the lines to be always drawn after the other so it is always in front of it?
    3 replies
    i would require some help regarding ogre blender i cant seem to get it installed

    Hello, I’m trying to update a SSBO from CPU to GPU but not getting it working (v. 1.12.9). I have a material file where I define my SSBO like this:

    shared_params someSSBO
        shared_param_named data float [268800]

    The SSBO is accessed inside a compute shader and a vertex shader like this:

    layout (std430, binding = 0) restrict buffer someSSBO
        float data[268800];

    Initially I set the values for the SSBO from a float vector:

    Ogre::GpuSharedParametersPtr ssbo = Ogre::GpuProgramManager::getSingleton().getSharedParameters("someSSBO");
    ssbo->setNamedConstant("data", buffer.data(), 268800);

    This works the first time, but I need to overwrite the SSBO later a few times. At later attempts the SSBO doesn’t get updated with the same commands. I have tried ssbo->_getHardwareBuffer()->writeData(0, 268800, buffer.data()); but this doesn’t work either. Does anyone have ideas?

    Pavel Rojtberg
    the first call is the preferred way and should work. Are the shared_prams referenced by normal params via addSharedParameters? Otherwise Ogre thinks they are unused and wont update the hardware buffer
    Hello everyone; i've got some troubles getting Ogre up and running with Cocoa
    It still stays at the
    "Parsing scripts for resource group OgreInternal
    Finished parsing scripts for resource group OgreInternal
    Creating resources for group OgreInternal
    All done" I Think it might be a deadlock;
    and no window is being shown
    except for the subsystem dialog
    Actually nevermind it just doesn't show at all