Previous Blog Next Blog
Prev/Next Blog
by date

Plan for James "Defiant" Lupiani

Plan for James "Defiant" Lupiani
Name:James Lupiani
Date Posted:Oct 27, 2002
Rating:Not Rated
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for James Lupiani

Blog post
Messing around with multi-textured materials.
I've been playing on and off with a multipass/multitexture material system for Torque. I'm testing it using Melv May's fxRenderObject framework, and once I'm satisfied with it I intend to expand it for use in interiors and shapes.

I had a sudden inspiration while playing with the in-game tools one day that it'd be possible to use datablocks to define texture stages. So my class is actually a datablock, and optimized for network transmission. This could allow a server to specify special materials (team colors or logos perhaps?) and clients will receive them upon connection. Well, it was just a hunch. The nice thing is it fits right into the conventions that Torque uses already, and you can mess with them on the fly while the game's running. Plus, you can group a bunch of datablocks together in a script file and use them as a library or theme.

It's been a good exercise in learning the nitty gritty of multitexturing, which I've never had a chance to play with before. First I planned out what I wanted to do--which basically boiled down to something like Q3A shaders. After talking with some community members, I decided to leave out animation features, at least for my first attempt. The idea is to supplement the existing rendering without getting totally replaced whenever someone comes up with vertex and fragment shader stuff for Torque.

It actually has two implementations. First I got it working with multipass and limited blending modes, then earlier this week I got multitexturing working...at least, partially. Something's weird with it, and it won't blend more than two stages (I have a Radeon, 3 TUs). But enough tell, here's the show:


Here I've blended a little glow texture with a larger background texture using simple blend functions.


And here I've used that same larger texture as a detail map on the grass texture that comes with torque.

The way it's defined is a little messy, it's very much programmatic. I hope to come up with a more elegant solution for doing it at some point. Here's the datablock used for that second screenshot:


// Example Staged Material
datablock MaterialData( MyTestMaterial )
{
// STAGE 0 ------------------------
// Main texture
texture[0] = "~/data/terrains/grassland/grass";

// STAGE 1 ------------------------
// Detail map
texture[1] = "~/data/terrains/metal/metal2";
texMode[1] = combine;
colorMode[1] = modulate;
colorArgA[1] = previous;
colorOpA[1] = src_color;
colorArgB[1] = texture;
colorOpB[1] = src_color;
colorScale[1] = 2.0;
alphaMode[1] = replace;
alphaArgA[1] = previous;
alphaOpA[1] = src_alpha;
};


So yeah, a little messy. But it's a lot of fun to mess with so far. ;-)

Recent Blog Posts
List:10/16/06 - Community Weekend & Frozen Codebase
11/07/05 - Plan for James Lupiani
09/21/05 - Plan for James Lupiani
08/11/05 - Plan for James Lupiani
11/28/04 - Plan for James Lupiani
02/26/03 - Plan for James Lupiani
10/27/02 - Plan for James "Defiant" Lupiani
05/25/02 - Plan for James "Defiant" Lupiani

Submit ResourceSubmit your own resources!

Ben Garney   (Oct 27, 2002 at 06:17 GMT)
Pretty darn cool... Good luck getting it hammered out, those are drool worthy screenshots ;) I like the integration with Torque and the programmatic bits, too... Then again, I'm a programmer, so... ;) At least that way, it's not too hard to write an editor, like people did for Q3A shaders.

Incidentally, I noticed that your GUI stuff has a neat rounded blue theme... I want to redo the default theme stuff but am not really sure where to start. Did you do that yourself? Any wisdom for a programmer who wants to put his meagre art skills to work?

Davis Ray Sickmon, Jr   (Oct 27, 2002 at 07:13 GMT)
One word James: Rock! Look forward ta' seeing this in the engine - could be really slick!

Grant "GrantNZ" Garmonsway   (Oct 27, 2002 at 07:49 GMT)
I'll say it again, good stuff Defiant :o)

Stefan Beffy Moises   (Oct 27, 2002 at 09:27 GMT)
Deffy!! :) That looks great!! Looking forward to see that in the resources! ;)
Keep it up!
- beffy

Xavier "eXoDuS" Amado   (Oct 27, 2002 at 13:03 GMT)
Great work Defiant, the new datablock type to make the materials is a great idea!
Expecting to play with it soon :)

James Lupiani   (Oct 27, 2002 at 23:42 GMT)
Thanks guys! =) I'll try to get all the kinks worked out in a timely fashion.

Ben: Actually, that was kind of an in-between stage for my GUI. I've redone the title bar and buttons now, too. I'm trying to get a darker look to it overall. Unfortunately I'm having trouble getting some of the GUI components to listen to their profiles. I fear I'll have to dig in deep or rewrite all the profiles before I figure out what's wrong. My philosophy for my skin: keep it simple and do it a pixel at a time so it's not sloppy. And a tip that will save you time: always be consistent with the size of your bitmap arrays. Otherwise it'll probably blow up on you.

You must be a member and be logged in to either append comments or rate this resource.