Forums > Java

rendering to matrix from java/maximum resolution/crashes

March 5, 2007 | 11:10 pm

dear mitmaxers,

i have currently some problems exporting a rendered scene to matrix and then to file. i have build my whole scene in java/mxj, because i am using the JWNL (java/wordnet) api and got some nice visualisations out of that. problem now is that i want to render real high resolution pictures out of the scenes, but i am encountering some serious crashes/misfunctions when doing that.

current situation:
-text is analyzed, broken into tokens, etc., loads of jit.gl.text3d objects are generated, placed in space and so on.

-the context of the rendered scene is switched to a matrix name, whenever i like the result

-a reference to the matrix "inside" the mxj is passed to the outside/max to a jit.matrix, which then receives a "exportimage tiff" to write the rendered image to disk

this works fine, until i increase the resolution of the export matrix to about 2500×2000. in this case there is no file written, no error message.

also, if the scene is more complex (meaning more nodes with jit.gl.text3d’s) max crashes, even in lower resolutions.

i thought it has to do with the memory settings of the jvm, but they are already quite high:

max.jvm.option -Xincgc
max.jvm.option -Xms32m
max.jvm.option -Xmx512m

i am clueless now at the moment, so i would be really thankful if someone (topher, ben?) could comment on this, cause these are the finishing steps for my diploma…

and: platform is windows xp sp2, java is 1.6, max is 4.6.2, jitter is 1.6.2

thanks in advance

micha


March 6, 2007 | 12:06 am

Hi Micha,

With the information you’ve given, I don’t have a good guess at what
the problem is. Can you supply us with an example patch that crashes?

Ben

On 3/5/07, micha wrote:
>
> dear mitmaxers,
>
> i have currently some problems exporting a rendered scene to matrix and then to file. i have build my whole scene in java/mxj, because i am using the JWNL (java/wordnet) api and got some nice visualisations out of that. problem now is that i want to render real high resolution pictures out of the scenes, but i am encountering some serious crashes/misfunctions when doing that.
>
> current situation:
> -text is analyzed, broken into tokens, etc., loads of jit.gl.text3d objects are generated, placed in space and so on.
>
> -the context of the rendered scene is switched to a matrix name, whenever i like the result
>
> -a reference to the matrix "inside" the mxj is passed to the outside/max to a jit.matrix, which then receives a "exportimage tiff" to write the rendered image to disk
>
>
> this works fine, until i increase the resolution of the export matrix to about 2500×2000. in this case there is no file written, no error message.
>
> also, if the scene is more complex (meaning more nodes with jit.gl.text3d’s) max crashes, even in lower resolutions.
>
> i thought it has to do with the memory settings of the jvm, but they are already quite high:
>
> max.jvm.option -Xincgc
> max.jvm.option -Xms32m
> max.jvm.option -Xmx512m
>
>
> i am clueless now at the moment, so i would be really thankful if someone (topher, ben?) could comment on this, cause these are the finishing steps for my diploma…
>
> and: platform is windows xp sp2, java is 1.6, max is 4.6.2, jitter is 1.6.2
>
>
> thanks in advance
>
> micha
>
>
>
>


March 6, 2007 | 4:50 pm

hello ben,

i was able to track down the crash a little bit more. seems that the problem is, that the software-renderer can’t handle this amount of clients (i am having about 300 jit.gl.text3d’s). there are certain threshholds with the resolution/amount of clients, from which the software-renderer can’t render anymore. if i am lucky, i get no crash, but a message saying "jit.gl.text3d: can’t build font Arial". i had thought, that rather the hardware renderer is limited in memory…

ok, so how do i get my hi-res rendered picture? using the readback function on the graphiccard is no option, as the hardware renderer also doesn’t display from about 4000×3000 on. it’s obvious that i’ve got to cut down the number of clients, so i am reducing the jit.gl.text3d to exactly one instance and do everything with automatic mode disabled. just did some simple tests, and it seems to work, but:

i am having now one context, hardware rendered (for previews), and then, if i like the scene, switch all the objects within java to another context, that is hardware rendered. but if i do this, the hardware rendered scene is empty!?! in opposite, if i am having just one hardwarebased context from the beginning on, it works like it should. what am i doing wrong?

