LOS
Moderator: Moderators
LOS
Switch rapidly between images for animgif effect.
So unlike my previous attempt at this, the info texture is plugged into a fog shader.
It adds a dark fog to the out-of-los areas, and static noise to areas not covered by radar.
So there are two possible ways for this to be done:
1. Through the terrain shader (previous attempt)
Pros:
- Faster
- Better looking effects (like desaturation, hue shifts, etc)
Cons:
- Static and hard to modify (because its engine shader, hard to plug new things into it)
- only effects terrain
2. Through a depth shader gadget as shown here
Pros:
- Each mod can easily customize the way it looks
- No significant engine code needed
- Effects everything (map, grass, water surface, features)
- Allows map border fog
Cons:
- Slower
- limited set of effects (basically a transparent image overlay)
- will interact badly with map fog effect
Last edited by Beherith on 20 Apr 2012, 06:29, edited 1 time in total.
Reason: Added more cons
Reason: Added more cons
-
- Posts: 1398
- Joined: 17 Sep 2008, 04:36
Re: LOS
Wow, I love you so hard right now for making LOS better.
I wouldn't count out #2 so fast if the first one doesn't work on water (that's what it sounds like anyway). Also, what is the difference in performance like?
I wouldn't count out #2 so fast if the first one doesn't work on water (that's what it sounds like anyway). Also, what is the difference in performance like?
Re: LOS
Pxtl, fixed the images. I would like to ask Kloot and jK about their thoughts on the matter.
Currently I have added $infotex to gl.Texture, and have an additional unsyncedctrl callin that forces the generation of the los texture even if LOS mode is off.
Currently I have added $infotex to gl.Texture, and have an additional unsyncedctrl callin that forces the generation of the los texture even if LOS mode is off.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: LOS
I can haz luaz for #2 plox? Daddy liek.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: LOS
Do #2. I have already overwritten a ridiculous amount of engine behaviour so it may as well be done from the start.
#1 would be good if it works similar to how I want it to and won't randomly stop working in the future. But if you already have #1 there is no harm in including it if it can be disabled easily.
#1 would be good if it works similar to how I want it to and won't randomly stop working in the future. But if you already have #1 there is no harm in including it if it can be disabled easily.
Re: LOS
If it has not been fixed yet the infotex generation is horribly bad. It is very slow and unflexible. It could be optimized to near real time but better yet move the generation to GPU. Should be failry easy. Just do every sensor in it's own texture and if the old type texture is still needed generate it with GPU.
Just for the LOS shader would it be faster or easier when you have multiple and smaller "alpha textures"?
Just for the LOS shader would it be faster or easier when you have multiple and smaller "alpha textures"?
Re: LOS
You didn't answer the question. Is it easier to work with multiple 1 bit texture than with the infotexture? It is probably just few lines of code to generate those 1-bit textures.
(note the texture are "all" different sizes)
Different textures:
airLOS
LOS
Radar
Jammer
Sonar
(note the texture are "all" different sizes)
Different textures:
airLOS
LOS
Radar
Jammer
Sonar
Re: LOS
It seems to go gadget/widget way -> very easy to change.Licho wrote:If you go engine way, several mods have visual los > radar los so it makes no sense to add noise for areas under visual los even if they miss radar. (Switch)
I did the alpha texture uploading, it is blazing fast and easier than I imagined and works perffectly.
old way: 280 FPS -> 47 FPS
new way: 280 FPS -> 200 FPS (270FPS with optimized)
Even the texture generating works fine in Lua, only thing I didn't got yet working is blending and interpolating the alpha textures to the Lua infotex.(not necassary if the shader is changed to use the alpha textures)
I have no idea how to set the GL blending operators.
Code: Select all
gl.RenderToTexture(myInfoTex,
function()
gl.Clear(GL.COLOR_BUFFER_BIT,0,0,0,1)
--gl.LogicOp(GL.OR) --MAKE blending and inerpolating???
--gl.TexEnv(GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, GL.BLEND)
--gl.BlendFunc(GL.ONE, GL.ONE)
gl.Color(0,1,0,1)--gadget will decode the colors
gl.Texture("$sensortex_radar")
gl.TexRect(-1,-1, 1, 1,0, 0, 1, 1)
gl.Color(1,0,0,1)
gl.Texture("$sensortex_los")
gl.TexRect(-1,-1, 1, 1,0, 0, 1, 1)
gl.Color(0,0,1,1)
gl.Texture("$sensortex_jammer")
gl.TexRect(-1,1, 1, -1)
gl.Texture(false)
end)