We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › new working sunflow library in processing
Page Index Toggle Pages: 1
new working sunflow library in processing (Read 5881 times)
new working sunflow library in processing
May 22nd, 2010, 1:01pm
 
Hello,

After p5sunflow did not work anymore, I started to write an own wrapping class for processing which enables you to use the sunflow renderer in your sketches. My aim with the project was to create a much simplier library which can be later modified and extended.

You can find it on Google code:
http://code.google.com/p/sunflow4p5/

You can get the jar file from the Download tab. You may also be interested in a short guide in the Wiki section:
http://code.google.com/p/sunflow4p5/wiki/GettingStarted1

Please, take a look at that project. All feedback are welcome.
Thank you,
zzzzz
Re: new working sunflow library in processing
Reply #1 - May 22nd, 2010, 4:25pm
 
just great

thank you

Re: new working sunflow library in processing
Reply #2 - May 23rd, 2010, 2:41am
 
Very good news! Thanks a lot for doing this.

I am looking forward to test it (doing this morning). P5Sunflow used to be very limited on the lights and textures, actually there was no access to lights' setup. Are you going to try implement that?

This is really cool and I am definitely following it  Smiley
Re: new working sunflow library in processing
Reply #3 - May 23rd, 2010, 3:20am
 
Hi Zaphod,

Your library was compiled with 1.6 and processing seems to only accept libraries compiled with 1.5

Re: new working sunflow library in processing
Reply #4 - May 23rd, 2010, 9:14am
 
great news. it was about time for a new more advanced sunflow wrapper. the possibilities are great. like TM mentioned, there are a lot of features like, texture, lightning, material etc that could be implemented in future versions.
Re: new working sunflow library in processing
Reply #5 - May 24th, 2010, 6:13pm
 
Has anyone got this working?

If so what version of Processing you are using and how are you importing the library?
Re: new working sunflow library in processing
Reply #6 - May 25th, 2010, 12:41am
 
nope, and I think the java version supported by processing won't let it work. But maybe I'm wrong...
Re: new working sunflow library in processing
Reply #7 - May 25th, 2010, 9:28am
 
Yes, I managed to get this working. I have currently installed processing-1.0.9-expert (without Java) and seperately installed Java Version 1.6.0_13. I got it to render the example scene, but I still have two issues.

1. The library is not recognised by processing when I put it in the libraries folder. So I'm not able to import the library from the menu and I don't know the import statements for it, assuming they would work anyway in this case.

Current work-around: I installed the files into the code subdirectory of the sketch. This works.

2. The scene renders fine. But after it is done, the window turns black again. I don't know why this happens. Adding noLoop() didn't solve the issue. Here is the output from the console.

Code:
An other Sunflow wrapper by Preceptor.

API    info  : Building scene instance list for rendering ...
API    info  : Building scene light list for rendering ...
SCENE  info  : Scene stats:
SCENE  info  :   * Infinite instances:  1
SCENE  info  :   * Instances:           12
SCENE  info  :   * Primitives:          12
SCENE  info  :   * Instance accel:      auto
SCENE  info  :   * Scene bounds:        (-61,01, 13,64, -251,74) to (469,09, 386,37, 251,72)
SCENE  info  :   * Scene center:        (204,04, 200,01, -0,01)
SCENE  info  :   * Scene diameter:      820,61
SCENE  info  :   * Lightmap bake:       off
LIGHT  info  : Light Server stats:
LIGHT  info  :   * Light sources found: 1
LIGHT  info  :   * Light samples:       65
LIGHT  info  :   * Max raytrace depth:
LIGHT  info  :       - Diffuse          1
LIGHT  info  :       - Reflection       4
LIGHT  info  :       - Refraction       4
LIGHT  info  :   * GI engine            none
LIGHT  info  :   * Caustics:            none
LIGHT  info  :   * Shader override:     false
LIGHT  info  :   * Photon override:     false
LIGHT  info  :   * Shading cache:       off
LIGHT  info  :   * Build time:          0ms
SCENE  info  : Rendering ...
QMC    info  : Initializing Faure scrambling tables ...
BCKT   info  : Bucket renderer settings:
BCKT   info  :   * Resolution:         400x400
BCKT   info  :   * Bucket size:        32
BCKT   info  :   * Number of buckets:  13x13
BCKT   info  :   * Anti-aliasing:      4 samples -> 16 samples (adaptive)
BCKT   info  :   * Rays per sample:    1
BCKT   info  :   * Subpixel jitter:    off
BCKT   info  :   * Contrast threshold: 0,10
BCKT   info  :   * Filter type:        mitchell
BCKT   info  :   * Filter size:        4,00 pixels
Rendering [0%]
// all the way up to...
Rendering [99%]
                                                                     
