3D Stereoscopic Sample (Side-By-Side for your fancy HDTV)

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
b.hellmark
Newbie
Posts: 1
Joined: Sun Feb 09, 2014 2:49 pm
Contact:

3D Stereoscopic Sample (Side-By-Side for your fancy HDTV)

#1 Post by b.hellmark »

This is a quick sample of an implementation of stereoscopic 3D within Ren'Py.

To experience this in true 3D you will need to hook up your laptop or computer to a 3D capable TV-set that can manually switch to "Half Side-By-Side"-mode (left images first, or parallel viewing). Or else, you will just see everything double 8)

The script includes the necessary commands (hopefully commented understandable) to create the 3D effect with 2D images by positioning images on different parallaxes (for further information see here: http://www.reallusion.com/iclone/Help/i ... Vision.htm).

With the help of this script/sample you can add a 2D/3D-Diorama-effect to your existing 2D-artwork (sprites, background), similar to those paperclip creations, e.g. seen here: http://papermau.blogspot.co.at/2013/03/ ... soyou.html.

You don't have to create any special artwork for this to be used, as the script will semi-automatically create seperate views for the left and right eye from existing "mono"-artwork.

Although if you like, you can also use precreated stereo images as background artwork or for your sprites. You may even include stereoscopic videos.

Update: Version 0.2 (02-12-2014):
  • Text display has been fixed. You can now enter dialogue as usual, it will appear simultaneously on the left and right.
  • I've defined two functions which allow you to position different elements (background, sprites) on different levels of depth:

    Code: Select all

    def bg3d(image,parallax):
            return im.Composite((1280, 720),(0, 0), im.Scale(im.Crop(im.Scale(image,1280+parallax,720), (parallax, 0, 1280-parallax,720)), 640,720),(640,0), im.Scale(im.Crop(image, (0, 0, 1280-parallax,720)), 640, 720))
        def sprite3d(image,width,height,parallax,crop):
            return im.Composite((0.5*width*height/(height-crop)+640+parallax, height),(0, 0), 
                im.Scale(im.Crop(im.Scale(image,width, height),(0,crop/4, width, height-3*crop/4)), 0.5*width*height/(height-crop),height),(640+parallax,0), 
                im.Scale(im.Crop(im.Scale(image,width, height),(0,crop/4, width, height-3*crop/4)), 0.5*width*height/(height-cop),height))
    
    bg3d: Takes an (background) image and a positive value (parallax) as parameters. The greater the value of "parallax" is, the farther away from the viewer (farther behind the screen) your image will appear.

    sprite3d: Takes an image, its width and height and two additional parameters: "parallax" is again used to position an image closer to the viewer (popping out of the screen (negative value)) or farther away form the viewer (appearing behind the screen (positive value)).
    Additionally a positive value can be assigned to the "crop"-parameter which will cut off some pixels from the top and bottom of the sprite (1/4 top, 3/4 bottom) while simultaneously zooming in on the sprite (its height is preserved, its width is enlarged proportionally).

Some screenshots:

Actual gameplay:

Image

Image

Image

Anaglyph converted (red/cyan, not actual screenshots, just for easier 3D viewing):

Image

Image

Image

A quick video:


Enjoy and feel free to comment/criticize/use in your own creations.
Attachments
Renpy 3D Stereoscopic Demo_(v02).zip
Version 0.2 (fixed)
(11.02 MiB) Downloaded 174 times

User avatar
CrimsonMoon
Regular
Posts: 133
Joined: Sat Apr 26, 2014 10:00 am
Completed: Unplanned AMOUR
Projects: Scented Dream
Location: Abode of Peace
Contact:

Re: 3D Stereoscopic Sample (Side-By-Side for your fancy HDTV

#2 Post by CrimsonMoon »

I'm not using 3D but this is neat, thank you for sharing! :D

User avatar
Abraham
Newbie
Posts: 4
Joined: Sun Oct 25, 2015 8:37 pm
Organization: Almawalker
Contact:

Re: 3D Stereoscopic Sample (Side-By-Side for your fancy HDTV

#3 Post by Abraham »

Future is near!!!

User avatar
ChronoWorkS
Newbie
Posts: 16
Joined: Mon Dec 28, 2015 4:58 am
Contact:

Re: 3D Stereoscopic Sample (Side-By-Side for your fancy HDTV

#4 Post by ChronoWorkS »

The first effect needs some kind of glasses? I mean, like the red-cian to see the 3D better

User avatar
Shagwrath
Regular
Posts: 70
Joined: Tue Apr 12, 2016 8:08 pm
Projects: Shison L, Cosmic Raven
Organization: Progeny Gaming, LLC.
IRC Nick: Shagwrath
Deviantart: shawnbaybo
Location: St. Louis, MO. USA.
Contact:

Re: 3D Stereoscopic Sample (Side-By-Side for your fancy HDTV

#5 Post by Shagwrath »

b.hellmark wrote: Anaglyph converted (red/cyan, not actual screenshots, just for easier 3D viewing):
Is there anyway this could be adapted to output red/cyan anaglyph instead of the side by side stereoscopic?

I'm working on a KN with an 80's theme and I might use this for a fun little feature if it's possible.
Image
Cosmic Raven - Episode 1
[KN][Comedy][Sci-Fi][Short][18+]

User avatar
Andredron
Miko-Class Veteran
Posts: 714
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 3D Stereoscopic Sample (Side-By-Side for your fancy HDTV)

#6 Post by Andredron »

Due to my scarcity of mind, I don’t even know where this can be applied, but you have done a great job.

I saved your video back in 2016

https://m.vk.com/video189145553_4562390 ... 45553_1950

👍👍👍

Post Reply

Who is online

Users browsing this forum: No registered users