Game Development Community

Decal problems

by Paul Weston · in Torque 3D Professional · 11/08/2011 (6:34 pm) · 16 replies

Hey all,

Just noticed that decals are no longer being left from our weapons and explosions. This used to work fine in T3D 1.01, and I never touched anything with the decal code or the related artwork it's looking for in the datablocks, etc. But now, no decals when we shoot things :(

Have only noticed it recently, and I can't know whether it's always been this way since we ported to 1.1 Final a few months ago, or if this is related to something new we've done...

The manageddecaldata.cs file is there where it should be and all the materials, etc, seem to be in order... Datablocks for the weapons have not changed since the port. It's bugging me that they're not just working.

Thought I'd check in here and see if anyone else had encountered a similar issue, and maybe get some advice as to where to look?

Anyone? Beuller? Beuller?


#1
11/08/2011 (9:15 pm)
Any errors in the console about any datablocks not found? Are your managed decal datablocks inheriting from any unmanaged ones? If you made a new decal datablock, but copied from one that was unmanaged you can end up with the scenario of your new one not loading. This is due to managed datablocks being exec'ed before the unmanaged.
#2
11/08/2011 (9:51 pm)
No console errors related to datablocks or decals...

The managedDecalData.cs script is being executed correctly and includes the same items as it always had, like:

datablock DecalData(ScorchBigDecal)
{
   Material = "DECAL_scorch";
   size = "5.0";
   lifeSpan = "50000";
};

datablock DecalData(ScorchRXDecal)
{
   Material = "DECAL_RocketEXP";
   size = "5.0";
   lifeSpan = "50000";
   randomize = "1";
   texRows = "2";
   texCols = "2";
   clippingAngle = "60";
   textureCoordCount = "3";
   textureCoords[0] = "0 0 0.5 0.5";
   textureCoords[1] = "0.5 0 0.5 0.5";
   textureCoords[2] = "0 0.5 0.5 0.5";
   textureCoords[3] = "0.5 0.5 0.5 0.5";
};

...and the materials.cs file in the same folder corresponds perfectly to it:

singleton Material(DECAL_scorch)
{
   baseTex[0] = "";
   vertColor[ 0 ] = true;

   translucent = true;
   translucentBlendOp = None;
   translucentZWrite = true;
   alphaTest = true;
   alphaRef = 84;
   mapTo = "scorch_decal.png";
   diffuseMap[0] = "art/decals/scorch_decal.png";
   vertColor[0] = "1";
   materialTag0 = "Decals";
};

singleton Material(DECAL_RocketEXP)
{
   translucent = true;
   translucentBlendOp = LerpAlpha;
   translucentZWrite = true;
   mapTo = "rBlast.png";
   diffuseMap[0] = "art/decals/rBlast.png";
   vertColor[ 0 ] = true;
   castShadows = "0";
   vertColor[0] = "1";
   materialTag0 = "Decals";
};

The following variable is set in the weapon projectile's ProjectileData datablock:

decal = ScorchBigDecal

And yet nothing appears on the walls or floors when I shoot the phaser. Like I said, this all used to work just fine, and I don't know how long it's been broken for me. Could be something from when I ported the game to 1.1 Final, something I missed or could have tripped by accident?

Thanks
#3
11/09/2011 (1:21 am)
Decals are working fine for me using 1.1 Final, Have you checked for $pref::Decals::enabled = 1 in scripts/client/prefs.cs?
#4
11/09/2011 (6:09 am)
Was hoping it was something simple like that, but sadly all those prefs.cs values are set to enabled...

I realize the decals must work in 1.1 Final, they just don't in our installation... We have a customized codebase, so when 1.1 Final was released we went into the engine source code and added/changed the things we need (various resources, etc). I was wondering if perhaps there was a specific file I might have altered that had a side effect of disabling the decals... It never happened on any of our previous ports though (1.01 to 1.1 B3 as an example...).

Side note - we are also still experiencing the weirdness of projectiles going through walls and not exploding when we are too close to a wall. I thought this was resolved in this version? We are indeed running 1.1 Final - the title bar of the game window says Torque 3D 2011 :)
#5
11/09/2011 (4:43 pm)
Did some more testing, this is a weird one...

The problem seems to be only with DAE and DTS files - if we pop in our old DIF interiors they decal fine. As does terrain if we add some in.

Funny thing is, in 1.1 B3 our DTS objects also decaled, like the main viewscreen on the bridge. Now in 1.1 Final nothing is decaling on any of our DTS or DAE objects, only on DIF and terrain.

Is there some specific setting we have to use now for our DTS/DAE assets when exporting from Milkshape, in order for them to be able to receive decals? One that was not necessary before since this all used to work fine?

Anyone from GG have any advice?

Thanks again
P
#6
11/09/2011 (7:41 pm)
What about static decals: eg, ones placed by hand in the Editor?

If you copied your level files from a previous version, try removing the levelname.mis.decals file and let it be regenerated.

