Game Development Community

Particle Materials / Shaders

by Tom Eastman (Eastbeast314) · in Torque Game Engine Advanced · 05/03/2009 (6:30 pm) · 4 replies

I am loathe to start a thread because they always end up being exposed as silly questions, but this has got me well and truly befuddled. :)

Can particles in stock 1.8.1 have materials mapped to them?
The Barricade demo and other threads here seem to indicate that they can, but I can't for the life of me get it working.

My material that should be showing up on the particles:
new ShaderData( RefractMe )
{
   DXVertexShaderFile 	= "shaders/heatParticleRefractPixV.hlsl";
   DXPixelShaderFile 	= "shaders/heatParticleRefractPixP.hlsl";
   pixVersion = 2.0;
};

new CustomMaterial(heat)
{
   mapTo = "heat";
   texture[0] = "$backbuff";
   texture[1] = "~/data/shapes/particles/smoke_n";
   shader = RefractMe;
   version = 2.0;
   refract = true;
};

The ParticleEmitter datablock start:
datablock ParticleEmitterData(airCurrentEmitter)
{
   textureName          = "~/data/shapes/particles/heat";
   //textureName          = "heat";

If I switch the material's mapto to my player's material name(3dsMax dts-set), it works perfectly, so it's not an exec issue or something silly like that. I guess the question is, assuming that materials are supported, is the particle's textureName used the same way as the dts-exported material name is? I've also tried using the textureName on the particle and the emitter.

I took some time to look at the material system and began forcing a shader into the particle code but I was clearly going about it the wrong way so I'll ask here before I waste a day :)

Can anyone help me?

#1
05/03/2009 (8:23 pm)
They removed the use of materials from particles. The barricade demo caused some attention to this topic but by the time of the barricade video release, the code was already removed(?).

Not sure why it was removed...probably for some poor excuse. It seems a bit lame to add something useful & then remove it, no matter what the excuse. Also, I remember being told that someone could remake the heat refractions in the barricade demo, by using a material mapped to a precipitation entity....but the precipitation entities no longer use 'glow' properly, let alone materials.

I am very interested to get this working in my 1.8.1 build but I have not had the time to get to it just yet.
#2
05/03/2009 (8:32 pm)
Aw, shucks. Thanks a ton for the reply though - I searched for every keyword imaginable but couldn't find a recent discussion of it.

Indeed, that's what I started doing - moving the precipitation shader stuff over to particles, but it seemed so hacktastic that I decided to just work on gameplay stuff for a bit.

Do you have any initial thoughts on how to use materials on particles properly? If you can point me to where materials are used correctly, I can probably get a start on it.

Thanks again!
#3
05/04/2009 (1:03 am)
This is on my TODO as well. I think moving particles out into their own render instance/manager/bin should be the way to go here, but I havent't checked for sure yet.
#4
05/04/2009 (5:48 pm)
That is the issue in my hands as well, 'how to deal with it properly'.
I would rather pay someone for a working integration than spend some days on it myself. Sounds terrible..I know.