Oolite v1.70 - Shader binding "laserHeatLevel"
Moderators: winston, another_commander, Getafix
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
Oolite v1.70 - Shader binding "laserHeatLevel"
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?
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?
Re: Oolite v1.70 - Shader binding "laserHeatLevel"
Oh yes, love it.Griff wrote:using the laserHeatLevel binding and a shader to add a glow to it's gun subentities when it fires
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"
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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. :-)
Oh, well. Write a bug report and I may even remember to do something about it. :-)
E-mail: [email protected]
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
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?
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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.
E-mail: [email protected]
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
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.
I've put together a test oxp here:-
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.
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
This is fun. None of the uniforms on the rocket is working for me. Computers, eh?
E-mail: [email protected]
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
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
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
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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.
…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.
E-mail: [email protected]
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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.
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.
E-mail: [email protected]
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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.
E-mail: [email protected]
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Fixed for 1.70.1 and 1.71: shader uniforms can now take the form
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.
Code: Select all
gun_heat = { binding = "laserHeatLevel"; bindToSubentity = YES; };
E-mail: [email protected]
- Cmdr. Maegil
- Sword-toting nut-job
- Posts: 1294
- Joined: Tue Feb 27, 2007 10:28 pm
- Location: On the mend in Western Africa
Will this finally allow turrets for the player ships?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.
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.
I'm obviously not one of them.