Autostereographic ("Magic Eye-like") shader-based stereo mode for the BGE #41794

Closed
opened 2014-09-11 22:36:53 +02:00 by Quentin Wenger · 13 comments

Hello everyone,

This is the first coding project I've done for Blender.

The idea is to add a stereo rendering mode for the BGE, this mode being Autostereo (you can see examples at http:*en.wikipedia.org/wiki/Autostereogram). Images using that mode are often refered to as "Magic Eye-like", from a well-known society (http:*magiceye.com/) that published such images.

My implementation uses a GLSL shader (in the same way as 2D Filters) and the depth buffer (bgl_DepthTexture).

The first implementation I created was a Python script, which took about 5 minutes to render an single image... changing completely the logic, I managed to create a shader running at a constant 60 fps.

I completely imagined the rendering logic by myself: my only sources of inspiration are still images from books, etc., that I have been familiar with for many years now ;-)

At the moment, I see following parts that could be improved (but I first wanted to receive some general feedback before going into details...):

  • The "texture" that is being deformed is a simple (pseudo-random) noise. I maybe should be replaced by a more "user-friendly" pattern (i.e. making it simple to see how eyes should be moved). Its colors (BW) are static.

  • Some parameters have had to be fixed in order to make the shader work correctly, mainly:

    • the near clipping distance of the camera (set to 0.1)
    • perspective mode of the camera
  • When using autostereo, other 2D filters are disabled (it is surely useless to have filters under the autostereo, as they won't be visible, but they could be useful higher in the stack, modifying the output of the autostereo shader).

  • There are some artefacts remaining (at the right of the image), but it is quite common and normal, even in "professional" images of that kind (this is due to the so-called "second convergence").

  • I dont really know if this could be improved, but the depth buffer highly limits the depth resolution, showing in worst case sort of aliasing / layers effect in the direction of the depth (a bit like if you had used the Remesh Blocks modifier).

How to use this mode?

Switch to BGE render mode, choose Stereo -> Autostereographic in the Render Panel. Adjust the eye separation to a convenient value (0.2 is a good choice). You can also choose to make the noise dynamical (otherwise it's hard to see moving objects in autostereo) and to draw two black dots at the bottom of the screen (to make focalization easy).

Then launch the game ;-)

Here is the .diff:
blender_ge_autostereo.diff

A screenshot of the viewport in-game (with the default cube in the center):
ge_autostereo_viewport.png

And one of the render -> stereo panel
ge_autostereo_render_panel.png

Thank you for your interest & feedback.

N.B.: it can requiere some time to get used to moving your eyes to see the 3D illusion... you can find good help topics on the Internet about how to manage that ;-)

