Forest Pack Q&A
by Kyle Carter · in Torque Game Engine · 10/27/2007 (1:50 am) · 196 replies
In followup to my blog post, please post any questions about the Forest Pack release here.
#122
02/18/2008 (2:45 pm)
That change needs to be done to pre-1.4 and 1.5.2 or later.In engine/sceneGraph/sceneState.h around line 337.
Find lines:
SceneRenderImage* rimage;
};
Change to read:
SceneRenderImage* rimage;
void *userData;
};
#123
02/18/2008 (3:19 pm)
Is the forest pack possible to be ported over to TGEA soon? I know one company is doing this, but it seems take forever and forbid someone to post resource like this for TGEA. I think TGEA owner need somthing awesome like this.
#124
02/18/2008 (4:20 pm)
Yep Tony I actually did add that hence my confusion :S
#125
02/18/2008 (5:06 pm)
And you're getting the same error?Quote:
error C2039: 'userData' : is not a member of 'SceneState::RenderBSPNode'
10> ../engine\sceneGraph/sceneState.h(333) : see declaration of 'SceneState::RenderBSPNode'
#126
In forestRender.cc
Change Forest::setupTexturing() to look like this:
Change Forest::initMaterials() to look like this:
Change Forest::renderNonTranslucentItems()
to this
in Forest::renderObject change
to look like this
In forestRenderMesh.cc
Change Forest::cleanMeshRender() to look like this:
Please let me know if this fixes it for you or if you're still seeing the problem.
edit typos
02/19/2008 (11:17 am)
If you're experiencing a problem with lighting where the trees appear correctly one frame and with a slight movement the lighting gets borked, try this fix:In forestRender.cc
Change Forest::setupTexturing() to look like this:
void Forest::setupTexturing()
{
// Set up some texture stage info.
// TSShapeInstance::smRenderData.baseTE = 0;
// TSShapeInstance::smRenderData.fogTE = 1;
gFogMethod = TSShapeInstance::FOG_MULTI_1;
TSShapeInstance::smRenderData.environmentMapMethod = -1;
TSShapeInstance::smRenderData.fogMethod = -1;
TSShapeInstance::smRenderData.lightMapMethod = -1;
TSShapeInstance::smRenderData.intraDetailLevel = 1.0f;
}Change Forest::initMaterials() to look like this:
void Forest::initMaterials()
{
TSMesh::initMaterials();
}Change Forest::renderNonTranslucentItems()
glActiveTextureARB(0);
to this
glActiveTextureARB(GL_TEXTURE0_ARB + TSShapeInstance::smRenderData.baseTE);
in Forest::renderObject change
// render non-translucent forest items first... glMatrixMode(GL_MODELVIEW); glEnable(GL_BLEND); glEnable(GL_LIGHTING); installLights(); setupTexturing(); initMaterials(); renderNonTranslucentItems(); uninstallLights(); dglSetCanonicalState();
to look like this
// render non-translucent forest items first... glMatrixMode(GL_MODELVIEW); glEnable(GL_BLEND); glEnable(GL_LIGHTING); installLights(); setupTexturing(); initMaterials(); renderNonTranslucentItems(); TSMesh::resetMaterials(); // <-- Add this uninstallLights(); dglSetCanonicalState();
In forestRenderMesh.cc
Change Forest::cleanMeshRender() to look like this:
void Forest::cleanMeshRender()
{
// Make sure we're doing depth tests.
glDepthMask(true);
glActiveTextureARB(GL_TEXTURE0_ARB + TSShapeInstance::smRenderData.baseTE);
TSMesh::resetMaterials();
uninstallLights();
}Please let me know if this fixes it for you or if you're still seeing the problem.
edit typos
#127

