Page 1 of 1
3d in renpy
Posted: Mon Mar 11, 2013 5:20 am
by MadMinstrel
So, assuming I'm willing to get down and dirty with the renpy source, are there any real roadblocks I should know about before trying to implement Persona 4 style 3d scenes? Renpy seems to have most of what I'd want for my project except 3d.
Re: 3d in renpy
Posted: Mon Mar 11, 2013 5:40 am
by SundownKid
AFAIK, Ren'py cannot show anything in 3D. But, if you do manage to get it working, that would be cool - it would be great if you could use Ren'py as a frontend for a 3D visual novel. I've been wanting to look into 3D but it seems that you'd have to have some kind of extensive plugin just to make a visual novel with Unity or the like.
Re: 3d in renpy
Posted: Mon Mar 11, 2013 7:00 am
by MadMinstrel
Well, don't get excited just yet. I'm still just assessing the viability. I wrote a 3d engine in C++/Opengl a while ago so I'm considering whether to port that to play nice with renpy, or to code my custom VN bits. The VN bits are actually harder to do than I imagined they would be, and Renpy has the advantage of actually having been battle tested by many users. And python is so much nicer to develop with than C++. In any case, though I'm happy to share the source, I just need it for myself so it'd be rough to use, nothing like Unity.
If I'm not mistaken renpy is already running in Opengl, so it shouldn't be that hard. It'd need geometry loaders, modelview transforms, some shaders and an animation system. That last bit is the hard part, because I haven't actually done that before. I hoping to sidestep the issue using a pc2 or alembic type system for the more complex animations, but it's clear skeletal animation will be necessary too. After that one could consider pathfinding, raycasting/mouse picking, physics, etc, but I don't actually need that for my project so somebody else would probably have to do that.
Re: 3d in renpy
Posted: Mon Mar 11, 2013 7:18 am
by SundownKid
I doubt anything like that is necessary for visual novels, or even RPGs, since you are just viewing the characters and environments. I could see being able to navigate around a 3D world as useful, though not in real time (more like a dungeon crawler).
Re: 3d in renpy
Posted: Wed Mar 13, 2013 6:05 am
by DaFool
Other way around would be better, I think... something that interprets Ren'Py code either in Unity3D or HTML5. I have so many cutscenes programmed in ATL I couldn't imagine having to redo them all over again just to use an engine more suited for realtime gameply.
Re: 3d in renpy
Posted: Wed Mar 13, 2013 4:41 pm
by ThisIsNoName
MadMinstrel wrote:
If I'm not mistaken renpy is already running in Opengl, so it shouldn't be that hard. It'd need geometry loaders, modelview transforms, some shaders and an animation system.
If I remember right, PyTom said that the OpenGL was just used to display 2D graphics, and wasn't able to show 3d. There's been a couple people who've been able to create Doom-style scenes through software rendering, but I'm not sure if it would be fast enough to display in real time.
Re: 3d in renpy
Posted: Wed Mar 13, 2013 5:19 pm
by MadMinstrel
Hi. Unless we're talking about the ancient fixed function pipeline, Opengl doesn't really care if you're displaying 2d or 3d graphics, you're filling triangles with colors in any case. All the calculations that make stuff look 3d actually take place in the vertex shaders and are the responsibility of the programmer. PyTom probably meant that he simply hasn't written the necessary code to do it, not that it's impossible per se.
Re: 3d in renpy
Posted: Wed Mar 13, 2013 6:06 pm
by muggy8
Well the thing about trying to run 3D in ren.py is that ren.py operates of python which is an interpreted language. the problem with that is the machine needs time to translate each line into machine code then run the code for each and every single line and happens every time in a loop of any sort. an to run a game at say 30 fps your looking at 1/30th of a second for each frame. when in a compiled language like C++ or Java you can hit speeds like that no problem because the program is compiled already and you dont have to recompile each line.
but i'm not sure how accurate this is but here's something to look at:
http://benchmarksgame.alioth.debian.org ... =gpp&box=1
from the looks of the table at the bottom. python is up to 100 times slower than compiled C++ and lets say your 3D application is only able to hit 30 fps and we take the avarage of that so lets say your only 50x slower so your python game is running at.... 0.6 fps.
enjoy

