JRViewer issues

General discussion area.
Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

JRViewer issues

Post by Shaguar » Mon 27. Feb 2012, 15:46

Hi,

i just tested jReality by creating a simple instance of the JRViewer, and the first thing i noticed is that it couldnt load 8/10 of my obj files.
Sometime if it works and i can load an obj file, the camera position is really weird and i cant zoom out properly. It looks like this (should be a chair):
see attachemet "EINS.jpg" and the model file "CHAIR.3ds" in JReality.7z
Sometimes i just get a lot of warnings like this:
Warning: Sand [Material name] is null
Warning: current app==null
Warning: Sand [Material name] is null
Warning: current app==null
...
and the JRViewer doesnt show anything. (with file "singleChair.obj" in JReality.7z)
Sometimes it works and loads the model (like "AL.obj") but it very very slow and the animation is everything but fluid and it is very jerky even with Hardware rendering (at least i think it is hardware rendering) (see picture "ZWEI.jpg"). With SoftwareViewer activated you cant do anything with the model, you cant spin it because of havy laggs. This happens even with very small file with 50-150kb size. I got some much larger file to display in the future like 10-20mb and i didnt even try them yet.
I dont have any laggs or something else if i open these files with other viewers.(3dmax, poseray, teamcenter, java3d...)

If anybody can help me, and tell me why i cant open some obj file and why it is so jerky, i would really appreciate it!

http://netload.in/dateioVuKGGpILd/JReality.7z.htm (3D model files)

Thanks in advance!
Attachments
ZWEI.jpg
ZWEI.jpg (172.94 KiB) Viewed 3748 times
EINS.jpg
EINS.jpg (88.31 KiB) Viewed 3748 times

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Mon 27. Feb 2012, 16:04

Hi Shaguar,

welcome to jReality. The best point for starting with jReality is to work through the user tutorial first:
http://www3.math.tu-berlin.de/jreality/ ... r_Tutorial

for such big examples like yours the viewer is really slow, even with hardwarerendering, because of the rendering of the spheres and tubes for lines and vertices. You have to disable them, see:
http://www3.math.tu-berlin.de/jreality/ ... and_points

the 2 *.obj files which can't be loaded are probably broken or have an unusual structure. If you like you can attach them to your next post and I'll look over it and improve our obj-reader.

best regards
andre

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Mon 27. Feb 2012, 16:38

Thanks for the answers,
i'll try to disable the spheres and tube and try to load it again.

I already attached all the file, i uploaded them on netload, here is the link again:
http://netload.in/dateioVuKGGpILd/JReality.7z.htm

One more question, even it maybe doesnt fit in here.
I need to load an object like the singleChair.obj in the zip file above and then add some custom texture to different groups or parts of the chair.
I read in the tutorial section that i need a geometry with texture mapping? How can i see wether my object has this mapping or not? and if it doesnt, is there a way to add textures anyway or add a texture mapping afterwards to the object?

Thanks

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Mon 27. Feb 2012, 16:58

Texturemapping is a difficult topic in jReality. I'm not really into it. I just can you advise to follow the developer tutorial of jreality:
http://www3.math.tu-berlin.de/jreality/ ... r_Tutorial

and more specified for texturemapping:
http://www3.math.tu-berlin.de/jreality/ ... 2d_texture

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Mon 27. Feb 2012, 17:36

I tried your three files and everything worked fine so far, see attachment: three_objects.png

All I got was the warning in attachement 2: warning.png
But this is just a warning, because you've set materialoptions (usemtl) but no materials (mtllib) as you've generated your geometries. But how I wrote, these are just warnings, so nothing special you have to worry about.
Attachments
three_objects.png
three_objects.png (249.28 KiB) Viewed 3741 times
warning.png
warning.png (39.99 KiB) Viewed 3741 times

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Tue 28. Feb 2012, 10:38

Sry but which viewer is it that you use to test them, i tried 3 or 4 different implentations of the JRViewer from the tutorial pages. But none of them are working for me, always get the same behavior.

With the most basic implementation of the Viewer

Code: Select all

import de.jreality.plugin.JRViewer;

public class FirstStart {
	public static void main(String[] args) {
		JRViewer.display(null);
	}

}
i cant load the singleChair.obj at all. Nothing happens except the warnings you mentioned above...

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Tue 28. Feb 2012, 11:45

I used the de.jreality.tutorial.viewer.JRViewerVR class for displaying the geometry:

http://www3.math.tu-berlin.de/jreality/ ... ctionality

but it should be of course also be possible to use the jrViewer without the VR functionalities.

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Tue 28. Feb 2012, 11:51

Lol, that was indeed the difference.
It works for me aswell with the JRViewerVR implementation.
Now i can load all of them too.

Its this line of code that make the difference:
v.addContentSupport(ContentType.TerrainAligned);

The complete code:

Code: Select all


import de.jreality.plugin.JRViewer;
import de.jreality.plugin.JRViewer.ContentType;
import de.jreality.plugin.content.ContentAppearance;
import de.jreality.plugin.content.ContentLoader;
import de.jreality.plugin.content.ContentTools;

public class FirstStart {
	public static void main(String[] args) {
		// customize a JRViewer to have Virtual Reality support (skyboxes, terrain, etc)
		JRViewer v = new JRViewer();
		v.addContentSupport(ContentType.TerrainAligned);
		v.registerPlugin(new ContentAppearance());
		v.registerPlugin(new ContentLoader());
		v.registerPlugin(new ContentTools());
		v.startup();
	}

}

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Tue 28. Feb 2012, 17:50

