Page 4 of 4 FirstFirst ... 234
Results 61 to 72 of 72
  1. #61
    Member martinsh's Avatar
    Join Date
    Oct 2006
    Location
    riga, latvia
    Posts
    771
    leonnn
    change the:
    float gain = 2.0; //highlight gain;
    to 0.0

    Zaggy:

    sure, use it for your game.
    About the line, hmm I don't know actually. It looks like there is a problem with values or something. The transition from focused to unfocused area seems to be too hard.
    try increasing:
    float ndofdist = 2.0; //near dof falloff distance
    float fdofdist = 3.0; //far dof falloff distance

    this will make the transition smoother
    Last edited by martinsh; 16-Oct-12 at 02:44.



  2. #62
    I've got both of those values at 10 (I fiddled with all the values a lot). But I did figure something out to remove the lines (though it may not be the ideal solution). If I remove the "if(blur < 0.1)" bit, then it looks fine (though the fully focused area isn't completely focused anymore).



  3. #63
    Member martin.hedin's Avatar
    Join Date
    Jun 2012
    Location
    Las Palmas de Gran Canaria, Spain / Stockholm, Sweden
    Posts
    719
    Could someone tell me how I would go about adding a delay to the change in focus? When using AutoFocus for example, the change in focus is instant, I would like to give the camera a moment to adjust.

    EDIT: The technique that let you adjust the focus with the left mouse button already had "slowfocus", I will use that
    Last edited by martin.hedin; 08-Dec-12 at 11:03.



  4. #64
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,509
    @ martin.hedin: At the Moment I am not aware of how martinsh has gone about making his Focus work, but you can make you own D.o.F. or change this one so the Focus is set to an Object A that follows another Object B -- while Object B immediately put to the Hit-Position of a Ray casted from the Camera into it's Direction, Object A would be SLOW-PARENTED to that other Object. Now if the Focus changes with the Position of the slow-parented Object, then the Adaption will happen slow and smoothly, maybe realistically too.

    EDIT: I guess there is a Way to to this with a mathematical Function instead, but that would sound trickier to me.
    My DeviantArt (with Updates on my Adventure-Game)
    SoundCloud
    YouTubeSilent Hill Fan-Soundtrack



  5. #65
    Member martin.hedin's Avatar
    Join Date
    Jun 2012
    Location
    Las Palmas de Gran Canaria, Spain / Stockholm, Sweden
    Posts
    719
    The code to set and get focus, already had what I was looking for, under #slow focusing:
    Code:
    def setFocus():  
        Ray = cont.sensors["Ray"]
    
        pos_vec = Vector(Ray.hitPosition)
        normal_vec = Vector(Ray.hitNormal)
    
        POP_OUT = 0.01
    
        focus.alignAxisToVect(-normal_vec.xyz, 2, 1)
        normal_vec.magnitude = POP_OUT
    
        focus.worldPosition = pos_vec + normal_vec
    
    def getFocus():
        slowfocus = 0.94
        
        if not 'oldx' in own:
            own['oldx'] = 1.0
        if not 'oldy' in own:
            own['oldy'] = 1.0
        if not 'oldz' in own:
            own['oldz'] = 1.0
    
        #slow focusing
        own['oldx'] = (own['oldx']*slowfocus + focus.worldPosition[0]*(1-slowfocus))
        own['oldy'] = (own['oldy']*slowfocus + focus.worldPosition[1]*(1-slowfocus))
        own['oldz'] = (own['oldz']*slowfocus + focus.worldPosition[2]*(1-slowfocus))
    
        vecTo = Vector((own['oldx'],own['oldy'],own['oldz'])) - camera.worldPosition
    
        #z = camera.getDistanceTo(focus)
        z = vecTo.project(camera.getAxisVect((0.0, 0.0, 1.0))).magnitude
        own['focalDepth'] = z
    I just changed the setFocus in the game logic to Always with a pulse so it would not refocus constantly, instead of using the left mouse button, and I removed the vertices from the red ball so it does not show. Easy.
    Last edited by martin.hedin; 08-Dec-12 at 11:35.



  6. #66
    Member valcar3d's Avatar
    Join Date
    Oct 2012
    Location
    Mexico
    Posts
    222
    Woow, I've been looking through all the amazing shaders of martinsh and i have a very important question, How can I use/install all this, is amazing, lens flare, aereal lights DoF, Atmospheric stuff, just awesome. but how to use it? (sorry for such a noobish question I'm kind of new in BGE)



  7. #67
    Member martin.hedin's Avatar
    Join Date
    Jun 2012
    Location
    Las Palmas de Gran Canaria, Spain / Stockholm, Sweden
    Posts
    719
    Using this 2dfilter really makes my GPU running hot, but it also happens with other filters. Martinsh's DLAA filter is running much cooler for example. Is this a general problem with the blender 2dfilter system, or is this DOF code GPU intensive? Could something be changed in this code to make it run cooler?



    Originally Posted by valcar3d View Post
    Woow, I've been looking through all the amazing shaders of martinsh and i have a very important question, How can I use/install all this, is amazing, lens flare, aereal lights DoF, Atmospheric stuff, just awesome. but how to use it? (sorry for such a noobish question I'm kind of new in BGE)
    I think you should start a new thread for this question, to keep this thread about the DOF filter, but I would say:

    1) Download the blend files and look them through, take a look in the Logic Editor and see what scripts are assigned to camera and meshes etc. And also take a look in the Text Editor and look at the python code.

    2) Or try using the example blends as a start and import your geometry, that is good way to start and test things.



  8. #68
    Member Blendiac's Avatar
    Join Date
    May 2007
    Location
    North of Toronto, Ontario, Canada
    Posts
    903
    Man, those screenshots look absolutely gorgeous! That's such an impressive look that would actually let you create something very impressive looking while only using a relatively tiny amount of geometry and textures...



  9. #69
    Member Crossbit's Avatar
    Join Date
    Jul 2013
    Location
    U.S.A
    Posts
    52
    How do I set this up? I've done everything you have in the .blend and it's still not working in my scene!



  10. #70
    Member markoberto's Avatar
    Join Date
    May 2013
    Location
    Norway
    Posts
    49
    Amazing work.
    Im very interrested in the fringe/color offset part. the look is just what i've been looking for. Is there a script just for that, wich i can use in real-time?



  11. #71
    Originally Posted by Crossbit View Post
    How do I set this up? I've done everything you have in the .blend and it's still not working in my scene!
    go back to post #1 or martinsh' dev blog

    if i recall, you need a particular version of Blender

    ws



  12. #72
    strange, this not works me unless when I change "key press 1" to "always"...
    my scifi game (donation based): http://deadcyborg.com
    my Youtube Channel: https://www.youtube.com/user/gombabacsi/videos
    gamedev works: http://endrebarath.tumblr.com/



Page 4 of 4 FirstFirst ... 234

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •