Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualpolyfrag

Posted 09 June 2013 - 09:52 PM

Wonder how many units this supports http://forum.unity3d.com/threads/146697-Tasharen-Fog-of-War

There will be a slider to adjust to what height the map is drawn so you can see inside buildings. And everything that's not visible to the player's units (according to the depth maps) will be drawn transparent without texture. There will be holes in the floor/ceiling where staircases will go and openings in the walls/windows for shooting.

Each unit will be a spotlight with only one depth map. On each pass I will determine the pixel coordinates in the vertex shader to where it's drawing (varying vec4 that will be interpolated in the fragment shader) so that I can determine with which texel from the passed texture from the previous pass to compare which pixels are brighter. In these passes only the depth will be drawn. The textures will have to be 1024x1024 or 2048x2048 so a ratio will need to be passed of the scale between the viewport dimensions and the texture. Or maybe it's not needed, given glViewport and a projection matrix (maybe the ratios are only needed for the final pass to the screen). So it may be stretched or blurry. But this is only the visibility map and the final pass (with textures and all effects) will be for the whole screen.

So for each unit there will be a pass to draw its depth buffer from its point of view and one pass from the player's point of view to compare which pixels are in the visibility buffer (screen).

Switching render buffers frequently may affect the frame rate so I'll combine the depth maps into one or more textures by using glViewport to draw to a specific region. A 1024x1024 map will give 16 256x256 depth maps and a 2048x2048 will give 64. There has to be enought detail for them to see through slits in the wall of bunkers or something to shoot from.

One problem though is how to programmatically determine visibility, so that I know that a unit should pursue an enemy or shoot it.

Also, might be improved by deferred lighting but I don't know how.

#2polyfrag

Posted 09 June 2013 - 09:48 PM

Wonder how many units this supports http://forum.unity3d.com/threads/146697-Tasharen-Fog-of-War

There will be a slider to adjust to what height the map is drawn so you can see inside buildings. And everything that's not visible to the player's units (according to the depth maps) will be drawn transparent without texture. There will be holes in the floor/ceiling where staircases will go and openings in the walls/windows for shooting.

Each unit will be a spotlight with only one depth map. On each pass I will determine the pixel coordinates in the vertex shader to where it's drawing (varying vec4 that will be interpolated in the fragment shader) so that I can determine with which texel from the passed texture from the previous pass to compare which pixels are brighter. In these passes only the depth will be drawn. The textures will have to be 1024x1024 or 2048x2048 so a ratio will need to be passed of the scale between the viewport dimensions and the texture. Or maybe it's not needed, given glViewport and a projection matrix (maybe the ratios are only needed for the final pass to the screen). So it may be stretched or blurry. But this is only the visibility map and the final pass (with textures and all effects) will be for the whole screen.

So for each unit there will be a pass to draw its depth buffer from its point of view and one pass from the player's point of view to compare which pixels are in the visibility buffer (screen).

Switching render buffers frequently may affect the frame rate so I'll combine the depth maps into one or more textures by using glViewport to draw to a specific region. A 1024x1024 map will give 16 256x256 depth maps and a 2048x2048 will give 64. There has to be enought detail for them to see through slits in the wall of bunkers or something to shoot from.

One problem though is how to programmatically determine visibility, so that I know that a unit should pursue an enemy or shoot it.

#1polyfrag

Posted 09 June 2013 - 09:43 PM

There will be a slider to adjust to what height the map is drawn so you can see inside buildings. And everything that's not visible to the player's units (according to the depth maps) will be drawn transparent without texture. There will be holes in the floor/ceiling where staircases will go and openings in the walls/windows for shooting.

Each unit will be a spotlight with only one depth map. On each pass I will determine the pixel coordinates in the vertex shader to where it's drawing (varying vec4 that will be interpolated in the fragment shader) so that I can determine with which texel from the passed texture from the previous pass to compare which pixels are brighter. In these passes only the depth will be drawn. The textures will have to be 1024x1024 or 2048x2048 so a ratio will need to be passed of the scale between the viewport dimensions and the texture. Or maybe it's not needed, given glViewport and a projection matrix (maybe the ratios are only needed for the final pass to the screen). So it may be stretched or blurry. But this is only the visibility map and the final pass (with textures and all effects) will be for the whole screen.

So for each unit there will be a pass to draw its depth buffer from its point of view and one pass from the player's point of view to compare which pixels are in the visibility buffer (screen).

Switching render buffers frequently may affect the frame rate so I'll combine the depth maps into one or more textures by using glViewport to draw to a specific region. A 1024x1024 map will give 16 256x256 depth maps and a 2048x2048 will give 64. There has to be enought detail for them to see through slits in the wall of bunkers or something to shoot from.

One problem though is how to programmatically determine visibility, so that I know that a unit should pursue an enemy or shoot it.

PARTNERS