I remember when the decals were first added to the T3D repo that each time the engine was re-compiled that an existing mis.decals file was incompatible with the new revision.
#7
11/09/2011 (9:16 pm)
Thanks, but didn't work either :(
#8
11/10/2011 (12:30 am)
What kind of collision do you have on your DTS shapes? If you're using visible collision, make sure you change the decal collision to use visible as well
#9
11/10/2011 (8:00 am)
Hi Spencer,

Yes, all DTS objects have Visible Mesh set for both values...

Funny - if I load the stock FPS Example, the Station walls do not decal from shooting them and that is a DTS. The floor inside does decal though which I find weird, unless it is really just terrain that looks like a floor.

Can anyone confirm that standard DTS objects receive blast decals in T3D 1.1 Final? If so, how do those objects need to be set up? Because it seems odd that in 1.1 B3 all our DTS objects would decal fine, along with our DIF interiors, but now in 1.1 Final only the DIFs are decaling - not our DTS objects. And since we recently ditched DIF interiors for DTS/DAE floors and walls, we are not seeing any blast damage anywhere in the ship when we fire our phaser.

Thanks again everyone for helping us sort this one out, it's a bit of a bugger.

P
#10
11/10/2011 (9:22 am)
How close is the terrain to the underside of the floor? Decals "float" a little....

It is strange, though - I have had no problems with decals in my projects in 1.1 Final.
#11
11/10/2011 (9:43 am)
What's your visible distance setting for your missions levelInfo?
For me, 1.1Final seems to have an issue where decals stop showing if the visible distance is reduced even though they should still be drawn.
#12
11/10/2011 (12:08 pm)
Sorry for hijacking your thread.
Having decals problems too:
Can`t insert a picture here, don`t know why it doesn`t work.
Copying the link in the browser should work. As you can see the decal is overlapping the house.

http://n30.img-up.net/?up=bad_decalwc73u.JPG
#13
11/11/2011 (7:57 am)
@Guy: Visible distance is set to 10000, it was set that way a long time ago so we could see detail on ships far away. Too much / too little?
#14
11/11/2011 (10:51 am)
It's not the issue I was thinking of then. I notice decal problems with low visible distances (<1000) sometimes.
#15
11/14/2011 (7:24 am)
OK, so more testing, more weirdness...

Checked our DTS shapes in the BlankRoom mission in the stock FPS example, and they decal fine when blasted. So I thought I'd just take the BlankRoom mission from the FPS example and try it in our game. No decals.

Then thought to check our EXE just in case one of our engine changes is screwing up the decaling, so I took the AFX Demo EXE and ran it in our game directory. Still no decals. Decals work fine in the AFX demo on its own, so it doesn't look like this is engine related.

Systematically went through a process of replacing our game bit by bit with folders from AFX Demo and FPS Example - did scripts, datablocks, core, pretty much everything, and still no decals.

Made sure that all shaders were cleared and all cached DTS objects as well, and also .decals files from the /levels folder removed. Nothing I do makes the decals show up. But yet they work in AFX Demo and the FPS example. I even thought there might be an issue with the actual weapon (since the phaser beam sometimes doesn't behave correctly and needs work), so I added the stock T3D rocket launcher to our project to see if that weapon would decal. It didn't. Turned on the rocket launcher in FPS example and it leaves decals all over the place.

Obviously, one of our custom script changes or materials settings or something is buggering the decaling, but all this systematic testing has not yet told us where the problem is...

Begging for someone to have an epiphany here of something we could check. In our 1.1 B3 game, the decals work fine, and we have not changed much in terms of scripts since upgrading to 1.1 Final. But there must be some thing I missed or did incorrectly when porting everything over. It can't be the DTS objects themselves, as they decal properly when imported to the FPS example. Can't be the mission file settings, because the BlankRoom mission (with a few of our DTS objects added) decals fine in FPS example, but does not decal when copied to our game. Copying all scripts from our 1.1 B3 game also does not change anything.

Can I get some sort of breakdown as to how the decal system works? So maybe I could trace the problem through some steps to see where it is failing? Would be nice if the console was erroring out in some way in terms of the decals, but there are no such messages indicating any problems.

Could it maybe be something as silly as video or lighting options? Have not done a systematic test of those yet, are there specific detail or lighting levels where decaling is reduced or not done on certain shapes? Because it is odd that all our DTS objects are failing to decal, but drop some terrain in or an old DIF interior and we can decal it all we want by shooting at it. Only DTS objects and also the ground plane in BlankRoom.mis are not decaling.

Totally stumped. Help?

Thanks
P
#16
11/26/2011 (9:17 pm)
For anyone interested, we solved this issue...

Narrowed it down to being AFX-specific, and Jeff Faust suggested we adjust the rendering order for decals in core/scripts/client/renderManager.cs. AFX changes this value from 0.8 to 0.41, moving the decals up in the order. This causes issues with DAE objects. Setting it back to the default solves our issue, but apparently may then result in problems with decal roads... We only use the decals for weapon damage, so this does not concern us, but for others who need all decaling rendering properly in AFX a more complete solution would have to be developed. Jeff suggests one course of action in the thread in the AFX forum.

Anyhow, just happy to have decals working again when we shoot things :)