Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Oolite v1.70 - Shader binding "laserHeatLevel"

For test results, bug reports, announcements of new builds etc.

Moderators: another_commander, winston, Getafix

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

Oolite v1.70 - Shader binding "laserHeatLevel"

Post by Griff »

Awesome work on the release of Oolite 1.70 Ahruman & another_commander! very cool stuff!
I hope i've posted in the correct forum but I'm having a problem with a non-player ship that is using the laserHeatLevel binding and a shader to add a glow to it's gun subentities when it fires, basically i'm not seeing any effect no matter how long it's been shooting it's beam lasers for!

To test the shader was OK i modified the binding in the shipdata.plist from :-

uniforms = { gun_heat = "laserHeatLevel"; };

to

uniforms = { gun_heat = "universalTime"; };

and in game i saw the heat glow effect as intended, so do non-player ships have a laserHeatLevel property or is this something only available to the players ship?
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Re: Oolite v1.70 - Shader binding "laserHeatLevel"

Post by TGHC »

Griff wrote:
using the laserHeatLevel binding and a shader to add a glow to it's gun subentities when it fires
Oh yes, love it.

Hope you can get it to work
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Hmm… laserHeatLevel is supposed to work for NPCs, although it’s calculated differently: (weapon_recharge_rate - shot_time) / weapon_recharge_rate (clamped to [0..1]). It seems to me that this should go through the entire heat range for each shot fired, but I’m sure I’ve tested it and found it useful.

Oh, well. Write a bug report and I may even remember to do something about it. :-)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6557
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

There seems to be one more difference between the two laserHeatLevel calculations: The PlayerEntity one consists of "pure" float values and passes a float to the clamp function, while the ShipEntity one is the result of division between doubles, which is passed on to a float variable that is used for the clamp call. Maybe we are losing accuracy in the second case, when we downgrade the result to float type?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Not in a way that should matter, for a range of 0..1. Besides, they get converted to 32-bit floats before being passed to the shader anyway.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2478
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Ah, I think it only doesn't work when the lasergun is a subentity.

I've put together a test oxp here:-
http://www.box.net/shared/h95rd0n25x edit: http://www.box.net/shared/1gm075dqu6
This uses the rocket model from the "shaders outpost" thread where the 'lasergun' is part of the main model. The laserHeatLevel glow is working great in this example.

The 2map Griff Krait oxp ( found here: http://www.box.net/shared/6ugzbf1ofo ) uses the same shader code but the guns are subentities of the main ship and the laserHeatLevel glow is not working in this example.
Last edited by Griff on Tue Dec 04, 2007 11:03 pm, edited 3 times in total.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

That again? Bah, humbug.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

This is fun. None of the uniforms on the rocket is working for me. Computers, eh?
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2478
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Oh No! the new web interface thing at box.net confused me and i posted a link to the wrong oxp, it's supposed to be this one:-

http://www.box.net/shared/1gm075dqu6

i think the one i linked to in the post above is pre-shader bindings. really sorry about that ahruman, i hope you haven't wasted too much time on it.
The good news is though that in 1.70 the "speedFactor" binding is driving engine heatglow effects in subentities which it wasn't doing in 1.69.1
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

That’s not so much “good news” as “very confusing news”. :-)

…actually, wait, I just thought of something. The laser heat binding is based on the “last shot time”. Since the parent entity never shoots, its last shot time is always in the distant past, so the lasers never get warm. This means I’ll have to special-case laserHeatLevel, and maybe some others. Or maybe just provide an explicit way to bind to subentity properties.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

BerliOS just went down as I was writing tasks and stuff regarding this. Bah.

Anyway, my current plan is to a) special-case laserHeatLevel for the 1.70-maintenance branch (which will probably result in a 1.70.1), and b) add an attribute for explicitly binding to the subentity rather than the root entity in the trunk.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

On second thought, special-casing is about as much work as the other idea, so I may as well do it right from the start.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Fixed for 1.70.1 and 1.71: shader uniforms can now take the form

Code: Select all

gun_heat = { binding = "laserHeatLevel"; bindToSubentity = YES; };
As I suspected, laserHeatLevel cycles fully between each shot for NPCs. While that’s a potentially useful property, it’s the wrong behaviour for laserHeatLevel. Ideally, a proper concept of laser overheating should be added to NPCs.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Ahruman wrote:
Anyway, my current plan is to
b) add an attribute for explicitly binding to the subentity rather than the root entity in the trunk.
Will this finally allow turrets for the player ships?
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

No, it’s not even slightly related.
Post Reply