02/19/2008 (12:30 pm)
@ Tony: appears to correct the lighting as far as the foliage goes. But, the bark textures now disappear and reappear when the viewing angle changes.
#128
02/19/2008 (12:34 pm)
However this only occurs with some trees. In fact some trees never had the lighting issue to begin with.
#129
02/19/2008 (12:39 pm)
Thanks for testing and thanks a lot for the screen shots... I'll take a look at the bark textures and see what I can find.
#130
02/21/2008 (8:21 am)
I'm having a difficult time reproducing this... where can I find the trees that are exhibiting this problem?
#131
Some further testing has shown that some trees that appear fine will lose their textures at different viewing angles when zoomed in with maximum "magnification". I almost want to think that it's a LOD problem
Without your changes the textures remain but we get the "flickering light" problem from before.
02/21/2008 (12:39 pm)
I believe those trees were from the demo. Those particular trees have been around for years -- I remember seeing them in Realmwars. Ben stated they may be too old to work properly, however some of the trees that were included as new content for TGE 1.5 exhibit the same problem. Some further testing has shown that some trees that appear fine will lose their textures at different viewing angles when zoomed in with maximum "magnification". I almost want to think that it's a LOD problem
Without your changes the textures remain but we get the "flickering light" problem from before.
#132
In forestRender.cc renderNonTranslucentItems() change this:
This won't fix any of the fog problems or Z issues, but it should make your scene look presentable at least for now.
The rest of the issues are still probably going to take me another week or two to fix, but I'll continue working on it.
02/21/2008 (5:14 pm)
This has something to do with the fog bug that I'm trying to fix, but you can try this as a quick and dirty hack:In forestRender.cc renderNonTranslucentItems() change this:
// fog
U32 fm = TSShapeInstance::NO_FOG;
if (fi->getFogged())
fm = gFogMethod;
//if (gFogMethod==TSShapeInstance::FOG_MULTI_1)
{
glActiveTextureARB(GL_TEXTURE0_ARB + TSShapeInstance::smRenderData.fogTE);to this:// fog
U32 fm = TSShapeInstance::NO_FOG;
if (fi->getFogged())
fm = gFogMethod;
//if (gFogMethod==TSShapeInstance::FOG_MULTI_1)
if (TSShapeInstance::smRenderData.fogTE != TSShapeInstance::smRenderData.baseTE) // add this
{
glActiveTextureARB(GL_TEXTURE0_ARB + TSShapeInstance::smRenderData.fogTE);This won't fix any of the fog problems or Z issues, but it should make your scene look presentable at least for now.
The rest of the issues are still probably going to take me another week or two to fix, but I'll continue working on it.
#133
02/21/2008 (6:09 pm)
Yeah that prevents the textures from disappearing. It's good to see someone working on this. I've had a go at it a few times but never figured it out.
#134
02/22/2008 (6:43 am)
Thank you Tony for sharing your findings.
#135
I've made a little progress cleaning up the fog code and a few other minor issues. I'll try to complete this sometime this week.
Is anyone else actively testing this? Could you please let me know if you have any other existing problems?
03/04/2008 (3:44 pm)
Just to let you know, I'm still working on this. IMGDC is coming quickly and I've been a little side-tracked getting the IndieZen modeling, MMO framework, etc finished up, but I'd like to finish this as well.I've made a little progress cleaning up the fog code and a few other minor issues. I'll try to complete this sometime this week.
Is anyone else actively testing this? Could you please let me know if you have any other existing problems?
#136
03/04/2008 (4:25 pm)
Sounds Great Tony. The lighting/fog issue is the only one I've found.
#137
03/05/2008 (10:34 am)
It was just the flickering light/fog issue that was the show stopper for me. There were some inconsistent LOD problems mentioned at one point, but I think that was a modeling problem. Some bulletin board trees appear blurry/fuzzy at a distance -- not sure it's a problem with the forest code though.
#138
I use stock models.
It seems that only tree2, tree3 from arcane.fx "works" and even those are non-colidable and their textures are not rendered. I have read the previous posts in this thread and it seems like no one has had the same problem. I added it to sligthly modded 1.52 AFX.
04/10/2008 (2:39 pm)
I have tried out this reource, and it seems like a really nice way to easily natural looking forestes at low performance costs(or whaever shape you want many of =) ), but i have some problems:I use stock models.
It seems that only tree2, tree3 from arcane.fx "works" and even those are non-colidable and their textures are not rendered. I have read the previous posts in this thread and it seems like no one has had the same problem. I added it to sligthly modded 1.52 AFX.
#139
04/10/2008 (7:27 pm)
@ Ted: I've tried every single tree that comes provided with torque demo, starter.fps and tutorial.base and most of them do indeed work, but some work improperly. I assume that the trees in AFX are some of the same trees as they have the same names. There was a fix mentioned above that caused textures to disappear, and another fix that restored them. I've had some off-center collision issues with a few trees but no non-collideable problems.
#140
Some trees don't display correctly due to a Z buffer / transparency problem, but it's a problem with the model and not with the code itself.
There's also an issue with trees that are partially inside water... there's not a fix for this as it's basically the same problem.
I've spent the past couple of days looking for a solution to both of these problems, and there's not a simple solution, so for now I'm putting them on the back burner... if you have problems with certain trees, don't use them :P
Possibly an optional "underwater" check could be added to the Forest definition to prevent trees from rendering if it's under water, but the better solution would be to use a ForestClearing to prevent that from happening.
There is one last bug that I'm working on. This bug is visible when you use fog in a mission, but it's mostly only visible when you have fog close to the camera (i.e. a short fog distance compared to the visibility distance). The meshes get an incorrect fog amount and the transparent portions don't get any fog at all.
Other than that, I think the code is pretty stable.... I plan on doing an updated release candidate early next week.
04/11/2008 (7:03 am)
@Ted - I've not tried this with AFX yet, but I'll check it out.Some trees don't display correctly due to a Z buffer / transparency problem, but it's a problem with the model and not with the code itself.
There's also an issue with trees that are partially inside water... there's not a fix for this as it's basically the same problem.
I've spent the past couple of days looking for a solution to both of these problems, and there's not a simple solution, so for now I'm putting them on the back burner... if you have problems with certain trees, don't use them :P
Possibly an optional "underwater" check could be added to the Forest definition to prevent trees from rendering if it's under water, but the better solution would be to use a ForestClearing to prevent that from happening.
There is one last bug that I'm working on. This bug is visible when you use fog in a mission, but it's mostly only visible when you have fog close to the camera (i.e. a short fog distance compared to the visibility distance). The meshes get an incorrect fog amount and the transparent portions don't get any fog at all.
Other than that, I think the code is pretty stable.... I plan on doing an updated release candidate early next week.
Torque Owner Christian S
Oak-Entertainment
Is there something that should be treated in Afx as the 1.4 version ?