Btw take a look at the 2.1+ FAQ
http://wiki.ogre3d.org/Ogre+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."
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: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();
technique->getOutputTargetPass();
Ogre::CompositionTargetPass* compositionTargetPass = technique->getOutputTargetPass();
compositionTargetPass->setInputMode(Ogre::CompositionTargetPass::InputMode::IM_NONE);
// Creating the compute pass
m_computeCompositionPass = compositionTargetPass->createPass(Ogre::CompositionPass::PT_COMPUTE);
m_computeCompositionPass->setMaterialName(COMPUTE_MATERIAL_NAME);
m_computeCompositionPass->setThreadGroups(Ogre::Vector3i(2, 0, 0));
// Rendering the contents of the scene after compute the pass
compositionTargetPass->createPass(Ogre::CompositionPass::PT_RENDERSCENE);
// 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);
callCount++;
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?
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();
node->attachObject(instancedEntity);
The issues that I have are...
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.
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.
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.
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?
@paroj Sorry for the late reply and thanks for answering. I don’t use addSharedParameters
explicitly, but I refer to the shared parameter SSBO in a material file like this:
compute_program MyComputeProgram_GLSL glsl
{
source computeShaderCode.comp.glsl
syntax glsl450
default_params
{
shared_params_ref someSSBO
shared_params_ref someUBO
}
}
compute_program MyComputeProgram unified
{
delegate MyComputeProgram_GLSL
}
material MyComputeProgramMaterial
{
technique
{
pass
{
compute_program_ref MyComputeProgram
{
}
}
}
}
I guess this does addSharedParameters
under the hood? My compute shader is also using an UBO shared parameter. The UBO gets correctly updated every frame with setNamedConstant
.
Hello @paroj, I couldn’t trace the path you requested but if I call GpuSharedparameters::_upload
directly like …
Ogre::GpuSharedParametersPtr ssbo = Ogre::GpuProgramManager::getSingleton().getSharedParameters("someSSBO");
ssbo->setNamedConstant("data", buffer.data(), 268800);
ssbo->_upload();
… I’m able to reach GL3PlusHardwareUniformBuffer::writeData
-> GL3PlusHardwareBuffer::writeData
-> OGRE_CHECK_GL_ERROR(glBufferData(mTarget, mSizeInBytes, pSource, getGLUsage(mUsage)));
(line 136). A buffer update should be taking place in this case, but it won’t show.
But anyway: Even if I won’t call _upload
I get to this exception a bit later after trying to write to the SSBO: OgreAssertDbg(false, "Missing attribute!");
on line 22, OgreGLSLProgramCommon.cpp. The call stack is
SceneManager::_issueRenderOp
SceneManager::updateGpuProgramParameters
GL3PlusRenderSystem::bindGpuProgramParameters
GLSLProgramManager::getActiveProgram
GLSLSeparableProgram::activate
GLSLProgramCommon::extractLayoutQualifiers
GLSLProgramCommon::getAttributeSemanticEnum
The parameter type
for GLSLProgramCommon::getAttributeSemanticEnum
is the same as my shared parameters name “someSSBO” when the debugger stops. I assume this is not supposed to happen? I have quadruple checked that I’m writing the name correctly in the shaders, material files and code.
But anyway: Even if I won’t call _upload I get to this exception a bit later after trying to write to the SSBO: OgreAssertDbg(false, "Missing attribute!"); on line 22
I think you can safely ignore (comment out) this - at least in current master the results of this method are unused