Game Development Community

Problem with decals

by David Bazan Carques · in Technical Issues · 06/24/2013 (3:13 am) · 5 replies

Hey guys, I just registered today but I've been following the forums for quite some time now.

Well, my problem is that my decals will render on the terrain and not in my objects/roads if I respawn facing them. Yes, this sounds weird. If I rotate the spawnsphere and I respawn looking elsewhere, then my decals are rendered perfectly on every object, but If I respawn looking straight at those decals they will only render on the terrain. I have to say that I didn't have this problem before, it started happening 2 days ago. Here are 2 pictures showing the problem:

http://i.imgur.com/jWB4TBJ.jpg Here I spawned NOT facing the decals.

http://i.imgur.com/PIbOVIX.jpg Here I spawned facing the decals.


I will add that the decals are actually there, they are not gone. If I open the decal editor and select them they will suddenly render on the road as they should. I hope you can help me, thank you all.

About the author

1 year experience in map modding (Call of Duty and Torque 3D)

Recent Threads


#1
06/24/2013 (7:49 am)
bump!
#2
06/24/2013 (8:56 am)
Try going into the decalmanager and find the prepRenderImage method, and follow a render call step by step to determine when the decals are excluded.
#3
06/24/2013 (9:02 am)
Btw it is this piece of code that determines which decals is rendered and which isn't.
Edit: (Usually, assuming your decal is in a DecalSphere which it probably is)
mDecalQueue.clear();
for ( U32 i = 0; i < grid.size(); i++ )
{
   DecalSphere* decalSphere = grid[i];
   const SphereF& worldSphere = decalSphere->mWorldSphere;

   // See if this decal sphere can be culled.

   const SceneCullingState& cullingState = state->getCullingState();
   if( haveOnlyOutdoorZone )
   {
      U32 outdoorZone = SceneZoneSpaceManager::RootZoneId;
      if( cullingState.isCulled( worldSphere, &outdoorZone, 1 ) )
         continue;
   }
   else
   {
      // Update the zoning state of the sphere, if we need to.

      if( decalSphere->mZones.size() == 0 )
         decalSphere->updateZoning( zoneManager );

      // Skip the sphere if it is not visible in any of its zones.

      if( cullingState.isCulled( worldSphere, decalSphere->mZones.address(), decalSphere->mZones.size() ) )
         continue;
   }  

   // TODO: If each sphere stored its largest decal instance we
   // could do an LOD step on it here and skip adding any of the
   // decals in the sphere.

   mDecalQueue.merge( decalSphere->mItems );
}
#4
06/24/2013 (3:37 pm)
The real question is: What did you do "two days ago" that might have caused this?
#5
06/26/2013 (4:37 am)
Well it is working now. I just spawn having the map in my back and all the decals are there, so that can be considered fixed for now. But I'm having a little problem with decals and mesh roads. In some mesh roads decals will only stick to the terrain, as you can see in this picture:

http://i.imgur.com/0yt9DMK.jpg

Edit: After hours of trying and trying to fix it, I came up with a simple solution that works like a charm. There seems to be a problem with decals not rendering properly in my mesh roads, so I created a transparent mesh on top the road, so the decals are rendered on top of the invisible mesh, and this has fixed the problem, and you can't tell the difference :D