[sldev] What's so special about grass?

Dave Parks davep at lindenlab.com
Sat Feb 16 10:15:05 PST 2008


It's possible that by skipping plantBlades, you're telling the renderer 
that the vertex buffer for that patch of grass hasn't changed.

Plant blades looks like this:

void LLVOGrass::plantBlades()
{
    // It is possible that the species of a grass is not defined
    // This is bad, but not the end of the world.
    if (!sSpeciesTable.count(mSpecies))
    {
        llinfos << "Unknown grass species " << mSpecies << llendl;
        return;
    }
   
    if (mDrawable->getNumFaces() < 1)
    {
        mDrawable->setNumFaces(1, NULL, getTEImage(0));
    }
       
    LLFace *face = mDrawable->getFace(0);

    face->setTexture(getTEImage(0));
    face->setState(LLFace::GLOBAL);
    face->setSize(mNumBlades * 8, mNumBlades * 12);
    face->mVertexBuffer = NULL;
    face->setTEOffset(0);
    face->mCenterLocal = mPosition + mRegionp->getOriginAgent();
   
    mDepth = (face->mCenterLocal - 
gCamera->getOrigin())*gCamera->getAtAxis();
    mDrawable->setPosition(face->mCenterLocal);
    mDrawable->movePartition();
    LLPipeline::sCompiles++;
}


Try setting the face size to 0 (face->setSize(0,0)).  That will tell the 
renderer that the face has no geometry to be rendered.


Anna Gulaev wrote:
> On 2/13/08, *Dave Parks* wrote:
>
>     Grass definitely ignores the INVISIBLE flag, so you'll need to add a
>     check for it in LLVOGrass.
>
>
> rebuildGeom is not being called for any spacial group that contains 
> any drawable of render type RENDER_TYPE_GRASS. Backing further up the 
> pipeline, grass objects do have a drawable, are being found by the 
> visual  mute filter, are being flagged (not using the  INVISIBLE 
> flag), are being put in the priority rebuild queue, and are being 
> found there. Someplace between there and rebuildGeom the pipeline 
> differs for grass and all other objects.
>
> Simply not calling plantBlades does not un-render grass once its been 
> rendered. Exiting updateDrawableGeom for grass objects with status 
> TRUE, every time it is called for grass, will cause grass to not be 
> rendered. Doing so once it's been rendered does not result in it beig 
> un-rendered. Setting the drawable's state to BUILT does not work. 
> Setting it to REBUILD_ALL does not work. Returning status FALSE does 
> not work. Yes, at this stage I am just making guesses. I have no clue 
> how to un-render grass.
>
>     Argent Stonecutter wrote:
>     > On 2008-02-13, at 02:34, Anna Gulaev wrote:
>     >> I don't seem to be able to keep grass from rendering using the same
>     >> mechanism that I use for everything else. I removed the RenderType
>     >> check (which did include grass) and I can then visually mute
>     >> everyting--prims, ground, sky, trees, you name it--except grass. Is
>     >> grass not in the global object list? Does it not generate object
>     >> updates?
>     >
>     > Why not look at the code that "Client->Rendering->Types->[ ]Grass"
>     > uses when you uncheck it?
>
>
> That sets a flag that prevents any grass from being rendered. That's 
> easy. Deciding on the object level seems to be tougher.
>
>



More information about the SLDev mailing list