[April Fools] 6.12.1: 3D Support

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Message
Author
User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

[April Fools] 6.12.1: 3D Support

#1 Post by PyTom »

Disclaimer: Some variants of this feature have lead to friends of mine getting headaches. Also, _this_ has been rumored to happen. If you feel yourself having trouble, stop trying to view the images.

About a week ago, I found out about how parallax barriers work. These are a technology used in the 3DS and in some upcoming Android phones, that make it possible to have reasonable glasses-free 3D support on phones and other devices, without halfing the resolution for other uses. (I had originally thought that these devices used a lenticular approach, which would have halved the resolution all the time - that they don't is really cool.)

So, I started thinking about how I could add this support to Ren'Py - and it turned out that it wasn't all that hard. What I've done is to add a new property (depth) to Transforms and ATL. This property lets us offset the rendering of a displayable depending on which eye it's being shown to. Ren'Py then renders the display twice, once for each eye, and combines them - and we have 3d.

My current plan is to support 5 kinds of output:

Quad Buffered 3D - This is the sort of output one would use with 3D glasses, or on a device with a parallax barrier-based screen. Basically, Ren'Py will render things into the left and right buffers, as necessary. The hardware then takes care of blinking it onto the screen every other frame, and synchronizing the shutter glasses with the screen.

To be honest, I haven't really tested this out yet, as the hardware hasn't come in yet - it's on back order. I'm hoping to get this tested before 6.12.1 is actually out - the pre-releases won't have this option until I do.

Black and White Anaglyph This is the mode I test the most with - since I have red-blue 3d glasses. Basically, Ren'Py will use a shader to convert the colors to black and white, before offsetting the images sent to the red and blue/green channels. Here's a sample image:
bwanaglyph.jpg
To view this sample image, you'll need red-blue or red-cyan glasses. Place the red lens over your left eye, and look at the screen - the image should quickly become 3d. (For me, it takes about 15 seconds.)

Color Anaglyph This is similar, but without the color conversion. You'll need red-cyan 3d glasses to make this work.
coloranaglyph.jpg
Again, put the red lens over your left eye.

Side-By-Side This method doesn't require any special equipment, but does require nimble eyes.
sidebyside.jpg
To view this, you need to cross your eyes until the two images below overlap. When they do, the middle image will appear to be in 3d. Be careful - one friend of mine reported that it kind of hurt him to try this. (Several others had it work.) It's also much easier to do this if you shrink the image or step back from the computer, so you may want to try that.

None Finally, we'll have a mode that disables the stereo support, so 3d games can be played as 2d ones.

The 3d support for Ren'Py is fairly simply to enable. Transforms (ATL and otherwise) take a new depth property, which specifies how far back a given image should be. A depth of 0.0 has maximum separation, and so is as close to the user as possible. A depth of 1.0 is at the same level of as the screen - if you take off your glasses, it will look normal. Depths greater than 1.0 will tend to fall into the screen. This doesn't look all that great, IMO.

Code that uses depth looks like:

Code: Select all

label start:
    
    scene bg whitehouse:
        depth 1.0
    
    show lucy happy:
        xanchor 0.5 xpos 0.6
        depth .6

    show eileen happy:
        xanchor 0.5 xpos 0.33 
        depth .3

    e "Here's a test of the new 3d support in Ren'Py. It allows you to display a three-dimensional game using anaglyphs and side-by-side images."

    show lucy mad

    l "Hey! Why do I always have to be in the back?!"
A transform is applied to the Characters as well, to put it them at a depth of 0.0. In practice, I'd expect the depth to be placed into transforms, so one would write code like:

Code: Select all

    show lucy happy at right, back
    show eileen happy at left, front
There's a config variable, config.max_separation, that controls how far Ren'Py is willing to separate images. The greater this is, the greater the 3d effect. The user can then pick any separation from 0 to config.max_separation, so they can choose the amount of 3d that is right for them. Generally, one only wants things with no separation (that is, a depth of 1.0) to touch the edges of the screen. So it's necessary to avoid using the config.max_separation pixels on the left and right sides of the screen.

I'll also note that depth is independent of the order in which images are show. It's possible to have an image with depth of 0.0 below one with a depth of, say, .5. It will look really weird and bad (since the depth cues are conflicting in your brain), but that's not Ren'Py's problem.

Also, as you can see from the images above (if you managed to resolve them), the 3d consists of flat images stacked one over the other. It wouldn't be hard to modify Ren'Py to use a different image for the left and right eyes, at the cost of more image cache pressure - but I'm not sure anyone is actually going to the trouble of drawing stereograms, so I don't plan to support this immediately.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
sake-bento
Eileen-Class Veteran
Posts: 1909
Joined: Sat Jan 26, 2008 5:58 pm
Completed: http://sakevisual.com/games.html
Projects: Every Sunrise, Shinsei
Organization: sakevisual
Tumblr: sakevisual
Deviantart: sakevisual
itch: sakevisual
Contact:

Re: 6.12.1: 3D Support

#2 Post by sake-bento »

Yes! FINALLY, I can make that first person shooter I've always wanted to make. Thank you! This is perfect!

Mihara
Regular
Posts: 119
Joined: Thu Mar 11, 2010 2:52 pm
Contact:

Re: 6.12.1: 3D Support

#3 Post by Mihara »

I hope that there is an option to account for the reduction of apparent object size with distance in the math somewhere without manually calculating zoom for everything.
Last edited by Mihara on Fri Apr 01, 2011 6:54 am, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: 6.12.1: 3D Support

#4 Post by PyTom »

It isn't in the current version.

Honestly, I'm not sure that's something we want to do - certainly not by default. As a character gets further from the viewer, you would expect to see more of her. I think you'd want to change the sprite to compensate - like when a character is close, you see her from the waist up, but towards the back, you get a three-quarters view.

My feeling is that it's something for people to experiment with, and if best practices show up, then I'll add them to Ren'Py.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Samu-kun
King of Moé
Posts: 2262
Joined: Mon Sep 03, 2007 3:49 pm
Organization: Love in Space Inc
Location: United States
Contact:

Re: 6.12.1: 3D Support

#5 Post by Samu-kun »

Woww..... I need to redraw all the H scenes in Homeward to make the best use of this technology!

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: 6.12.1: 3D Support

#6 Post by Aleema »

It's like the words are really there! :shock:
I always hated how much the sprites looked like they belonged in the background, like they were in a game or something. Finally, my fake boyfriend can come to life.

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: 6.12.1: 3D Support

#7 Post by DaFool »

Not too long ago I actually asked for this feature. Don't dash my hopes!

Mihara
Regular
Posts: 119
Joined: Thu Mar 11, 2010 2:52 pm
Contact:

Re: 6.12.1: 3D Support

#8 Post by Mihara »

PyTom wrote:Honestly, I'm not sure that's something we want to do - certainly not by default. As a character gets further from the viewer, you would expect to see more of her. I think you'd want to change the sprite to compensate - like when a character is close, you see her from the waist up, but towards the back, you get a three-quarters view.
Not by default, certainly. However, drawing full body sprites and scaling them down is not that uncommon, (encountered in about 10% of all commercial titles I took apart) so in my opinion there should be a ready option. A hook for a function that would take depth and maybe some more scene-dependent parameters and return a zoom modifier to be applied to zoom that is declared otherwise would be the most flexible approach and allow for an easier evolution of best practices.

J. Datie
Veteran
Posts: 365
Joined: Thu Mar 01, 2007 1:30 am
Contact:

Re: 6.12.1: 3D Support

#9 Post by J. Datie »

I applaud the effort to apply new technology where it should be applied: everywhere possible. It warms my heart to see this cutting-until-it's-bleeding-edge technology available to the general public, instead of just in high budget movies that spent all their budget on the special effects. That's right, move over, Jaws 3-D, there's new competition in town! I will immediately switch to Ren'Py for this feature, as soon as I overcome my fear of decimals.

Spiky Caterpillar
Veteran
Posts: 253
Joined: Fri Nov 14, 2008 7:59 pm
Completed: Lots.
Projects: Black Closet
Organization: Slipshod
Location: Behind you.
Contact:

Re: 6.12.1: 3D Support

#10 Post by Spiky Caterpillar »

THIS. IS. AWESOME.
Nom nom nom nom nom LEAVES.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: [April Fools] 6.12.1: 3D Support

#11 Post by PyTom »

So, this was my April fool's joke - I'm pretty sure it didn't actually fool anyone, this time around. That being said, I am actually kind of curious what people would think of a feature like this, since it would be technically easy to implement, at least in OpenGL mode. I wouldn't expect to do this anytime soon - but if the current trend towards 3D displays takes off, would people be interested in making games that take advantage of them?

It's kind of interesting - what started off as a joke turned into a halfway reasonable design.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

LVUER
King of Lolies
Posts: 4538
Joined: Mon Nov 26, 2007 9:57 pm
Completed: R.S.P
Location: Bandung, West Java, Indonesia
Contact:

Re: [April Fools] 6.12.1: 3D Support

#12 Post by LVUER »

Other than gimmicky feature, I don't really know a "real" usage of 3D VN. Even a real game play still have no benefit from 3D, other than nice visuals and immersion. Still, it will be a cool feature to have.
"Double the princesses, quadruple the fun!" - Haken Browning (SRW-OG Endless Frontier)

DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: [April Fools] 6.12.1: 3D Support

#13 Post by Aleema »

PyTom wrote:So, this was my April fool's joke - I'm pretty sure it didn't actually fool anyone, this time around.
Ya always fool me for at least a little while, and ya always give me a good laugh. The "side by side" option had me tearing up.

luminarious
Veteran
Posts: 353
Joined: Thu May 01, 2008 1:12 pm
Projects: Winter, winter
Location: Estonia
Contact:

Re: [April Fools] 6.12.1: 3D Support

#14 Post by luminarious »

I am in some serious like with this idea! It adds some work when putting the game together, but hell, it looks so much better than 3D graphics (there's some sort of irony in that.. :P).

Mihara
Regular
Posts: 119
Joined: Thu Mar 11, 2010 2:52 pm
Contact:

Re: [April Fools] 6.12.1: 3D Support

#15 Post by Mihara »

Many of my best ideas ever have been born as jokes taken seriously in a "why not" fashion, often someone else's jokes. I am of the concrete opinion that this joke is also of this class, a "ha ha only serious", and firmly believe it should be implemented.

People will buy 3D-capable hardware eventually one way or another, and it's not particularly developmentally costly for the individual developer to adapt a project to use it if this feature is available. I want this feature, I'd even buy anaglyph glasses just for debugging. In the world of 2D art and visual novels this is certainly something novel and fresh, something no engine currently has. Sure, it may sound as a gimmick now, but that's until someone makes an "omg, cool!" use of it, and we can't know when that happens.

Post Reply

Who is online

Users browsing this forum: No registered users