Page 1 of 16 12311 ... LastLast
Results 1 to 20 of 302
  1. #1
    Member martinsh's Avatar
    Join Date
    Oct 2006
    Location
    riga, latvia
    Posts
    772

    unlimited planar reflections & refraction (update)

    Hi,
    Here is a method that usually every game engine uses to render planar reflections.
    Well Blender has already texture.ImageMirror(), but it works fine unless you need a bigger reflecting surface like a lake or ocean.

    My method uses fragment (viewport) coordinates instead of geometry UV map to project reflected image to. It means that the reflecting surface size can be unlimited.

    Here are some screenshots of an ocean shader utilizing this method:
    reflection and refraction texture size is 512 px:








    update #02



    update #03


    ----------------------------------
    ocean water/underwater demo v0.95
    blend:
    https://dl.dropbox.com/u/11542084/wa...5_packed.blend

    It is a work in progress, shader code is a big mess so I would not recommend using it for projects.
    controls:
    WASD + mouse, LMB - sungrab
    P - exit game (my "Esc" key is dead)
    ----------------------------------
    ocean water/underwater demo v0.99 (in the the second video)
    blend:
    https://dl.dropboxusercontent.com/u/...ptimized.blend
    http://www.blendswap.com/blends/view/68857
    ----------------------------------
    only planar reflections setup

    All files are for Blender 2.6x only (due some changes in bge.mathutils)
    and a blend file of the setup:
    http://dl.dropbox.com/u/11542084/pla...ions_1.0.blend

    ----------------------------------
    other uses of the technique (contains many scenes):
    http://dl.dropbox.com/u/11542084/ref...ders_1.0.blend

    ----------------------------------
    update (june 22, 2013)
    water surface demo (v1.1):
    https://dl.dropboxusercontent.com/u/...face_1.1.blend

    changes since 1.0:
    • much easier to include in your project
    • fixed geometry clipping issue experienced on nvidia cards

    features:
    • reflection & refraction
    • normal map displacement (no real geometry displacement yet)
    • water sunlight scattering
    • chromatic aberration of refraction
    • accurate fresnel term
    • multi-frequency waves
    • wave choppyness simulation
    • bunch of tweakables to control all of this stuff

    screenshots:






    Last edited by martinsh; 24-Nov-13 at 20:36.



  2. #2
    Member agoose77's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    6,846
    This is too beautiful for the Game Engine. Remove it for sheer blasphemy.

    EDIT:
    Reported to the rest of the community for awesomeness.



  3. #3
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,509
    First of all, the typical empty-sounding Words, but you know we all really mean it:
    This is amazing!!! ʘ0ʘ

    For me, the File doesn't seem to refract, but as you say it's WIP, I guess it just isn't yet ATI-optimized.
    My DeviantArt (with Updates on my Adventure-Game)
    SoundCloud
    YouTubeSilent Hill Fan-Soundtrack



  4. #4
    Member 3dmedieval's Avatar
    Join Date
    Apr 2006
    Location
    Atlanta, GA
    Posts
    4,199
    Yes, that's crazy. Beautiful work.



  5. #5
    wow. just wow.
    skypename: matthew-mokazon



  6. #6
    for ATI looks like this:
    BlenderHome.com - Blender Games, User Uploads, Free Resources, Downloads, & More!



  7. #7
    Member martinsh's Avatar
    Join Date
    Oct 2006
    Location
    riga, latvia
    Posts
    772
    Thanks guys!
    yep it should look like that. Basic reflection and refraction texture, blended with fresnel term.

    new demo:
    http://dl.dropbox.com/u/11542084/pla...ions_1.0.blend
    this one uses custom shader for texture projection.

    It also has a hacky camera setup, because the reflection and refraction textures are rendered 1 frame after the scene rendering, so it has a noticeable delay, so i delayed also the first person camera to match the reflections.

    I have to polish the ocean shader and I will post it here also.
    Last edited by martinsh; 18-Jan-12 at 15:50.



  8. #8
    Member JohnnyBlack's Avatar
    Join Date
    Nov 2009
    Location
    Earth>Romania
    Posts
    1,781
    I got amazed each time i see one of.your resources! Great stuff!



  9. #9
    Member The Red Hand's Avatar
    Join Date
    Aug 2007
    Location
    Oak Ridge, TN
    Posts
    1,184
    Oh my god. A new age is upon us folks.



  10. #10
    Huh, very strange... I get a bunch of errors in the console upon loading the file saying "Node type so-and-so(such as material, camera data, etc.) doesn't exist anymore, removed". Then I get a gray(1st version) or black(second version) plane where the water should be. Definitely not a gpu problem. Do I need to have 2.6 for this? Because I'm running 2.5. Your ocean shader look.

    But anyway, your ocean shader looks absolutely amazing(in the screens), as good as almost any commercial game!

    EDIT: I've found what the problem is: Blender is butchering your nodes setup, for whatever odd reason. I guess I'll try it with 2.6
    Last edited by laser blaster; 18-Jan-12 at 22:58.



  11. #11
    Member JohnnyBlack's Avatar
    Join Date
    Nov 2009
    Location
    Earth>Romania
    Posts
    1,781
    Too bad it wont work, nice screens anyway.



  12. #12
    Member MrPutuLips's Avatar
    Join Date
    Oct 2010
    Location
    South Africa
    Posts
    1,211
    Originally Posted by BlendingBGE View Post
    Too bad it wont work, nice screens anyway.
    You seem to be having lots of problems with your computer at the moment... Maybe you need to reinstall your drivers?



  13. #13
    Member MrPutuLips's Avatar
    Join Date
    Oct 2010
    Location
    South Africa
    Posts
    1,211
    BTW can you please post the same blend as the one from the screen-shots with the amazing ocean?

    Thanks



  14. #14
    Member JohnnyBlack's Avatar
    Join Date
    Nov 2009
    Location
    Earth>Romania
    Posts
    1,781
    My result its the same as Toxa17, i guess this works on ATI only.



  15. #15
    Member agoose77's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    6,846
    Originally Posted by BlendingBGE View Post
    My result its the same as Toxa17, i guess this works on ATI only.
    It's not a problem; He hasn't released a version WITH the oceanshader yet. What you're seeing is the reflection and refraction!
    That alone is awesome!
    He will release the shader when it's finished, then you'll see how good it is



  16. #16
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,509
    For me, an ATI-User, it looks like on Toxa's Screenshot and if it is officially stated to look like this, okay, but it just doesn't initially show the Refraction. Reflection yes, but there is no obvious Refraction. I tried using a cloudy Normalmap of Mine for the so called »refraction« Texture and it still did not show any Changes, so I guess it must be handled in a different Way, but until I get to know or coincidentially find it out myself, I see no Refraction.
    My DeviantArt (with Updates on my Adventure-Game)
    SoundCloud
    YouTubeSilent Hill Fan-Soundtrack



  17. #17
    Member
    Join Date
    Mar 2008
    Location
    Aether Starbase
    Posts
    595
    Iam getting this issue on an nvidia card, so it's not limited to ATI. I am curious if the issue is a mac/PC issue. let me do some tests...
    "Lost a planet Master Obi Wan has. How embarrassing."

    my current game project



  18. #18
    Member leonnn's Avatar
    Join Date
    Dec 2008
    Location
    Brazil - PR - Maringá
    Posts
    2,554
    Great as allways martinsh, thanks for sharing this awesome script with us!
    Intel 486
    64 mb RAM/128 mg HD
    Graphic card Voodoo 122



  19. #19
    Member
    Join Date
    Mar 2008
    Location
    Aether Starbase
    Posts
    595
    ok nevermind, it's OS inspecific. (doesn't work on my windows 7 partition either.)
    "Lost a planet Master Obi Wan has. How embarrassing."

    my current game project



  20. #20
    The issue with the nodes was definitely just specific to a certain build I was using(accidentally- I thought I was using standard Blender). After switching to the regular Blender 2.5, that issue has resolved itself.

    Unfortunately, it still doesn't work. I get an opaque black plane where the water should be. The issue lies in the "watershader" glsl shader script that you're running.

    After disabling that script by deleting the logic controller that activates it, I do get the reflections, but they're tiled many times over the water plane in object or UV space(I attached an image). So RenderToTexture is working, however, your shader is not...

    My gpu is an Nvidia Geforce 6800, which I believe(correct me if I'm wrong) should theoretically be able to handle any OpenGL effects that Blender can currently throw at it. I'm able to run all kinds of glsl effects with it, so I'm a bit puzzled as to why this one doesn't work.
    Reflection.jpg

    EDIT: By playing around with the nodes setup you had already made, I managed to get properly aligned reflections and refractions on the second .blend you posted. However, the clipping of geometry below the water line(for reflections) doesn't work, for some reason(proabably due to the limitations of my gpu, nothing you could fix).
    Last edited by laser blaster; 19-Jan-12 at 23:26.



Page 1 of 16 12311 ... LastLast

Posting Permissions

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