Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

My Vector and Raster Thoughts
Started by Lerg Aug 10 2013 04:00 PM

7 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 538 posts
  • Corona Staff

Hello, all!

 

Great work! Polygons are coool! Fill is cool as well.

 

1) We need antialiasing! Critical feature. Without that all vector stuff just doesn't look right.

2) It's great that touch listeners on polygons are limited to it's area, but it's not perfect when stroke is involved.

3) Add support to be able to round sharp corners of polygons and polylines. -- not critical, but would be really nice

4) Direct manipulation of vertices. Like poly.vertices = {{0, 2}, {3, 4}} or just {0, 2, 3, 4}. Maybe it will be required to write one line above something like poly.vertices = poly:getVerticesTableByReference()

5) Set display.newImage() or other display object as a fill for anything.

6) DIRECT PIXEL CONTROL, if we can render to texture now, we must be able to generate images on the fly in Lua. Create a new blank image (or use already opened, that will require image:copy() or something to preserve old texture for all other image objects) and manipulate it's pixel values with obj:getPixel() and obj:setPixel().

7) Custom filters in Lua. (solvable with number 6)

8) Ability to rasterize effects (make changes permanent at runtime).

9) It would be really cool if you could just implement something similar to what Python Imaging Library is (basic functionality), http://effbot.org/imagingbook/image.htm

 

That's all for now!

Thanks,

Sergey



[TOPIC: post.html]
#2

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 3,069 posts
  • Corona SDK

Agree on all points but I can imagine this being a challenge.

It would be awesome to have whatever functions are available for the content of objects available for the stroke as well, eg: fill.

[TOPIC: post.html]
#3

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 103 posts
  • Corona SDK

+1 for pixel access!

 

P.S. This reminds me of when ActionScript 3 introduced such feature, it opened up lots of new possibilities.



[TOPIC: post.html]
#4

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

>> 1) We need antialiasing! Critical feature. Without that all vector stuff just doesn't look right.

I believe antialiasing is working again (in hardware this time). You need to enable it in the config.lua file.


[TOPIC: post.html]
#5

admin

[GLOBAL: userInfoPane.html]
admin
  • Administrator

  • 68 posts
  • Administrators

Thanks for feedback! Please give use cases, as this will help us prioritize, not to mention help us verify we're talking about the same thing!

 

In terms of raster/texture/pixel stuff, the challenge we have is to make everything work in real-time on the GPU. This is very different from the old Flash days where all graphics was done with a general purpose CPU. A GPU pipeline is designed to optimize rendering to the screen, so in GPU-land, direct pixel accesses kill performance. In fact, this is one of the reasons why Flash performance is so bad on mobile.

 

With that in mind:

 

#3: That's on the list, but it falls under convenience functions. Today, you have the ability to create any polygon you want, including ones with smoothed corners.

 

#4: Still searching for the right API design here...

 

#5: Yes, this is in essence a generalization of snapshot objects, so we're not there yet.

 

#6: Render to texture is very different from the direct pixel access you are talking about. When you create new textures with rtt, the goal is to avoid memory accesses between CPU and GPU-land --- they are all in the GPU. 

 

#7: Custom filters would be done via a filter kernel written in GLSL, not via direct pixel control.

 

#8: I'm not sure what you mean. All filter effects are rasterized in real time. 

 

#9: If you mean build textures directly from display objects, then yes. And in some ways, this may let you achieve many of the things you might otherwise want with direct pixel control.



[TOPIC: post.html]
#6

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 3,069 posts
  • Corona SDK

#6 - Is this on the roadmap? I think that I, like many others, have assumed it would be given the original use of Corona as a mobile photoshop app (back in the day) but I can see that for games it would be almost immeasurably hard to make performant.



[TOPIC: post.html]
#7

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 538 posts
  • Corona Staff

Thanks for the answers! I see the problem with the GPU land.

Firstly, I am very glad that antialiasing actually made it! I suppose with time it's gonna be supported in the simulator as well.

 

#3 Yeah, that's why not critical. It would just simplify some things on developer's side.

 

#4 I think it's wise to use tables, because you can do transitions with them. And it's easy to store and restore all the table. Since not a whole lot of people are gonna use this feature my proposition is to have a function, that will open the table to Lua side. Like obj:getVerticesTable(), it might use some methametods to detect changes and update the object. And I am totally fine with :getVetrex() and :setVertex() if nothing better can be made.

Performance wise it is better to keep such table of vertices flat (without nesting), that's totally fine too.

Another option with table would be not to use metamethods but directly tell the object it has to update itself. Like obj:updateVertices()

 

#6 and #9 Ok, direct pixel access in GPU is hard. But I want to be able to prepare/generate images at runtime in Lua (CPU) and then be able to load such images into GPU. I don't believe this could be hard. Something like loadImageFromString() or FromTable(). There is gonna be a new object type - in memory bitmap. It's better to have the implementation in C rather than using Lua tables for big images. Although it will work too.

With that in mind I would love to make various manipulations on such images. Like copy region, paste, overlay, resize, crop, compute histogram, apply function to each pixel, transpose, fill, apply some built in filters like edge detection, contrast increase and so on. That would lead to convenient Digital Image Processing in corona (like OpenCV - look at https://github.com/marcoscoffier/lua---opencv). That would be really cool!

 

Such a big library for image manipulation should become a plugin for sure. Maybe even integrating OpenCV is not a bad idea. And releasing this plugin in opensource.

 

#8 I mean that I can get a *snapshot* of filtered image and use it as a base for next filter. Maybe load it into in memory bitmap in CPU land. Chaining filters.

 

Thanks for feedback! Please give use cases, as this will help us prioritize, not to mention help us verify we're talking about the same thing!

 

In terms of raster/texture/pixel stuff, the challenge we have is to make everything work in real-time on the GPU. This is very different from the old Flash days where all graphics was done with a general purpose CPU. A GPU pipeline is designed to optimize rendering to the screen, so in GPU-land, direct pixel accesses kill performance. In fact, this is one of the reasons why Flash performance is so bad on mobile.

 

With that in mind:

 

#3: That's on the list, but it falls under convenience functions. Today, you have the ability to create any polygon you want, including ones with smoothed corners.

 

#4: Still searching for the right API design here...

 

#5: Yes, this is in essence a generalization of snapshot objects, so we're not there yet.

 

#6: Render to texture is very different from the direct pixel access you are talking about. When you create new textures with rtt, the goal is to avoid memory accesses between CPU and GPU-land --- they are all in the GPU. 

 

#7: Custom filters would be done via a filter kernel written in GLSL, not via direct pixel control.

 

#8: I'm not sure what you mean. All filter effects are rasterized in real time. 

 

#9: If you mean build textures directly from display objects, then yes. And in some ways, this may let you achieve many of the things you might otherwise want with direct pixel control.



[TOPIC: post.html]
#8

walter

[GLOBAL: userInfoPane.html]
walter
  • Moderator

  • 726 posts
  • Alumni

#6,#9, our focus right now is to give you image processing effects on the GPU via filters. We'll explore other ways to load CPU-generated images later. My guess is the only way to do this in a high-performance way is to offer such access via a native C API. 

 

#8, yes you can use that to chain. But we are working on something better ;)




[topic_controls]
[/topic_controls]