Re: 3d in renpy
Posted: Wed Mar 13, 2013 6:35 pm
by AxemRed
Fixed function OpenGL doesn't care about the difference between 2D and 3D either. Shaders are problematic since they're not universally supported, and even if they're supported (possibly through software emulation) may be too slow.
The speed of Python is entirely irrelevant since all the heavy lifting is handled by C code and the GPU.
Re: 3d in renpy
Posted: Wed Mar 13, 2013 6:53 pm
by PyTom
The thing with OpenGL is that, while it doesn't care about 2D vs 3D, it does care how you render things. Right now, Ren'Py assumes you're doing 2D rendering. For example, it doesn't set up a depth buffer, and it uses an orthographic projection, so there's no perspective.
That being said, this is something we can change, and that likely will change over time.
Re: 3d in renpy
Posted: Wed Mar 13, 2013 7:02 pm
by jack_norton
3d and shaders would be interesting to me for adding nice effects (also, additive alpha blending would be great).
I have no interest in full 3d right now since it's really expensive to make a game with it and the results are in most cases worse looking than a good 2d hand-painted art

Re: 3d in renpy
Posted: Thu Mar 14, 2013 1:48 am
by MadMinstrel
PyTom wrote:The thing with OpenGL is that, while it doesn't care about 2D vs 3D, it does care how you render things. Right now, Ren'Py assumes you're doing 2D rendering. For example, it doesn't set up a depth buffer, and it uses an orthographic projection, so there's no perspective.
Well, a depth buffer is going to be necessary, but the idea is to render the scene to texture and treat it just like any other background image on the VN side. That way less of the current renpy code will need changes. Alternatively we can just call the renpy bits just before the next frame. In any case, perspective vs orthographic just means the renpy-generated verts simply go through a different transform matrix (or don't, if you're currently drawing them directly in ndc space) - it won't be a problem.
Re: 3d in renpy
Posted: Tue Mar 19, 2013 1:09 pm
by TrickWithAKnife
Personally I don't feel a great need for proper 3D, but I could see how 3D elements could be useful.
For example, being able to show semi-3D buildings in the background, and when the scene moves it shows that it is 3D, or having 2D images that can be turned in different angles. The scrolling text effect from Star Wars could be another example of how 3D could be used in a simplier form.
Look at it this way - if you create the functionality, people will find a way to use it.
Re: 3d in renpy
Posted: Sat Jun 22, 2013 9:08 am
by Ryue
muggy8 wrote:Well the thing about trying to run 3D in ren.py is that ren.py operates of python which is an interpreted language. the problem with that is the machine needs time to translate each line into machine code then run the code for each and every single line and happens every time in a loop of any sort. an to run a game at say 30 fps your looking at 1/30th of a second for each frame. when in a compiled language like C++ or Java you can hit speeds like that no problem because the program is compiled already and you dont have to recompile each line.
but i'm not sure how accurate this is but here's something to look at:
http://benchmarksgame.alioth.debian.org ... =gpp&box=1
from the looks of the table at the bottom. python is up to 100 times slower than compiled C++ and lets say your 3D application is only able to hit 30 fps and we take the avarage of that so lets say your only 50x slower so your python game is running at.... 0.6 fps.
enjoy

I made a few tests myself when I worked on the 3d part of my dungeon crawler. The calculations themselves are not a problem if they are optimized enough. The main problem is the displaying itself. At least if you use a 1366 wide viewport you need to display 1366 1 pixel broad slices and that takes up to 3 seconds on my machine.
Although I must admit I
only tried the direct approach there, so there IS ver probably a way to optimize that too so that it would function. But that takes quite a lot of knowledge of how to work with pics in python/renpy and probably also a lot of time too.
(there is a 3d demo out there from what I saw, but it doesnt work on my machine....always getting an error when I tried it)
So, assuming I'm willing to get down and dirty with the renpy source, are there any real roadblocks I should know about before trying to implement Persona 4 style 3d scenes? Renpy seems to have most of what I'd want for my project except 3d.
Does it have to be REAL 3d? From how I remember persona it is mostly tilebased. And you could "simulate" 3D with pseudo 3d for it (similar to how I made my dungeon crawler, just for you it is more an isometric view angle)