Game Development Community

Showing a PNG or Decal

by Katrina Rose · in Torque Game Engine · 08/12/2004 (5:45 am) · 13 replies

Hi,

I have read all of the resources and forum topics on the decal subject. One of my problems is that the latest HEAD version has some of the decal code already inside the Projectile.cc and Projectile.h source code, and I don't know what to take out, and what top add to make it work. The only thing that I can see that is missing is the OnCollision code, but the decals are done differently in the .h and .cc files than the ones in the Resource Files, so I don't know what to add to OnCollision. Is there a class that I can use in scripts that will allow me to show a PNG image at specific coordinates? I have tried every class that I can think of and none have the setTransform() property. I would like to show a PNG image in the location that the bullet impacts. I would even be willing to use a .dts file if I could find a class that allowed me to setTransform() on it and it did not have too much junk in it.

Thanks for your help,

Marrion Cox

#1
08/12/2004 (11:30 am)
Does no one know the answer to this? Lol.
#2
08/12/2004 (1:01 pm)
This is quite an old resource.

But my main question is why you're not listed as a SDK owner in your profile...? That's just odd.

Oh well, hopefully the link will give you a good starting point.
#3
08/15/2004 (12:51 pm)
I'll second the question about decals in 1.2.2 - there's decals property defined and some code for it. The resource that has been mentioned seems to assume some older version of the code, without support for decals. My question is: is the code that's in current version of the engine working, or is it just some not finished attempt at adding decals? If it works does anyone have some example how is it supposed to be used?

best regards
#4
08/16/2004 (12:47 am)
Just about everything in Torque worked at one point... In most situations, it was used in a single project, then wasn't needed again. You have to remember that the codebase was used at Dynamix for many years in many projects...

Don't the footprints use the decal system?
#5
08/16/2004 (4:42 am)
Yes they do ben
#6
08/24/2004 (3:38 am)
This thread got me interested in trying out if decals work the current Torque version. I was surprised to see they actually work! BUT... the decals are really screwed up. They are in fact just a plane with a texture applied. Becuase terrain is almost never completely flat, they are most of the time only partly shown (some parts are under the terrain). They also flikker a lot (becuase they're exactly placed on the terrain level, i assume more precise video cards won't have the flikkering problem that much, but on my system they flicker a lot). They work better on interiors, BUT... when you shoot on a corner/border of the shape, the decal is placed partly in the air, pretty funny sight if you ask me.
Now, for small decals like bullet holes, this is alright I guess, I mostly experimenting with rocket explosion decals (so size 3 to 7), anything under size 0.5 looks ok tough.
Anyone knows how the decal system can be improved to allow me to use big decals??

Btw, the code:
datablock DecalData(myDecal)
  {
     sizeX       = 0.5;
     sizeY       = 0.5;
     textureName = "~/data/shapes/particles/explosionDecal1";
  };
and in the explosion datablock you place this line:
decals[0]=myDecal;
#7
08/24/2004 (3:59 am)
Is that all you have to change? I con't get it to work. No decals show. Is there something I am missing?

Thanks,

Marrion Cox
#8
08/24/2004 (4:21 am)
Yeah, that's all I did and they show up just fine. Make sure your decal texture is right, the first time i tried with a white one and that was almost invisible. Then I tried with a black one and that one showed "just fine".

But like I said, for big decals this looks really bad, I would like to see this fixed, and have no clue on how to do this myself.
#9
08/24/2004 (5:47 am)
Look at the shadow code. SceneObject::buildPolyList() in particular. Basic concept is to get the polys that lie inside a bounding box (can mask only for terrain) and then uv the decal across them.
#10
08/24/2004 (5:56 am)
Quote:Is that all you have to change? I con't get it to work.
Oops my bad.. i ment the projectile datablock and not the explosion datablock.

Quote:Look at the shadow code. SceneObject::buildPolyList() in particular. Basic concept is to get the polys that lie inside a bounding box (can mask only for terrain) and then uv the decal across them.
Like I tought, way to much for me to handle.
#11
08/24/2004 (6:01 am)
Yeah, I got it working after I put the code there. Thanks for your help. I was pulling my hair out trying to figure out how to get the bullet holes to work without changing the engine again.

Thanks,

Marrion Cox
#12
11/10/2004 (12:37 am)
@Matthew

Quote:
Look at the shadow code. SceneObject::buildPolyList() in particular. Basic concept is to get the polys that lie inside a bounding box (can mask only for terrain) and then uv the decal across them.

thanks for that pointer, doesn't look too bad given that that func already exists. Has anyone else done the dirty work so I don't have to :)
#13
11/10/2004 (3:01 am)
3d Decals Seems pretty cool, but it not enough of an idiots guide for me to even consider it.