Hello everyone, This is the first coding project I've done for Blender. The idea is to add a stereo rendering mode for the BGE, this mode being Autostereo (you can see examples at http:*en.wikipedia.org/wiki/Autostereogram). Images using that mode are often refered to as "Magic Eye-like", from a well-known society (http:*magiceye.com/) that published such images. My implementation uses a GLSL shader (in the same way as 2D Filters) and the depth buffer (bgl_DepthTexture). The first implementation I created was a Python script, which took about 5 minutes to render an single image... changing completely the logic, I managed to create a shader running at a constant 60 fps. I completely imagined the rendering logic by myself: my only sources of inspiration are still images from books, etc., that I have been familiar with for many years now ;-) At the moment, I see following parts that could be improved (but I first wanted to receive some general feedback before going into details...): - The "texture" that is being deformed is a simple (pseudo-random) noise. I maybe should be replaced by a more "user-friendly" pattern (i.e. making it simple to see how eyes should be moved). Its colors (BW) are static. - Some parameters have had to be fixed in order to make the shader work correctly, mainly: - the near clipping distance of the camera (set to 0.1) - perspective mode of the camera - When using autostereo, other 2D filters are disabled (it is surely useless to have filters under the autostereo, as they won't be visible, but they could be useful higher in the stack, modifying the output of the autostereo shader). - There are some artefacts remaining (at the right of the image), but it is quite common and normal, even in "professional" images of that kind (this is due to the so-called "second convergence"). - I dont really know if this could be improved, but the depth buffer highly limits the depth resolution, showing in worst case sort of aliasing / layers effect in the direction of the depth (a bit like if you had used the Remesh Blocks modifier). How to use this mode? Switch to BGE render mode, choose Stereo -> Autostereographic in the Render Panel. Adjust the eye separation to a convenient value (0.2 is a good choice). You can also choose to make the noise dynamical (otherwise it's hard to see moving objects in autostereo) and to draw two black dots at the bottom of the screen (to make focalization easy). Then launch the game ;-) Here is the .diff: [blender_ge_autostereo.diff](https://archive.blender.org/developer/F109931/blender_ge_autostereo.diff) A screenshot of the viewport in-game (with the default cube in the center): ![ge_autostereo_viewport.png](https://archive.blender.org/developer/F109933/ge_autostereo_viewport.png) And one of the render -> stereo panel ![ge_autostereo_render_panel.png](https://archive.blender.org/developer/F109935/ge_autostereo_render_panel.png) Thank you for your interest & feedback. N.B.: it can requiere some time to get used to moving your eyes to see the 3D illusion... you can find good help topics on the Internet about how to manage that ;-)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @QuentinWenger

Added subscriber: @QuentinWenger

Added subscribers: @dfelinto, @Moguri

Added subscribers: @dfelinto, @Moguri

Hehe that sounds like a fun patch. Have you tried to implement this as a 2D Filter? Or rather, as a Custom Filter 2D Filter?

Hehe that sounds like a fun patch. Have you tried to implement this as a 2D Filter? Or rather, as a Custom Filter 2D Filter?
Author

Thank you ;-)

Yes, sure, I tried it as a Custom 2D Filter! It actually is a 2D custom filter, internally, managed by RAS_2DFilterManager.h / .cpp. But I believe it fits better in the Stereo context, as far as the UI is concerned.

What do you think?

Thank you ;-) Yes, sure, I tried it as a Custom 2D Filter! It actually is a 2D custom filter, internally, managed by RAS_2DFilterManager.h / .cpp. But I believe it fits better in the Stereo context, as far as the UI is concerned. What do you think?
Author

I have posted a build on GraphicAll (compiled against 2.72 - Win64):

http://graphicall.org/1138

EDIT: now for linux too:

http://graphicall.org/1139

I have posted a build on GraphicAll (compiled against 2.72 - Win64): http://graphicall.org/1138 EDIT: now for linux too: http://graphicall.org/1139

Added subscriber: @you.le

Added subscriber: @you.le
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

@QuentinWenger can you add this to the differential tool?

@QuentinWenger can you add this to the differential tool?
Author

@Blendify: Hi, thanks for your interest. This project is currently abandoned from my side. Main reason (appart from the fact that it's not that well written, doesn't completly work, and that I would make many changes if I had to take it up again) is that, as @dfelinto said and as we discussed together, the patch mainly consists in a GLSL shader system. Thus, with minimal effort it is possible to use the functionality without having to put it into the source code.

But, if you really are interested with that functionality, we can theoretically still discuss about implementing such an effect "for real". I was for example thinking about an autostereo custom renderer (coded as a Python addon) in Blender... but that's another story.

@Blendify: Hi, thanks for your interest. This project is currently abandoned from my side. Main reason (appart from the fact that it's not that well written, doesn't completly work, and that I would make many changes if I had to take it up again) is that, as @dfelinto said and as we discussed together, the patch mainly consists in a GLSL shader system. Thus, with minimal effort it is possible to use the functionality without having to put it into the source code. But, if you really are interested with that functionality, we can theoretically still discuss about implementing such an effect "for real". I was for example thinking about an autostereo custom renderer (coded as a Python addon) in Blender... but that's another story.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2015-09-08 23:09:48 +02:00
Member

Sounds like it is best to archive this. At this point it sounds like it is better to start fresh

Sounds like it is best to archive this. At this point it sounds like it is better to start fresh
Author

Yep, agreed. ;-)

I should have closed it already before, actually.

Yep, agreed. ;-) I should have closed it already before, actually.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#41794
No description provided.