Imposters looking semitransparent & fainted with backgro

ahmedali

23-09-2008 21:38:20

I don't know whats the reason, but i would like to see more crisp/sharp-edged clear impostors

JohnJ

24-09-2008 03:01:06

Hmm... it looks like the impostor is having some mip-mapping artifacts.

You might try increasing the size of the rendered impostors (there should be a #define in ImpostorPage.h for this - make sure you delete the old impostor image to allow it to regenerate).

Another solution would be to play with Ogre's mipmap bias. If that doesn't work, I'd try generating custom mipmaps with a DDS tool to avoid the ugly hardware-generated ones here.

If you want to e-mail me your tree model and PagedGeometry setup code I can take a look and try to figure out what's causing the issue.

ahmedali

24-09-2008 10:44:42

I sent you mail which is in your profile, of model


void comGameWorld::createPagedGeometry(SceneManager* sceneMgr, Camera* camera)
{
std::cout << "..COMPONENT: comGameWorld::createPagedGeometry() {START}" << std::endl;
self = this;
using namespace PagedGeometry;
//-------------------------------------- LOAD TREES --------------------------------------
//Create and configure a new PagedGeometry instance for trees
trees = new ::PagedGeometry::PagedGeometry(camera, 80);
trees->addDetailLevel<BatchPage>(150*1, 50);
trees->addDetailLevel<ImpostorPage>(800, 50);


//Create a new TreeLoader2D object
treeLoader = new TreeLoader2D(trees, TBounds(0, 0, 3000, 3000));
trees->setPageLoader(treeLoader);

//Supply the height function to TreeLoader2D so it can calculate tree Y values
treeLoader->setHeightFunction(&getTerrainHeight);

//Load a tree entity
Entity *myTree = sceneMgr->createEntity("Tree", "palm_up.mesh");

const float xzextents = 3000;
//Randomly place 10,000 copies of the tree on the terrain
Vector3 position = Vector3::ZERO;
Radian yaw;
Real scale;
for (int i = 0; i < 60000; i++){
yaw = Degree(Math::RangeRandom(0, 360));
position.x = Math::RangeRandom(0, xzextents);
position.z = Math::RangeRandom(0, xzextents);
scale = Math::RangeRandom(0.8f, 1.3f);

treeLoader->addTree(myTree, position, yaw, scale);
}

//-------------------------------------- LOAD BUSHES --------------------------------------
//Create and configure a new PagedGeometry instance for bushes

bushes = new ::PagedGeometry::PagedGeometry(camera, 50*1);
bushes->addDetailLevel<BatchPage>(80*1, 50*1);

//Create a new TreeLoader2D object for the bushes
TreeLoader2D *bushLoader = new TreeLoader2D(bushes, TBounds(0, 0, xzextents, xzextents));
bushes->setPageLoader(bushLoader);

//Supply the height function to TreeLoader2D so it can calculate tree Y values
bushLoader->setHeightFunction(&getTerrainHeight);

//Load a bush entity
Entity *myBush = sceneMgr->createEntity("Bush", "Bush.mesh");

//Randomly place 30,000 copies of the bush on the terrain
for (int i = 0; i < 30000*0.2; i++){
yaw = Degree(Math::RangeRandom(0, 360));
position.x = Math::RangeRandom(0, xzextents);
position.z = Math::RangeRandom(0, xzextents);
scale = Math::RangeRandom(0.7f, 0.8f);

bushLoader->addTree(myBush, position, yaw, scale);
}
}

ahmedali

24-09-2008 10:58:06

@ JohnJ
Whats your email, the one in your profile does not exists?

JohnJ

24-09-2008 15:56:42

Sorry about that. I remember I removed my new email from my profile a while back because hours after I added it my email started being spammed.

My e-mail is: [removed]

ahmedali

24-09-2008 17:50:08

mail sent

JohnJ

24-09-2008 18:23:05

Ok, I'll take a look when I get a chance.

JohnJ

25-09-2008 16:26:47

Try adding this to line 364 of ImpostorPage.cpp:

p->setLightingEnabled(false);
m->setReceiveShadows(false);

t->setTextureMipmapBias(-1.0); <---- add this

if (group->getBlendMode() == ALPHA_REJECT_IMPOSTOR){


It seems to help the problem here at least. You might want to play around with the bias value to get just the right results, although don't overdo it or performance will suffer slightly. Antialiasing might help also.

The reason this problem occurred in the first place if because the palm tree mesh has a very thin profile, which combined with hardware generated mipmaps produced an ugly effect.

ahmedali

25-10-2008 14:06:52

Sorry for late reply....

I tried it, I changed mipmaps to 0 for tree's material and mipmab bias to -1 too.
I also tried changes as u have suggested, but no satisfactory results. but as you told that my tree's profile is thin...


I completely removed transparency from tree's material, removed all previous imposter files.
Re ran the program, I looked at the Impostor.VSNVRNIUFXLATITEFMXQMNKXRYUMRBZK.128 of my tree and it looked like this.

I dont know why even after disabling transparency and imposter file is rendered with transparency. It means that it is also applying high alpha_rejection greater making tree's profile very thin.



Then just to test, i changed the completely background to a darker one, and then the tree is opaque in new imposters image.

Does this all mean that my settings for alpha rejection are being replaced during imposter generation ??

JohnJ

05-11-2008 18:00:34

Impostor materials are completely separate from your tree's materials since the impostor is simply a render of the tree. The actual impostor material is set up around line 365 of ImpostorPage.cpp. It needs alpha rejection/transparency otherwise the impostor will appear as a square "billboard".

I'm not sure how else to help with this problem other than maybe increasing the impostor resolution if you haven't already. Maybe if you modified the impostor material code it could help.

(Sorry about my [really] late reply :oops:)

ahmedali

09-11-2008 10:13:17

(Sorry about my [really] late reply Embarassed)
No problem, i can understand.

I will look again into this in future, but i have lots of things in my TODO list so currently it works fine for me as I'm working on more functional features of my engine. But thanks for reply i will try to look on it in future.