depth of field shader - Page 2

depth of field shader

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: depth of field shader

Post by very_bad_soldier »

Looks cool. Somehow 3D.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: depth of field shader

Post by Tribulex »

BWAHAHAA TILT SHIFT LULZ!!!!!!!!!!!!!!!!!!!!!!!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: depth of field shader

Post by Forboding Angel »

So playing GW2 game me an idea about this.

That game does a very minor blurring on objects that are a certain distance away, and it makes the game look even more incredible. Something like that could benefit this?
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

I'm trying to shoot video footage and maybe adding some DoF would be neat, but if the scripts fail... I'm nowhere.


jk's widget:

[f=0025595] Error in DrawScreenEffects(): [string "LuaUI\Widgets\gfx_dof.lua"]:284: bad argument #1 to 'Uniform' (number expected, got nil)
[f=0025595] Removed widget: DepthOfField

--edit:
hmm it seems to work now, if only jK's widget is called and satrik isn't

but it still has some quirck when dragging the camera around:
http://floris.ruwhof.net/upload/screen00035.jpg
http://www.youtube.com/watch?v=7OCfrq0tkmM
Seems this only happens at the sky image..

and... what line should i edit to change the strenght of the blur?


satrik's v2 widget:

[f=0025585] Error in Initialize(): [string "LuaUI\Widgets\gfx_dof2.lua"]:250: bad argument #1 to 'GetUniformLocation' (number expected, got nil)
[f=0025585] Removed widget: DepthOfField2


my setup (copied relevant infolog parts):
[CMyMath::Init] CPU SSE mask: 127, flags:
SSE 1.0: 1, SSE 2.0: 1
SSE 3.0: 1, SSSE 3.0: 1
SSE 4.1: 1, SSE 4.2: 1
SSE 4.0A: 0, SSE 5.0A: 0
using streflop SSE FP-math mode, CPU supports SSE instructions
OS: Microsoft Windows
Microsoft Windows 7 Home Premium Edition, 64-bit Service Pack 1 (build 7601)
Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz; 4084MB RAM, 8167MB pagefile
OS: emulated 32bit mode
[Watchdog] Installed (HangTimeout: 10sec)
Available log sections: KeyBindings, CSMFGroundTextures, RoamMeshDrawer, BumpWater, DynWater, SkyBox, FarTextureHandler, Model, Piece, ModelDrawer, OBJParser, WorldObjectModelRenderer, Texture, Font, CollisionVolume, GroundMoveType, Path, UnitScript, AutohostInterface, ArchiveScanner, VFS, Sound, LuaSocket
Enabled log sections: Sound(LOG_LEVEL_INFO)
Enable or disable log sections using the LogSections configuration key
or the SPRING_LOG_SECTIONS environment variable (both comma separated).
Use "none" to disable the default log sections.
LogOutput initialized.
Spring 91.0 (MT-Sim)
Build date/time: Aug 30 2012 21:06:37
Build environment: boost-104800, GNU libstdc++ version 20100429
Compiler: gcc-4.4.4

Supported Video modes: 2048x1536, 1920x1440, 1920x1200, 1920x1080, 1800x1440, 1800x1350, 1792x1344, 1600x1200, 1280x1024, 1280x800, 1280x768, 1280x720, 1152x864, 1024x768, 1024x600, 800x600, 800x480, 720x480, 640x480
Video mode set to 1920x1080/32bit
[f=0000000] SDL version: 1.2.10
[f=0000000] GL version: 3.3.11653 Compatibility Profile Context FireGL
[f=0000000] GL vendor: ATI Technologies Inc.
[f=0000000] GL renderer: ATI Mobility Radeon HD 4670
[f=0000000] GLSL version: 3.30
[f=0000000] GLEW version: 1.5.8
[f=0000000] Video RAM: total 680MB, available 905MB
[f=0000000] GL info:
haveARB: 1, haveGLSL: 1, ATI hacks: 1
FBO support: 1, NPOT-texture support: 1, 24bit Z-buffer support: 0
maximum texture size: 8192, compress MIP-map textures: 0
maximum SmoothPointSize: 63, maximum vec4 varying/attributes: 32/16
maximum drawbuffers: 8, maximum recommended indices/vertices: 16777215/2147483647
number of UniformBufferBindings: 45 (64kB)
[f=0000000] VSync disabled
[f=0000000] Joysticks found: 0
[f=0000000] Warning: Joystick 0 not found
[f=0000000] CPU Cores: 8
[f=0000000] CPU affinity not set
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: depth of field shader

Post by Satirik »

add "Spring.Echo(gl.GetShaderLog())" next to the shader creation (line 229) in my version to see what's wrong, it will print the shader compilation error logs in the console
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

got:


[f=0000000] Loading: LuaUI\Widgets\gfx_dof2.lua
[f=0000000] Fragment shader failed to compile with the following errors:
ERROR: 0:40: error(#160) Cannot convert from 'uniform float' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated


[f=0000000] false
[f=0000000] Error in Initialize(): [string "LuaUI\Widgets\gfx_dof2.lua"]:261: bad argument #1 to 'GetUniformLocation' (number expected, got nil)
[f=0000000] Removed widget:



#160: if (not canShader) then
#273: if (gl.DeleteTextureFBO) then
#261: focusLoc = gl.GetUniformLocation(dofShader,"focus")
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: depth of field shader

Post by Satirik »

try this one
Attachments
gfx_dof.lua
(8.8 KiB) Downloaded 15 times
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

works! It looks more real than the jK one but it eats a lot of fps. I guess fiddling with the options would be a good idea then.


... it still breaks down jK's widget if you switch from yours to his afterwards.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: depth of field shader

Post by Satirik »

if you want to play with the options you need to comment line 128-131

Code: Select all

  --options.quality.value  = data.quality or 2.
  --options.intensity.value = data.intensity or 1.
  --options.focusCurveExp.value = data.focusCurveExp or 2.
  --options.focusRangeMultiplier.value = data.focusRangeMultiplier or 1.
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

thnx for all the help

The rezbot-monk can finally focus on meditation now.

Image


But i still have a request, can somebody make it toggable via shortcut?

This will greatly help position the camera smoothly, and then start the slideshow with the dof toggle and capture video/take screenshto and toggle off again



and... if so, also as a bonus make a shortcut/mwheel to in/decrease dof intensity?



-- edit:
I'm already working on this myself... posting file later
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

Added key bindings:
- F10 = toggle widget rendering on/off
- CTRL+[ or ] = de/increase intensity
Added console commands:
- dofQuality #number
- dofIntensity #number

And changed some default option values



http://floris.ruwhof.net/upload/gfx_dof2.1.lua
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: depth of field shader

Post by Floris »

The widget is doing great for making new loadscreens.

But.... It only allows the focal point to be at the center of the screen.

What vars do I need to change to be able to attach the focal point to the users mouse cursor?



"The sentinels are approaching Zion!"
Image
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: depth of field shader

Post by Satirik »

here it is
Attachments
gfx_dof2.1.lua
(11.51 KiB) Downloaded 30 times
Post Reply

Return to “Lua Scripts”