View topic - LOS



All times are UTC + 1 hour


Post new topic Reply to topic  [ 69 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: LOS
PostPosted: 18 Apr 2012, 18:49 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Image
Image
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, 05:29, edited 1 time in total.
Added more cons


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 18 Apr 2012, 21:27 
User avatar

Joined: 23 Oct 2004, 00:43
They're the same.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 18 Apr 2012, 22:19 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
1 because if it looks good and is fast, mod-makers won't need to write a better one anyway.

2 would be falling into the fallacy of confusing "modders will be able to customize it" with "modders will customize it".


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 18 Apr 2012, 23:44 

Joined: 17 Sep 2008, 03:36
Location: your imagination
Wow, I love you so hard right now for making LOS better. :mrgreen:

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?


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 19 Apr 2012, 03:29 
Journeywar Developer & Mapper
User avatar

Joined: 24 Jan 2006, 21:12
Location: There is no god - and reality is his prophetess
both.
1 as default
2 as overwrite :D

Conclusion: Do not as the masses! Brutal Dictatorship is the only answer!


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 19 Apr 2012, 06:38 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
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.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 19 Apr 2012, 13:10 
Spring Developer

Joined: 16 Dec 2006, 20:59
Awesome idea! Some kind of visually smooth transition between LOS/Radar/Neither would also be nice. I.e. the unit or radar dot fades in/out. The infotex changes could also be visually smoothened for extra eyecandy.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 19 Apr 2012, 19:21 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
I can haz luaz for #2 plox? Daddy liek.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 20 Apr 2012, 05:28 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Cant share the lua yet, because it requires a couple lines of change in the engine sauce. If you are still interested, I can share my spring binary.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 20 Apr 2012, 11:04 
Moderator

Joined: 12 Oct 2007, 08:24
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.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 25 Apr 2012, 13:32 
Lua Coder

Joined: 12 Jul 2009, 17:57
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"?


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 25 Apr 2012, 16:03 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Pako, feel free to dig into engine code. It would be a boon to get cheaper and faster LOS texture updates.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 25 Apr 2012, 16:27 
Lua Coder

Joined: 12 Jul 2009, 17:57
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


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 25 Apr 2012, 16:29 
Server Owner & Developer
User avatar

Joined: 19 May 2006, 18:13
Location: Brno, Czech rep., EU, Terra, Sol, Orion arm, Milky way, Virgo supercluster
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)


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 27 Apr 2012, 21:59 
Lua Coder

Joined: 12 Jul 2009, 17:57
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)

It seems to go gadget/widget way -> very easy to change.

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:
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)


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 29 Apr 2012, 06:34 
Zero-K Developer
User avatar

Joined: 10 Sep 2008, 02:11
Location: In search for TheTruth (TM)
Why not do way #1, then allow it to switch to a gadget if the modders have specified one?


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 29 Apr 2012, 07:02 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I don't like 1:

ONLY EFFECTS TERRAIN

uneeded bloat for the engine.


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 29 Apr 2012, 08:48 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Pako, having 1 texture is very important, as texture lookups are expensive on the gpu side; doing 5 lookups is significantly expensive.
Edit: sonar can be merged into radar, as well as jammer (radar-jammer)


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 30 Apr 2012, 07:10 
User avatar

Joined: 23 Feb 2009, 16:29
Location: Finland
smoth wrote:
ONLY EFFECTS TERRAIN

What does this mean? How are units visible outside of LOS?


Top
 Offline Profile  
 
 Post subject: Re: LOS
PostPosted: 30 Apr 2012, 09:17 
User avatar

Joined: 30 Nov 2008, 04:31
Location: the flow
Quote:
How are units visible outside of LOS?

1) If they are set to always visible.
2) There is other stuff besides units that is not terrain, ex: features. these are also usually always-visible.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 69 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.