FxLight in Xbox version
by Adam · in Torque Game Engine Advanced · 12/20/2006 (4:53 pm) · 2 replies
I spent most of today trying to figure out why fxlights aren't rendered in the TSE Xbox build. This is probably using MS3 as its base. fxLights work fine in MS4, but so many things have changed that it is really hard to track down so I have narrowed it down I think :)
In fxLight.cpp, there is a function called registerLight, I don't have the exact code but it goes something like this.
I also found that MS3 build doesn't use the Synapse lighting kit that MS4 uses so lightManager in MS4 in the above function points to a different function. In fact in MS4 LightManger.cpp is pretty much commented out.
Walking through the debugger the fxLight is never added to the lightManager, it always returns because registerLight is called when the scene is lighting. I'm not sure if this is suppose to be that way or not.
Now the second thing I noticed is that renderObject is never being called, but prepRenderObject is called. Again I'm not exactly sure of the function names, but I think I've got them right. If anyone needs the precise code, I can post it tomorrow morning.
So I took a look at projectile.cpp which calls renderObject from its prepRenderObject function. So I added renderObject(state,image); to the prepRenderObject function. It calls renderObject just like it should now, I walked through the code and it doesn't throw any errors, but still I get nothing.
I don't get the rendered image that I defined in the datablock or anything, just empty space.
So I am starting to think it may be a problem with the ScreenRenderImage that is generated in prepRenderObject function.
It goes something like this
MS4 has this commented out and has this running instead:
So has anyone had any experience trying to get fxlights to work in the Xbox version, or MS3. should I take a stab at converting RenderInstManager from MS4 into MS3. There is a huge difference between the two, MS3's file is huge, while MS4's has very little in it. I just don't understand why the render call doesn't actually display anything.
Note: fxLight.cpp and fxLight.h are included in the Windows project file, but not the Xbox project file so once I get it working on Windows I have to port it over to the Xbox version.
Please Help if you can.
Thanks in advance,
Adam
In fxLight.cpp, there is a function called registerLight, I don't have the exact code but it goes something like this.
void fxLight::registerLights(LightManager * lightManager, bool lightingScene)
{
// Exit if disabled.
if (!mEnable) return;
// Animate Light.
AnimateLight();
// Return if lighting scene or light off.
if (lightingScene || !mDataBlock->mLightOn) return;
// Setup light frame.
mLight.mPos = mAnimationPosition;
mLight.mRadius = mAnimationRadius;
mLight.mColor = mAnimationColour;
// Add light to light manager.
lightManager->addLight(&mLight, this, false);
}I also found that MS3 build doesn't use the Synapse lighting kit that MS4 uses so lightManager in MS4 in the above function points to a different function. In fact in MS4 LightManger.cpp is pretty much commented out.
Walking through the debugger the fxLight is never added to the lightManager, it always returns because registerLight is called when the scene is lighting. I'm not sure if this is suppose to be that way or not.
Now the second thing I noticed is that renderObject is never being called, but prepRenderObject is called. Again I'm not exactly sure of the function names, but I think I've got them right. If anyone needs the precise code, I can post it tomorrow morning.
So I took a look at projectile.cpp which calls renderObject from its prepRenderObject function. So I added renderObject(state,image); to the prepRenderObject function. It calls renderObject just like it should now, I walked through the code and it doesn't throw any errors, but still I get nothing.
I don't get the rendered image that I defined in the datablock or anything, just empty space.
So I am starting to think it may be a problem with the ScreenRenderImage that is generated in prepRenderObject function.
It goes something like this
SceneRenderImage* image = new SceneRenderImage; // Populate it. image->obj = this; image->isTranslucent = true; image->sortType = SceneRenderImage::EndSort; // Insert it into the scene images. state->insertRenderImage(image)
MS4 has this commented out and has this running instead:
RenderInst *ri = gRenderInstManager.allocInst(); ri->obj = this; ri->state = state; ri->type = RenderInstManager::RIT_ObjectTranslucent; ri->translucent = true; ri->calcSortPoint(this, state->getCameraPosition()); gRenderInstManager.addInst(ri);
So has anyone had any experience trying to get fxlights to work in the Xbox version, or MS3. should I take a stab at converting RenderInstManager from MS4 into MS3. There is a huge difference between the two, MS3's file is huge, while MS4's has very little in it. I just don't understand why the render call doesn't actually display anything.
Note: fxLight.cpp and fxLight.h are included in the Windows project file, but not the Xbox project file so once I get it working on Windows I have to port it over to the Xbox version.
Please Help if you can.
Thanks in advance,
Adam
About the author
#2
XB360 discussions don't really have a forum unfortunately, but we can certainly discuss your issues in email.
BTW, Manoel's suggestion is certainly the way to go to port TGE-A MS 4 stuff to your XB360 licensed code drop.
12/21/2006 (1:59 pm)
Adam: contact me via email if you would please :)XB360 discussions don't really have a forum unfortunately, but we can certainly discuss your issues in email.
BTW, Manoel's suggestion is certainly the way to go to port TGE-A MS 4 stuff to your XB360 licensed code drop.
Associate Manoel Neto
Default Studio Name
We did a prototype using the Windows version of MS3.5 and had to code a rudimentary lighting pipeline to make it work. You need to either do the same, or merge the MS4 changes into your source tree. I recommend finding something to help you do the merge: too much has changed, and going from file to file manually won't do. A mass merge/diff tool is necessary.
I had to do this we we updated our heavily modified source from MS 3.5 to MS 4, by using a local SVN repository. It goes like this:
- Create a repository (it can be local, no need for a server) and add the TSE version you used as a base to it (in your case, either the base Xbox version, or MS3, if you want to see the difference between them )
- Make a checkout to two folders (call one MINE and the other THEIRS).
- Copy all your current source tree into the MINE folder.
- Copy the newest TSE source tree into the THEIRS folder.
- Commit the THEIRS folder.
- Update the MINE folder.
That'll bring all of the MS4 changes into your source tree, and you can use TortoiseSVN to see which files are changed, and resolve any conflicts between your code and the new code.