here is a simple class for demonstrating how i switch the context, i guess there is the problem:

import com.cycling74.max.*;
import com.cycling74.jitter.*;

import java.util.*;

public class simplemanualjitter extends MaxObject

{
JitterObject window=null;
JitterObject render = null;
JitterObject sketch = null;
JitterObject handle =null;
JitterObject text=null;
JitterObject matrix=null;
String Context = "context";
String Matname = "mymatrix";

float[] Screensize = new float[2];
float[] erase_color={0.f, 0.f, 0.f, 1.f};
float[] color={1.f, 1.f, 1.f, 0.5f};

public simplemanualjitter() {

declareInlets(new int[]{DataTypes.ALL});
declareOutlets(new int[]{DataTypes.ALL});

// create our window
window = new JitterObject("jit.window", new Atom[]{Atom.newAtom(Context)});
window.setAttr("size", new int[]{640, 480});

// create our render object for our window
render = new JitterObject("jit.gl.render", new Atom[]{Atom.newAtom(Context)});

//create our handle
handle = new JitterObject("jit.gl.handle", new Atom[]{Atom.newAtom(Context)});
handle.setAttr("inherit_transform", 1);

// create out sketch object
sketch = new JitterObject("jit.gl.sketch", new Atom[]{Atom.newAtom(Context)});
sketch.setAttr("displaylist", 1);

sketch.setAttr("automatic",0);
render.setAttr("automatic",0);

text=new JitterObject("jit.gl.text3d", new Atom[]{Atom.newAtom(Context)});
text.call("text","miauwuffbuffbla");
text.setAttr("automatic",0);

matrix=new JitterMatrix(4,"char",640, 480);
matrix.setAttr("name","export");

}

public void bang() {
render.send("erase");
render.setAttr("position", handle.getAttr("position"));
render.setAttr("rotate", handle.getAttr("rotate"));

sketch.call("erase");
sketch.call("sphere",0.5f);
sketch.bang();
sketch.call("draw");

text.call("draw");
render.send("drawclients");

//Copy the rendered image to the destination jit.window, jit.pwindow or jit.matrix.
render.send("swap");
}

public void export() {

render.setAttr("drawto",matrix.getAttrString("name"));
sketch.setAttr("drawto",matrix.getAttrString("name"));
text.setAttr("drawto",matrix.getAttrString("name"));
bang();
outlet(0,matrix.getAttr("name"));
}

public void notifyDeleted() {
// free max peers. otherwise these will persist for a while
// until the garbage collector feels like cleaning up
matrix.freePeer();
handle.freePeer();
sketch.freePeer();
render.freePeer();
window.freePeer();
}
}

and here is a simple patch, please try to use the export function:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 40 28 50 9109513 this works;
#P newex 56 148 27 9109513 t b l;
#P newex 56 174 44 9109513 jit.matrix;
#P button 28 151 15 0;
#P user jit.fpsgui 102 151 60 9109513 3;
#P message 140 46 34 9109513 export;
#P newex 56 121 82 9109513 prepend jit_matrix;
#P newex 56 208 147 9109513 jit.window exportwin @pos 10 400;
#P message 17 68 22 9109513 zap;
#P toggle 56 49 15 0;
#P newex 56 70 50 9109513 qmetro 40;
#P newex 56 96 101 9109513 mxj simplemanualjitter;
#P comment 110 28 103 9109513 why doesn’t this work?;
#P connect 3 0 2 0;
#P fasten 7 0 1 0 145 92 61 92;
#P fasten 4 0 1 0 22 90 61 90;
#P connect 2 0 1 0;
#P connect 1 0 6 0;
#P connect 6 0 11 0;
#P fasten 11 1 10 0 78 170 61 170;
#P connect 11 0 10 0;
#P fasten 9 0 10 0 33 170 61 170;
#P fasten 10 0 5 0 61 200 61 200;
#P fasten 6 0 8 0 61 145 107 145;
#P window clipboard copycount 13;

thanks in advance,

micha


Viewing 3 posts - 1 through 3 (of 3 total)