Can you tell me how to change some appearances in the source code and not with the JRViewer UI.
I tried to change the background color and that line and point shaders are disabled from the beginning.
I found some tutorials but they didnt were that helpful.
This is my sourcecode:

Code: Select all

		Input inp = null;
		SceneGraphComponent cont = null;
		try {
			inp = Input.getInput("singleChair.obj");
			cont = Readers.read(inp);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
//Just a guess since i dont know how to disable them from start
		Appearance ap = cont.getAppearance();
		ap.setAttribute(LINE_SHADER, false);
		ap.setAttribute(POINT_SHADER, false);

//Change the background color
// if i print the rootApp on the console, i can see that the background value has changed successfully but  i cant see the change in the viewer
// Do i have to apply these appearances to the sceneGraph or the viewer in order to get them work? I tried it but couldnt figure out how.		
		RootAppearance rootAp = ShaderUtility.createRootAppearance(ap);
		rootAp.setBackgroundColor(Color.WHITE);

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Tue 28. Feb 2012, 19:36

With this tutorial you should be able to generate a customized Background:
http://www3.math.tu-berlin.de/jreality/ ... Background

For the other question I'm not sure how to disable lines/vertices from the beginning.

one solution could be to disable the Contentappearanceplugin
// v.registerPlugin(new ContentAppearance());
Then the lines/vertices have at least the same color then your faces. But this wasn't your question...

An other solution you already tried is creating an appearance but you forgot to "enable" your appearace to the geometry: A simple could which can make in is displayed next:

Code: Select all

import java.awt.Color;

import de.jreality.geometry.Primitives;
import de.jreality.plugin.JRViewer;
import de.jreality.plugin.JRViewer.ContentType;
import de.jreality.plugin.content.ContentAppearance;
import de.jreality.plugin.content.ContentLoader;
import de.jreality.plugin.content.ContentTools;
import de.jreality.scene.Appearance;
import de.jreality.scene.proxy.scene.SceneGraphComponent;

import static de.jreality.shader.CommonAttributes.LINE_SHADER;
import static de.jreality.shader.CommonAttributes.POINT_SHADER;
import static de.jreality.shader.CommonAttributes.DIFFUSE_COLOR;

public class JRViewerVR {
	public static void main(String[] args) {
		// customize a JRViewer to have Virtual Reality support (skyboxes, terrain, etc)
		JRViewer v = new JRViewer();
		v.addBasicUI();
//		v.addVRSupport();
		v.addContentSupport(ContentType.TerrainAligned);
		
		SceneGraphComponent sgc = new SceneGraphComponent();
		sgc.setGeometry(Primitives.icosahedron());
		
		Appearance app = new Appearance();
	    app.setAttribute(LINE_SHADER+"."+DIFFUSE_COLOR, Color.yellow);
	    app.setAttribute(POINT_SHADER+"."+DIFFUSE_COLOR, Color.yellow);
	    
	    sgc.setAppearance(app);
		v.setContent(sgc);
		v.registerPlugin(new ContentAppearance());
		v.registerPlugin(new ContentLoader());
		v.registerPlugin(new ContentTools());
		v.startup();
	}
}
but this won't solve your problem NOT displaying any lines/vertices from the beginning either...

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Tue 28. Feb 2012, 19:40

Hah! just found it, it is as simple as it should be:

Code: Select all

app.setAttribute(EDGE_DRAW, false);
app.setAttribute(VERTEX_DRAW, false);

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Wed 29. Feb 2012, 14:48

Thank you very much!!
Now that i can load my obj files properly ive noticed that they consume a lot of main memory, a 10MB file needs 400-500MB main memory?
Is this because of the sceneGraph overhead?
Is there a possibility to disable the sceneGraph or what else could solve this problem? Because PoseRay or other viewers dont need that much main memory for opening these files. (maybe a quarter of it)
That could be the reason why it is still lagging a little bit, not as much as bevore with line and vertex shader activated, but it is still there.

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Wed 29. Feb 2012, 17:25

What kind of computer are you using?

I'm using a seven years old AMD dual core 2GHz and 4GB DDR2-RAM. Everything works fine for me, So if you have a newer computer you shouldn't have any problem.

The big usage of memory depends on the geometry factorys. I don't know why, but there was a reason in the past why we decided to keep a copy of the geometry for the geometry factories. Unfortunate I don't know how to "disable" that.

Shaguar
Posts: 12
Joined: Mon 27. Feb 2012, 14:31

Re: JRViewer issues

Post by Shaguar » Wed 29. Feb 2012, 17:33

I'm using a 2.8Ghz Dual Core Pentium but combined with an Intel Q45/Q43 Express onBoard graphic chipset, maybe thats the bottleneck.

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: JRViewer issues

Post by Andre » Wed 29. Feb 2012, 17:56

hmm, normally this should be enough. My graphics card is a nVidia GeForce 570 Series, about 5 years old. Have you tried updating your drivers to their newest version?

Are all your examples lacking or just the big AY.obj one?

EDIT:
Inter Q45: http://ark.intel.com/de/products/chipsets/36522
Nvidia 570: http://www.geforce.com/Hardware/GPUs/ge ... ifications

Post Reply