First, a bit of background:
The "tradeInFactor" uniform is an integer with a value between 75 - 100.
I've got it set up as a shader uniform called 'TradeFactor' in my shipdata.plist like this
Code: Select all
uniforms ={
TradeFactor = "tradeInFactor";
}
Code: Select all
uniform int TradeFactor;
Where i'm stuck is trying to convert this integer to a floating point number in my shader, and rescale it so that '75' now equals 0.0 and '100' equals 1.0 (i'll use the floating point number to power the amount of grunge to add to the ship)
I've got this in my fragment shader code:
Code: Select all
int TFScaled = TradeFactor - 75;
float TFtempvar2 = max(0.0, float(TFScaled)); // make a floating point number out of TFScaled, don't let it go below 0.0
float TFtempvar = TFtempvar2 * 4.0; // multiply it by 4 so the previous max amount of 0.25 is now 1.0 - is this right?
This bit of code seems to work OK in rendermonkey, i can manipulate the TradeFactor int value and the grunge effect only seems to happen when it's between 75-100, with 75 being no grunge effect and 100 being max grunge effect
The problem, is when i look at the ship in game it's already looking pretty beaten up like the int value is already at 90 or so
i found this in the savegame
Code: Select all
<key>ship_trade_in_factor</key>
<integer>95</integer>