BCKT   info  : Render time: 0:00:20.8
SCENE  info  : Done.
updatePixels(), or this particular variation of it, is not available with this renderer.


Anyway, great to see work on a new sunflow library. With some more information and/or development this is a very welcome addition!

Smiley
Re: new working sunflow library in processing
Reply #8 - May 25th, 2010, 10:05am
 
Cool, for the library to show I renamed the jar sunflow4p5.jar.
(Would be nice to have it work on 1.5 tho)
Re: new working sunflow library in processing
Reply #9 - May 25th, 2010, 10:46am
 
Thanks TM. I renamed the file and now it's showing all right Smiley

The import statement is: import hu.spidron.sunflow.*;

The second issue still persists, does anybody else have this problem and/or a solution?
Re: new working sunflow library in processing
Reply #10 - May 25th, 2010, 1:33pm
 
I tried this with the original version. You guys can try it and see if it works.

Try creating a PGraphic image and then use this as the renderer

Code:

import hu.spidron.sunflow.*;


PGraphics _a;
void setup(){
size(300,300,P3D);
_a = createGraphics (600,600, "hu.spidron.sunflow.NextSunflowGraphics");

}

void draw(){
_a.loadPixels();
_a.beginDraw();

//insert code here

_a.endDraw();
_a.updatePixels();
image(_a,0,0);
}

Re: new working sunflow library in processing
Reply #11 - May 25th, 2010, 2:36pm
 
I tried your code andrewowaun. The result...

A second window is opened with the size of the PGraphic and the title "Sunflow v0.07.2". The image renders correctly there. However the image is not drawn to the PGraphic, so it does not appear in the main window. With this method noLoop() does work, so you can appreciate the image longer once it's done (instead of a black screen). But save and saveFrame only save the empty main window. With this method it also re-renders, but instead of the same normal image a kind of blue-ish version is overlayed on top.

Tongue Grin

Zaphod?
Re: new working sunflow library in processing
Reply #12 - May 25th, 2010, 3:53pm
 
That's great amnonP5.

you can add this to void keyPressed() or right before noLoop()

The beauty of PGraphics is that they behave just like the main IDE so _a.save("test.png"); works

For example
Code:



void pgsave(){

_a.save("sunflowrender.png");

// OR
//if you can make the PGraphic the same size during setup and ...

//loadPixels();
//arraycopy(_a.pixels,pixels);

}



Now just call it before the noLoop();

Code:


void draw(){
_a.loadPixels();
_a.beginDraw();

//insert code here

_a.endDraw();
_a.updatePixels();
pgsave();
PImage _c = loadImage("sunflowrender.png");
image (_c,0,0);
noLoop();



}




Re: new working sunflow library in processing
Reply #13 - May 26th, 2010, 10:06am
 
That code doesn't work because the PGraphic itself is empy. Even though the PGraphic statements are effective for drawing to the sunflow window somehow, it still is another window and not a PGraphic as usual. Tried all your code, but to no avail unfortunately.

However, with the regular example code I managed to save the correct sunflow output from the main window before the screen turns black. So that's good.

To summarize, I can either use the main window, save it correctly, but it ends in black screen and only runs once. Or use PGraphic-method resulting in second external sunflow window without any way (so far) to save the output, but with this method the code keeps running and the result is displayed on screen.
Re: new working sunflow library in processing
Reply #14 - May 29th, 2010, 1:02am
 
@Zaphod

Where's the Source, Luke?

Roll Eyes  >>> Found the source:  inside the jar

There is much to be done, and I'd love to help.

- Chaotic
Page Index Toggle Pages: 1