Game Development Community

colorMultiply Does not seem to be working

by Harold Wilkins · in Torque 3D Professional · 08/19/2009 (8:31 pm) · 14 replies

The blue effect will only show after i shoot the projectile close to the player and it blows up, other wise it's normal as if i never added the colorMultiply[0] line.
I'm achieving the blue effect by adding this setting to the materials function. colorMultiply[0] = "0.0196078 0 1 1"; (That was in beta4)

In beta 5 it is doing the same as beta4. 7800gs card
www.modernpaintball.net/downloads/stuckinalpha.jpg

#1
08/19/2009 (8:46 pm)
Seems to work for me

ColorMultiply = "1.0 0.0 0.0 0.5";

Gives a red hue to my material.

Perhaps you cannot specify per layer ?
#2
08/19/2009 (8:51 pm)
I'm putting it on layer 0. I will try it with no layers and give feedback.
#3
08/19/2009 (8:59 pm)
I tried what you mentioned. No effect change here.
#4
08/19/2009 (10:50 pm)
It definately works for me in beta 5, we use it quite a bit in our game. Format requires you to put it into a layer like thi:

colorMultiply[0] = "1.0 0 0 0.5";

Make sure you provide the alpha value or else it will not work, the alpha determines how much its blended with the original texture.
#5
08/20/2009 (3:01 am)
what video cards you guys using?
#6
08/20/2009 (3:19 am)
I did some testing with a few things on this issue. What i found is this is also just like the fence problem i've posted about.
link here
I took and commented out the colorMultiply[0] line added a green to the diffuse or base texture and no color until i shoot the ground around the player in a certain radius then the glass will go green.
#7
08/20/2009 (9:26 am)
Some more information would help greatly in solving the problem.

When you shoot two things happen: a light is added to the scene and a decal is placed wherever the projectile hit. You can try helping determine which one causes the multiply effect to kick in by testing lighting and decals separately (place a point light near your model, then place a decal), since it doesn't seem to affect people with different videocards.

Also, you never made it clear: is the material translucent? If it is, then this sounds very much like the bug I was having of everything being black in basic lighting on a 7900gs: the card treats uninitialized shader constants as very large negative values, while newer cards treat them as zeroes.

You can investigate this using the NVIDIA PerfHUD. You don't even need to install the instrumented driver: installing only the PerfHUD is enough to be able to view your frame rendering draw call by draw call and inspect the shader constants used in each draw call.

Enabling PerfHUD in T3D is very easy:

1) Add this to the top of your root main.cs:
$Video::useNVPerfHud = true;
2) Right-click your EXE, go to "Send To" and select "NVIDIA PerfHUD".
3) When you run PerfHUD for the first time, it'll ask you to setup a shortcut key to activate it.
4) With your game running, press the shortcut to activate PerfHUD, then click on "frame debugger". This will take you to a screen where you can see the frame rendering step by step.
5) Click on "Advanced" to view the shaders and shader constants being used (the shaders are shown in ASM, unfortunately, but they always have a comment telling the names of each constant, so you can find them in the constant list.)

Ah, you won't be able to start your EXE via the ToolBox or by double-clicking unless you set $Video::useNVPerfHud to false.
#8
08/20/2009 (9:44 am)
Wait, I'm on a 7900GS, and making any material translucent makes them black on my project. I'll do some PerfHUD'ing for you.
#9
08/20/2009 (9:50 am)
Yep, bullseye: NaN values in the inLightColor constants. The colors for the 4 forward-rendered lights are added together, and since the NaN values are treated as massive negative numbers in the GF7 cards, the result is black.

Now to find the place in the source that is setting these constants.
#10
08/20/2009 (10:01 am)
Okay, they solved the problem with the forward lights in the basicLightManager, but forgot to duplicate the fix in advancedLightManager, which has its own setLightInfo() method (which looks nearly identical to the basicLightManager's).

Here's the fix:

In the method AdvancedLightManager::setLightInfo(), find this:
// Gather the data for the first 4 lights.
for ( U32 i=0; i < 4; i++ )

And change it to look like this:
for (U32 i = 0; i < 4; ++i)
{
   lightColors[i].set(0.0f, 0.0f, 0.0f, 0.0f);
   lightPositions[i].set(0.0f, 0.0f, 0.0f);
   lightInvRadiusSq[i] = 1.0f;
}

// Gather the data for the first 4 lights.
for ( U32 i=0; i < 4; i++ )
#11
08/20/2009 (12:55 pm)
Manoel, I Thank you for the information on this issue.

Looks like this problem will be solved on 7 series cards.

I will test this later when i get free time from work and report back.
#12
08/21/2009 (2:16 am)
Yes, this fixed the issues we were having on a 7600 7800 and 7900 cards.
#13
08/21/2009 (3:38 am)
trunk that yo! (yes, this means "add it to the T3D trunk". +plz)
#14
08/21/2009 (4:59 pm)
Logged as THREED-699