About OpenGL Support
-
- Regular
- Posts: 160
- Joined: Wed Aug 22, 2007 7:59 pm
- Location: USA: New York City (school) and Massachusetts (home)
- Contact:
About OpenGL Support
I think OpenGL is supposed to fix the aspect-ratio problem.
from the virtual desk of Kazuki Mishima
- jack_norton
- Lemma-Class Veteran
- Posts: 4084
- Joined: Mon Jul 21, 2008 5:41 pm
- Completed: Too many! See my homepage
- Projects: A lot! See www.winterwolves.com
- Tumblr: winterwolvesgames
- Contact:
Re: Question for people with completed games
openGL will only accelerate reandering but won't fix any aspect ratio
Most games nowadays are full 3d so there isn't that problem anymore... but for us doing 2d games, is still there.
Most games nowadays are full 3d so there isn't that problem anymore... but for us doing 2d games, is still there.
Re: Question for people with completed games
I didn't realize the engine was going to use OpenGL in a future release
I read someone thought that would allow Ren'Py to use multiple resolutions, I don't know if that's true.
I read someone thought that would allow Ren'Py to use multiple resolutions, I don't know if that's true.
-
- Regular
- Posts: 195
- Joined: Tue Dec 15, 2009 4:20 am
- Projects: The Duke's Daughter
- Location: Cape Town
- Contact:
Re: Question for people with completed games
It would make it possible, but that isn't necessarily generally true. If you used the OpenGL and had vector graphics, you could easily resize them to whatever screen size you wanted. But in the case of bitmap images, that advantage doesn't exist. You would have to resize the images anyway, or have separate image files for each resolution. That makes for big files, or poor image quality in the case of scaling images up. Since most VNs use bitmap images, i don't know...
Mental weather report: Cloudy with a possibility of brain storms.
Re: Question for people with completed games
Actually, this is not true. The limitations of software rendering(2D) does not apply to hardware rendering(3D). They work entirely different. You are not painting/bliting bitmaps.number473 wrote:It would make it possible, but that isn't necessarily generally true. If you used the OpenGL and had vector graphics, you could easily resize them to whatever screen size you wanted. But in the case of bitmap images, that advantage doesn't exist. You would have to resize the images anyway, or have separate image files for each resolution. That makes for big files, or poor image quality in the case of scaling images up. Since most VNs use bitmap images, i don't know...
OpenGL and DirectX enables you to use a single image and have it automatically scale to whatever dimensions you need. Of course if the source image is small, it will look blurry when scaled up, but if the source image is larger it will look sharp in higher resolutions as well as lower resolutions (since it has more source pixels to work with).
The aspect ratio issue does not exist in 3D rendering either. 3D rendering is resolution agnostic by default. PyTom would have to specifically implement the limitation for that to be the case.
I'm curious to see how PyTom will implement OpenGL, as someone who's experienced the amount of work it requires first hand. (And I used DirectX, which arguably is the simpler API of the two)
- Erik B
http://www.visualnovelty.com
http://www.visualnovelty.com
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: About OpenGL Support
Since people might be a little confused (or in the case of Eric, interested) in Ren'Py's upcoming OpenGL support, I thought I would open up this thread to answer questions and manage expectations.
Ren'Py is a 2D engine, like most visual novel engines. What GL Ren'Py will do is to shift a lot of the image processing to the system's GPU, which is capable of performing massively parallel processing of image-like data. Although I haven't totally characterized the result yet, preliminary tests show this giving a large speedup in the image primitives Ren'Py uses: blitting, blending, and image-controlled blending.
There are a couple of things I'm planning on doing with that speed. The first has to do with fullscreen modes. Right now, we command the system's screen to switch from it's native resolution to one close to what the game's resolution is. This is what causes the aspect ratio problems. Improved drawing speed will allow the screen to stay in its native resolution, while Ren'Py takes care of drawing letterbox bars as necessary.
Similarly, this will allow us to adjust the size of the game in windowed mode. While the game will have a default size, the user will be able to resize the window, and Ren'Py will begin using the new size, with letterboxes added as appropriate.
GL Ren'Py will also command a sync-to-vblank. This should prevent the tearing that is possible when moving something horizontally on the screen.
For the first release of GL Ren'Py, this is pretty much it for "new" features. Things should look nicer, but in a relatively subtle way. While, in the future, I might add some support for perspective transforms, that would come later. For
I'm not sure where this talk about vector graphics is coming from. I don't have any plans to support SVG or similar in Ren'Py. While I could be convinced to change that if there was a relatively small and open SVG library that's easy to use, I'm not sure this is a GL-related issue.
Technical side of things:
GL Ren'Py is based on texture grids. When we load an image, it gets chopped up into a series of textures. Each side of a texture is either 512, 256, 128, or 64 pixels wide (the textures do not have to be square: 64x512 is a valid size). Textures include a 1 pixel border when they overlap with other textures.
The maximum image size is limited only by available ram, rather than by GPU limits.
Texture grids can be drawn to the screen using one of three operations. Each operation takes a transformation matrix to use, and can also adjust the alpha of the result.) The three operations are:
- Blit: draw a single texgrid normally.
- Blend: draw two texgrids, using a blending factor to interpolate between them.
- Imageblend: draws two texgrids, using a blending factor to interpolated betwen them. A third image is used to adjust the blending factor.
Depending on the system, these can be implemented either using the fixed-function pipeline or fragment shaders (pixel shaders in DX).
There is (or rather is going it be) render to texgrid support, which is needed (along with the blends) for doing Dissolve and ImageDissolve properly. Simply doing an alpha-blit won't cut it.
There are a couple of things I'm still not sure about the design of, yet.
- I'd like to be able to do native-resolution text.
- I'm not sure if mipmapping is necessary.
I want to experiment with both before committing to a design.
Graphics Programming isn't my specialty. (Languages is.) So this has been quite the learning experience for me, and if people want to point out flaws in my design, please do.
Ren'Py is a 2D engine, like most visual novel engines. What GL Ren'Py will do is to shift a lot of the image processing to the system's GPU, which is capable of performing massively parallel processing of image-like data. Although I haven't totally characterized the result yet, preliminary tests show this giving a large speedup in the image primitives Ren'Py uses: blitting, blending, and image-controlled blending.
There are a couple of things I'm planning on doing with that speed. The first has to do with fullscreen modes. Right now, we command the system's screen to switch from it's native resolution to one close to what the game's resolution is. This is what causes the aspect ratio problems. Improved drawing speed will allow the screen to stay in its native resolution, while Ren'Py takes care of drawing letterbox bars as necessary.
Similarly, this will allow us to adjust the size of the game in windowed mode. While the game will have a default size, the user will be able to resize the window, and Ren'Py will begin using the new size, with letterboxes added as appropriate.
GL Ren'Py will also command a sync-to-vblank. This should prevent the tearing that is possible when moving something horizontally on the screen.
For the first release of GL Ren'Py, this is pretty much it for "new" features. Things should look nicer, but in a relatively subtle way. While, in the future, I might add some support for perspective transforms, that would come later. For
I'm not sure where this talk about vector graphics is coming from. I don't have any plans to support SVG or similar in Ren'Py. While I could be convinced to change that if there was a relatively small and open SVG library that's easy to use, I'm not sure this is a GL-related issue.
Technical side of things:
GL Ren'Py is based on texture grids. When we load an image, it gets chopped up into a series of textures. Each side of a texture is either 512, 256, 128, or 64 pixels wide (the textures do not have to be square: 64x512 is a valid size). Textures include a 1 pixel border when they overlap with other textures.
The maximum image size is limited only by available ram, rather than by GPU limits.
Texture grids can be drawn to the screen using one of three operations. Each operation takes a transformation matrix to use, and can also adjust the alpha of the result.) The three operations are:
- Blit: draw a single texgrid normally.
- Blend: draw two texgrids, using a blending factor to interpolate between them.
- Imageblend: draws two texgrids, using a blending factor to interpolated betwen them. A third image is used to adjust the blending factor.
Depending on the system, these can be implemented either using the fixed-function pipeline or fragment shaders (pixel shaders in DX).
There is (or rather is going it be) render to texgrid support, which is needed (along with the blends) for doing Dissolve and ImageDissolve properly. Simply doing an alpha-blit won't cut it.
There are a couple of things I'm still not sure about the design of, yet.
- I'd like to be able to do native-resolution text.
- I'm not sure if mipmapping is necessary.
I want to experiment with both before committing to a design.
Graphics Programming isn't my specialty. (Languages is.) So this has been quite the learning experience for me, and if people want to point out flaws in my design, please do.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Miko-Class Veteran
- Posts: 701
- Joined: Sat May 26, 2007 3:41 pm
- Contact:
Re: About OpenGL Support
Yuck.PyTom wrote:This is what causes the aspect ratio problems. Improved drawing speed will allow the screen to stay in its native resolution, while Ren'Py takes care of drawing letterbox bars as necessary.
Similarly, this will allow us to adjust the size of the game in windowed mode.
I realize that this is just my subjective and somewhat controversial opinion, but it's one I feel very strongly about. OpenGL texture stretching look like shit. Bilinear filtering even more so than simple point scaling.
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: About OpenGL Support
Does it look worse than the hardware scaling found in video cards, which gets the aspect ratio wrong quite often?
Ideally, there would be no scaling, but that doesn't seem to be practical anymore.
(I'll note that the scaling algorithm implemented in Ren'Py right now is the OpenGL one.)
Ideally, there would be no scaling, but that doesn't seem to be practical anymore.
(I'll note that the scaling algorithm implemented in Ren'Py right now is the OpenGL one.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Miko-Class Veteran
- Posts: 701
- Joined: Sat May 26, 2007 3:41 pm
- Contact:
Re: About OpenGL Support
No, but it looks worse than switching resolution on a CRT monitor, and it look looks worse than black bars on an LCD monitor.PyTom wrote:Does it look worse than the hardware scaling found in video cards, which gets the aspect ratio wrong quite often?
To me, the ideal setup would be:
- Screen resolution set to the smallest aspect-ratio-preserving native resolution of the monitor that is equal or larger than the logical resolution of the game.
- Viewport set to the largest integer multiple of the logical screen resolution that is smaller or equal to the screen resolution.
- If the viewport is larger than the logical resolution of the game, use point scaling (GL_NEAREST) to scale up from the logical resolution to the viewport.
- If the viewport is smaller than the screen resolution, add a black border.
- When running in a window, only allow the window to be resized to integer multiples of the original resolution.
A third alternative would be to perform scaling in software, before handing it over to OpenGL, or in a very clever pixel shader within OpenGL. This at least allows you to use a better scaling algorithm than bilinear filtering.
Last edited by Wintermoon on Wed Feb 17, 2010 9:51 pm, edited 1 time in total.
-
- Miko-Class Veteran
- Posts: 649
- Joined: Fri Dec 16, 2005 5:21 pm
- Completed: Fading Hearts, Infinite Game Works
- Projects: Don't Save the World
- Organization: Sakura River
- Location: Canada
- Contact:
Re: About OpenGL Support
Just checking but is GL Ren'py implemented so that particles get the great performance increase from using a graphics card?
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: About OpenGL Support
Hm...
There's no particle-specific acceleration, but our current particle framework will benefit from the improved rendering performance. I may consider adding a new particle system (or integrating something like lepton), but that would be another step.
There's no particle-specific acceleration, but our current particle framework will benefit from the improved rendering performance. I may consider adding a new particle system (or integrating something like lepton), but that would be another step.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Regular
- Posts: 195
- Joined: Tue Dec 15, 2009 4:20 am
- Projects: The Duke's Daughter
- Location: Cape Town
- Contact:
Re: About OpenGL Support
I think I may have totally misunderstood >_<
I also didn't necessarily mean that you would necessarily have Ren'Py handle svg as a built in feature or something - I was just supposing that once it had OpenGL support it would be possible to set that up. I did a google search when the subject first came up (for svg OpenGl converters or stuff like that) and I got some hits, but I'll admit that I didn't research it very thoroughly.
I also didn't necessarily mean that you would necessarily have Ren'Py handle svg as a built in feature or something - I was just supposing that once it had OpenGL support it would be possible to set that up. I did a google search when the subject first came up (for svg OpenGl converters or stuff like that) and I got some hits, but I'll admit that I didn't research it very thoroughly.
Mental weather report: Cloudy with a possibility of brain storms.
-
- Regular
- Posts: 65
- Joined: Fri Dec 25, 2009 8:12 pm
- Contact:
Re: About OpenGL Support
Will it also enable the capability to record using a game recorder, like Fraps, for example?
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: About OpenGL Support
Yes. But AFAIK that ability already exists. Certainly, I was able to make Ren'Py screencasts and post them on youtube.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: No registered users