Griff's normalmapped ship remakes

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post 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

Code: Select all

   uniform int    TradeFactor;
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
Image
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 :(
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Griff's normalmapped ship remakes

Post 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].
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Griff's normalmapped ship remakes

Post 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.
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Griff's normalmapped ship remakes

Post by Day »

Yup ^^
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Re: Griff's normalmapped ship remakes

Post by pagroove »

impressive work Griff. :D
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post 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
Last edited by Griff on Sun May 31, 2015 12:29 am, edited 2 times in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Griff's normalmapped ship remakes

Post by Cody »

A pretty good reason to switch to a Wolf MK II for a while, is that - thanks!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post 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
Layne
---- E L I T E ----
---- E L I T E ----
Posts: 355
Joined: Sat Mar 28, 2015 11:14 pm

Re: Griff's normalmapped ship remakes

Post by Layne »

Wow, that's a really impressive use of the system to simulate wear-n'-tear!
Reports of my death have been greatly underestimated.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Griff's normalmapped ship remakes

Post 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?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: Griff's normalmapped ship remakes

Post 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:
Image

80%:
Image

77%:
Image

75%:
Image
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: Griff's normalmapped ship remakes

Post by another_commander »

Same exercise as before, Griffin MkI:
Brand new:
Image

85%:
Image

80%:
Image

75%:
Image
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post by Griff »

Yay! That's awesome. Thanks for testing that out a_c :D

@spara - that's a good idea. :D 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)
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Griff's normalmapped ship remakes

Post 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.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post by Griff »

That seems sensible :D
OK, I think this is done, the station bundle should now be up on the manager!
Post Reply