Page 146 of 160
Re: Griff's normalmapped ship remakes
Posted: Mon May 25, 2015 5:42 pm
by Griff
Help! I'm stuck on some maths!
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";
}
and in the fragment shader like this
This looks OK, there's no errors in the oolite log.
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?
sorry about the confusingly named variables!
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>
but changing that to diffrerent values, saving the file, starting oolite and loading in the savegame file doesn't seem to make any difference - the ship is always at the same level of beatenup-ness, what have i got wrong? - it's the sums isn't
Re: Griff's normalmapped ship remakes
Posted: Mon May 25, 2015 5:53 pm
by Day
I would think: (x - 75) / 25.
Explanation: range[75-100] - 75 = range[0-25]
range[0-25]/25 = range[0-1]
So (range[75-10] - 75) / 25 = range[0-1]
Edit: what you did wrong is thinking you divided by 100, and you had a range of [0-0.25] when you had in fact a range of [0-25], so multiplying by 4 gave a range of [0-100].
Re: Griff's normalmapped ship remakes
Posted: Mon May 25, 2015 6:41 pm
by kanthoney
This grunge factor of 0.0 - does that mean no grunge or maximum grunge? If it means no grunge - which seems the obvious way round to do it - then you're trying to give a knackered ship with a trade in factor if 75 a nice pristine hull!
So I would say (100 - tradeInFactor)/25 if 0.0 means no grunge, or as Day says if it's maximum grunge.
Re: Griff's normalmapped ship remakes
Posted: Mon May 25, 2015 6:47 pm
by Day
Yup ^^
Re: Griff's normalmapped ship remakes
Posted: Mon May 25, 2015 9:41 pm
by pagroove
impressive work Griff.
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 12:25 am
by Griff
Updated the griff_station_bundle oxp to version 1.2.1 - now includes Spara's bugfix mentioned a few posts above, Thanks for fixing this oxp Spara
Thanks also for the maths help Day and kanthoney, i did have it the wrong way around in my brain i think, for some reason i thought TradeinFactor of a 100 was the ship at it's most worn out, rather than at its most pristine!
I've sorted out new shaders for the following OXPs and uploaded them to box.com - for some reason the version numbers there were really messed up, these are definitely the latest versions now, even if the numbers on some of them seem to have gone backwards - i think the uploaded wolf-MKII.zip file was v1.5 or something, whilst it was v1.4 on my pc and in the file comments on box.com
anyway, find them here
https://app.box.com/shared/rpkms25cc9
Code: Select all
griff_elite2_bug_v1.4.1.zip
griff_elite2_griffin1_v1.3.zip
griff_gnat_V1.4.2.zip
Griff_hognose_v1.3.zip
griff_ophidian_v1.2.zip
Griff_Wolf_MkII_v1.4.1.zip
The player versions of these ships should show signs of wear and tear over time as well as all the NPC versions will have a random amount a grunge on them.
I haven't played long enough to see if the player ship will wear out, i hope it does - does anyone know if there's a console command to modify the player ship tradeInFactor value whilst in game - editing the number in the save game doesn't seem to have any effect, at least not on the shader
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 12:28 am
by Cody
A pretty good reason to switch to a Wolf MK II for a while, is that - thanks!
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 12:35 am
by Griff
awesome, thanks for testing - let me know if it the ship gets more grungy over time - it should start looking dusty, then the colours will start to turn greyish before some paint starts chipping off. it's all powered from the specular intensity map so some ships work better than others depending on how careful I was creating that specmap, the core shipset don't really look good at all with this effect so i'll have to tinker about with those to see if I can get it working
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 12:54 am
by Layne
Wow, that's a really impressive use of the system to simulate wear-n'-tear!
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 7:41 am
by spara
Great Griff. I believe I have suggested it before, but now that the station bundle is quite finished (or is it?), how about putting it to the manager?
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 9:02 am
by another_commander
Griff wrote:does anyone know if there's a console command to modify the player ship tradeInFactor value whilst in game - editing the number in the save game doesn't seem to have any effect, at least not on the shader
You are looking for
player.ship.serviceLevel
and it looks like it works.
Here is the Wolf MkII at various stages of wear and tear:
Brand new:
80%:
77%:
75%:
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 9:29 am
by another_commander
Same exercise as before, Griffin MkI:
Brand new:
85%:
80%:
75%:
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 10:02 am
by Griff
Yay! That's awesome. Thanks for testing that out a_c
@spara - that's a good idea.
I've got all the logins and stuff, just need to have a look at Dizzy's excellent oxz tutorial thread and see if I can follow along.
Just looking at the station bundle oxp at the moment, I think I can take out nearly all of the Model files now, they're already in the standard game (apart from the Ico hull, looks like I've rearranged some of the UV maps at some point and the 'oolite_ico_hull.dat' causes texture seams with the bundle oxp)
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 10:24 am
by spara
Griff wrote:...I think I can take out nearly all of the Model files now, they're already in the standard game...
I would say that it's better to include the models to the OXP and possibly avoid conflicts later. Size wise the models are only a small fraction of the OXP.
Re: Griff's normalmapped ship remakes
Posted: Sun May 31, 2015 11:46 am
by Griff
That seems sensible
OK, I think this is done, the station bundle should now be up on the manager!