[2.3] Can't change the appearance of v1 billboard

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
joshuacolossus
Gnoblar
Posts: 4
Joined: Mon Apr 12, 2021 11:31 am
x 1

[2.3] Can't change the appearance of v1 billboard

Post by joshuacolossus »

I'm still figuring out the material system (and Ogre in general), so this might be something really simple, but I cant get a texture to show up on a billboard.
This is how I create the billboard:

Code: Select all

    billboardSetInstance = sceneManager->createBillboardSet(1);
    billboardSetInstance->setDefaultDimensions(1.0,1.0);
    billboardSetInstance->setDatablockOrMaterialName("billboardMat",
            Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
    // billboardSetInstance->setTextureStacksAndSlices(1,1);
    Ogre::v1::Billboard* billboardInstance = billboardSetInstance->createBillboard(0.0,0.0,0.0);
    // billboardInstance->setTexcoordRect(Ogre::FloatRect(0,0,1,1));
    // billboardInstance->setColour(Ogre::ColourValue(1.0, 0.5, 0.5, 0.5));
    // billboardInstance->setTexcoordIndex(0);
    Ogre::SceneNode* billboardNode = static_cast<Ogre::SceneNode*>(
            mGraphicsSystem->getSceneManager()->getRootSceneNode()->createChild());
    billboardNode->attachObject(billboardSetInstance);
The billboard itself shows up just as defined in the code, and also behaves like a billboard. However, it remains white no matter what I do.
I suspected that there might be a problem with texcoords, so I tried the stuff in the comments (in sane combinations), to no effect, the square remains white.
The material itself seems to be working, as I use it with a v2 mesh, and it shows up as expected. How exactly the material is associated with the mesh is lost on me (using tutorial files as base), but I assume that the createItem call does the necessary work.

Here is the material script 'billboardMat':

Code: Select all

hlms billboardMat pbs
{
    ambient 0.5 0.5 0.5
    diffuse 1.0 1.0 1.0
    diffuse_map billboardtex.dds
}
The log shows no errors or hints that something went wrong (aside from a 'Buffer performance warning', but I believe that's unrelated).
My question now is, how would I diagnose what is going on? Any help is appreciated.
-j
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.3] Can't change the appearance of v1 billboard

Post by dark_sylinc »

Hi!

IIRC Billboards don't have normals (which are needed for PBS) thus you'll need to use Unlit; otherwise it's going to show up all black as lighting cannot affect it.
joshuacolossus
Gnoblar
Posts: 4
Joined: Mon Apr 12, 2021 11:31 am
x 1

Re: [2.3] Can't change the appearance of v1 billboard

Post by joshuacolossus »

You are absolutely right, that was the issue, should've tried that myself. My bad. Thanks!
Post Reply