multiple projectile decals
by Gibby · in Torque 3D Professional · 12/03/2013 (10:33 am) · 4 replies
Greets all:
Curious, is it possible to have more than one decal for a projectile? I'd like to have five or six decals to add randomness to the bullethole effect...
Curious, is it possible to have more than one decal for a projectile? I'd like to have five or six decals to add randomness to the bullethole effect...
#2
Check out the art/decals/bullet_hole.png image and the accompanying materials and managedDecal file.
12/03/2013 (12:12 pm)
You can make a single texture, divided up into cells, and stock T3D will randomly choose the cell to use as decal. (eg: 1024 image divided into 128 pixel cells makes ... er ... math ... 8x8)Check out the art/decals/bullet_hole.png image and the accompanying materials and managedDecal file.
#3
12/03/2013 (2:01 pm)
This in the decal datablock in combination with a properly setup image sheet:randomize = "1"; texRows = "2"; texCols = "2";... numbers are for a different number of "cells" but works just like Steve indicated.
#4
I found it in my old TGE code, but this is the same without recoding...
12/04/2013 (11:42 am)
ahhhh, perfect! I found it in my old TGE code, but this is the same without recoding...
Andrew Mac
// Client (impact) decal. if ( mDataBlock->decal ) gDecalManager->addDecal( p, n, 0.0f, mDataBlock->decal );What I would do is mimic how the code works for things like stateSequence where it's an array with a maximum number of values. Create a constant to hold the max number of decals, make decal into an array, and then either pick a random number between 0 and max_decals or use the method of your choice to determine which decal to use.
Edit: spelling.