World: r3wp
[View] discuss view related issues
older newer | first last |
Maxim 31-Aug-2010 [10200] | one thing which is nice in the current system is that I'm not using pairs, but blocks of two float values, so a part from the actual AGG coordinates, everything is floating point and quite precise. |
Gregg 31-Aug-2010 [10201] | Nice work Max. |
AdrianS 31-Aug-2010 [10202] | Yeah, looks good - do you have any guess how this would compare with Algodoo (speed-wise) once you're done? It does use OpenGL, but I guess you could too. http://www.algodoo.com/ |
Maxim 31-Aug-2010 [10203x3] | right now, I'm still flushing out the raw maths, but somehow, AGG always seems to squash any speed gains I get out of better interpreter speed. |
sometimes doubling the number of elements makes the refresh 10 times slower, sometimes, there is no noticeable difference. I'm still trying to find the best way to render things. my guess is the GC is constantly interfering since the draw blocks have to be rebuilt over and over. which is still my main issue wrt using draw in R2 and even R3. if i forego of rendering, there seems to be no noticeable effect of processing the collisions, so I hope, its not just "a trick of the light" and that my current wip (handling collisions between many polys) is going to work well. | |
Using R3 with stuff compiled and sidestepping draw in order to use AGG directly would probably allow several hundred frames per second for this simple test. | |
Maxim 1-Sep-2010 [10206] | algodoo is cool :-) |
AdrianS 1-Sep-2010 [10207] | do you have any idea why your demo limits itself to 32 fps? It does this on my system and Sunanda's so it makes me think that it's an internally imposed limit. |
Maxim 1-Sep-2010 [10208x4] | its the maximum timer resolution possible in R2 view. |
it might be possible to use a callback and allocate our own OS timer via library calls, but I think it not worth the hassle. going past 32 fps didn't produce noticeably smoother animation, and it allows much more time for (slow) math and AGG rendering in REBOL. | |
(staying at 32 fps, that is) | |
its already an issue that AGG or the GC seems to be generating a steady memory leak at each refresh, which I will have to investigate further. | |
Pekr 1-Sep-2010 [10212] | Max - interesting achievements. Do you really think, that the draw dialect interpretation is the culprit and performance killer? IIRC Cyphre said, that time to interpret the draw block dialect is really negligible ... |
Maxim 1-Sep-2010 [10213] | right now, one thing is sure, the fact that I have to go thru rendering "passes" for each part of the rendering slows down the rendering a lot. the actual number of strokes doesn't affect the rendering as much. trying to compile all the dynamic graphics into a big block is also affecting performance. but each individual group of elements is rendering at under 1% cpu. rendering three passes jumps the cpu to 20%!!! reducing/composing the passes together is almost as slow as seperate passes, sometimes even more. i am rendering at least 32 fps. If I have to rebuild a 50kb draw block at each render, the interpreter is "spinning air" redoing things over and over, allocating intermediate blocks for not much real reason, because in this case... the shapes actually change even comming into/out of existence dynamically. I can't just use static binding, the actual drawing is changing. |
Pekr 1-Sep-2010 [10214] | allocating intermediate blocks for not much real reason ... - so how would you do it? If I understand it correctly - if you want to use a dialect, you have to go via its interpretation, so I wonder if it can be improved ... |
Maxim 1-Sep-2010 [10215] | from a normal REBOLer's perspective I don't see any different way. Don't get me wrong, draw and gobs are usefull and cool. plus, in R3 there is some optimisations by using GOBs afaik. but for fast Gaming, I'd completely forget about gobs, and draw and just allow access to the AGG C functions as commands in REBOL. rasterized and displayed in a window's bitmap directly. |
Pekr 1-Sep-2010 [10216] | but you have that, no? |
Maxim 1-Sep-2010 [10217] | I've looked (briefly) in the A104 R3 host C code and it doesn't seem like it by what I understood of the extensions I found. cyphre might illuminate me if I just missed it. |
Pekr 1-Sep-2010 [10218] | Max - so far, all AGG functions are mapped just like commands, nothing more. Cyphre is working on a dialect right now, but it is not in-there. Each dialect keyword then maps to such a function - or how do you think the REBOL to AGG mapping is done? |
Maxim 1-Sep-2010 [10219x2] | they are called via the command launcher, which is used within the draw command, not directly from rebol. the elements aren't exported from the extension module. |
for some reason, the text command was exported, and when I tried to use it, it just crashed R3. the whole system requires you to tell it where to draw stuff. all the C code expects either a gob! or a low level AGG graphics object. | |
Pekr 1-Sep-2010 [10221] | ah, I understand now ... I thought that each low level function is directly mapped via a command ... |
Maxim 1-Sep-2010 [10222x2] | the issue is mostly that they need to know where to draw themselves. which is not something I've seen refered to anywhere outside of the higher level draw commands and AGG calls. |
so either there is a little magic trick to set a gob! as the current default rendering target, or there isn't any way to do this yet. | |
Pekr 1-Sep-2010 [10224] | We should ask Cyphre then .... I think that you might discuss all your concerns with him, maybe together you will find out something generally usefull :-) |
Maxim 1-Sep-2010 [10225x2] | my use cases tend to be on the fringes ;-) but I don't want to impede their plan right now. i can actually do (some/all?) of this work myself, since it would effectively be a completely separate rendering process than /view, I woudn't be competing with their efforts, it could just be an additional extension which uses the same AGG code, but with a different REBOL interface |
I would also like to build my OpenGL extension, now that I have everthing required in the extension API to start work on that. | |
Pekr 1-Sep-2010 [10227] | Would you need a vector! type for your work? IIRC vectors are still not finished in R3, no? Dunno if extensions support them .... |
Maxim 1-Sep-2010 [10228x4] | yes vector! is usefull, simply for speed considerations. not sure either, if they where added back in A101/102 |
MAJOR milestone for Game kit. test app updated and includes multiple shape collisions and propagation. quite fun :-) also: press g to view spatial sorting grid, its a bit mesmerizing to see do http://www.pointillistic.com/open-REBOL/moa/files/ctest-preboled.r | |
next step... dynamics using rigid bodies | |
I also want to try adding rotational collision response... i.e. push a polygon, and it twists as well as moves. | |
Pekr 1-Sep-2010 [10232] | if you do a quick drag-move, it can jump over the element, instead of pushing it forward .... is that a bug, or na intention? |
Maxim 1-Sep-2010 [10233] | that is because I didn't add actor velocity to the collision detection. this will be part of dynamics upgrade. I'm just happy that propagation already works :-) |
Pekr 1-Sep-2010 [10234] | Interesting that you are able to do it via plain old R2 .... |
Maxim 1-Sep-2010 [10235x2] | most of it is math, AGG is just reflecting the vector maths I am doing. its also responsible for about 90% of the CPU use :-( but for now its not an issue since the game kit doesn't actually use these shapes for the user graphics, only for collision detection. |
the user graphics are statically bound pre-compiled AGG blocks and render much faster, since I use AGG matrix ops directly for all of the rendering. | |
Anton 1-Sep-2010 [10237] | That's very impressive, Max. |
AdrianS 1-Sep-2010 [10238] | I can see a way nicer (well, if performance won't be an issue) alternative to Processing being built on top of something like this. With dialecting and extensions to interface to external hardware, it could be a killer app for the interactive/performance art community. http://www.processing.org/ |
Maxim 1-Sep-2010 [10239] | yep, this is all built as a set of generic libs you can use in any app. the actual application-specific code part of this test (if you exclude the event loop, which would be part of a generic toolkit) is 1kb of code (~ 50 lines). |
JoshF 2-Sep-2010 [10240] | Hi! Is there a good way to draw an image with an alpha channel? In the example below, I would expect a green outlined circle with a transparent background so I could composite it over the red box in the layout (for instance). However, I get solid (and very un-transparent) black. x: draw 512x512 [pen green line-width 3 fill-pen blue circle 256x256 200] view layout/tight [box 512x512 red at 0x0 image x] Any ideas? Thanks very much! |
Maxim 2-Sep-2010 [10241] | alpha is the fourth component of colors... 255 is full transparency. |
JoshF 2-Sep-2010 [10242] | I am aware of this, but the draw command seems to start with full opacity instead. Any way to get it to be transparent except where I've drawn? Thanks! |
Maxim 2-Sep-2010 [10243x2] | so there are a few options. I'd build a transparent image to start and graph stuff over it using draw. ex: x: make image! 512x512 x/alpha: 255 draw x [fill-pen red circle 256x256 200] |
one thing to consider is how transparency relates to color. in the above, you will probably get a dark edge around the circle. that is because the color around the circle actually is darker, so even if its partly transparent, it will add transparent dark red instead of red. | |
JoshF 2-Sep-2010 [10245] | That is the missing link! Thank you very much, Maxim! For what it's worth, it seems that it's possible to skip a step in your example by saying: x: make image! [512x512 0.0.0.255] Since, I'm compositing over stuff, the pre-multiplied alpha problem you describe shouldn't be a difficulty. |
Maxim 2-Sep-2010 [10246] | :-) |
Nicolas 5-Sep-2010 [10247] | I'm trying to catch alt-down mouse events while the left mouse key is down. Can anyone do this? |
Henrik 5-Sep-2010 [10248] | not sure the event system allows this. |
Nicolas 5-Sep-2010 [10249] | Shouldn't it? |
older newer | first last |