JRViewer issues
Re: JRViewer issues
I've installed a driver update, but it is still lagging. I think i just need a better graphic card.
Re: JRViewer issues
I want to try this with the standalone viewer. Maybe its better with less overhead from the JRViewer.
But can you tell me how to set the camera postion. I've tried the http://www3.math.tu-berlin.de/jreality/ ... one_viewer Example, but it doesnt show how to position the the camera, because the camera is way to near at start. and i also have this weird fish-eye effect. Can is disabled that somehow? It should look like my first attempt with JRViewer where these lines did all the "work":
One more important thing, as i mentioned before i want to apply custom texture to the models, but not to the whole model only to certain parts.
How can i list or select the parts/groups of the model? (which are defined in the model.obj)
Edit: Ok i've figured out how to list them with the "Use the mouse-over input slot" example but i want to select the parts by clicking not hovering. can i do this too with the AbstractTool? And is there a possibility to store some informations along with the childNodes? like isSelected, isTextureApplicable, texturePath etc ...
or do i have to write my own container for storing these informations?
But can you tell me how to set the camera postion. I've tried the http://www3.math.tu-berlin.de/jreality/ ... one_viewer Example, but it doesnt show how to position the the camera, because the camera is way to near at start. and i also have this weird fish-eye effect. Can is disabled that somehow? It should look like my first attempt with JRViewer where these lines did all the "work":
Code: Select all
JRViewer v = new JRViewer();
v.addContentSupport(ContentType.CenteredAndScaled);
How can i list or select the parts/groups of the model? (which are defined in the model.obj)
Edit: Ok i've figured out how to list them with the "Use the mouse-over input slot" example but i want to select the parts by clicking not hovering. can i do this too with the AbstractTool? And is there a possibility to store some informations along with the childNodes? like isSelected, isTextureApplicable, texturePath etc ...
or do i have to write my own container for storing these informations?
Re: JRViewer issues
Forget the camera thing and the fish-eye problem.
I've just tried the texture2d example but it doesnt work for me.
In the examples they use a cylinder or this CatenoidHelicoid for demonstration. They work for me too but my custom model wont show any textures on it.
This is my source code:
Am i missing anything??
Ps: I cant apply texture with the JRViewer (GUI) too. I load an object, then i select the content node then right cklick -> Appeparance -> Load texture .... but nothing happens
I've just tried the texture2d example but it doesnt work for me.
In the examples they use a cylinder or this CatenoidHelicoid for demonstration. They work for me too but my custom model wont show any textures on it.
This is my source code:
Code: Select all
import static de.jreality.shader.CommonAttributes.EDGE_DRAW;
import static de.jreality.shader.CommonAttributes.VERTEX_DRAW;
import java.awt.Color;
import java.io.IOException;
import de.jreality.math.MatrixBuilder;
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.reader.Readers;
import de.jreality.scene.Appearance;
import de.jreality.scene.SceneGraphComponent;
import de.jreality.shader.CommonAttributes;
import de.jreality.shader.DefaultGeometryShader;
import de.jreality.shader.DefaultPolygonShader;
import de.jreality.shader.ImageData;
import de.jreality.shader.ShaderUtility;
import de.jreality.shader.Texture2D;
import de.jreality.shader.TextureUtility;
import de.jreality.util.Input;
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.CenteredAndScaled);
v.registerPlugin(new ContentAppearance());
v.registerPlugin(new ContentLoader());
v.registerPlugin(new ContentTools());
// v.setShowMenuBar(false);
Input inp = null;
SceneGraphComponent cont = null;
try {
inp = Input.getInput("AL.obj");
cont = Readers.read(inp);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Appearance ap = cont.getAppearance();
ap.setAttribute(EDGE_DRAW, false);
ap.setAttribute(VERTEX_DRAW, false);
cont.setAppearance(ap);
DefaultGeometryShader dgs = (DefaultGeometryShader) ShaderUtility.createDefaultGeometryShader(ap, true);
dgs.setShowLines(false);
dgs.setShowPoints(false);
DefaultPolygonShader dps = (DefaultPolygonShader) dgs.createPolygonShader("default");
dps.setDiffuseColor(Color.white);
ImageData id = null;
double scale = 1;
args = new String[1];
args[0] = "textures/gridsmall.jpg";
// get the image for the texture first
if (args.length > 0) {
try {
id = ImageData.load(Input.getInput(args[0]));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else { // use a procedural texture
SimpleTextureFactory stf = new SimpleTextureFactory();
stf.update();
id = stf.getImageData();
scale = 10;
dps.setDiffuseColor(Color.yellow);
}
Texture2D tex = TextureUtility.createTexture(cont.getAppearance(), CommonAttributes.POLYGON_SHADER,id);
tex.setTextureMatrix(MatrixBuilder.euclidean().scale(scale).getMatrix());
v.setContent(cont);
v.startup();
}
}
Ps: I cant apply texture with the JRViewer (GUI) too. I load an object, then i select the content node then right cklick -> Appeparance -> Load texture .... but nothing happens
Re: JRViewer issues
First of all, yes it is possible to give different textures to different scenegraphs. I've checked once again your AI.obj and he is divided to a bunch of subscenegraphs.
I'm not really good with textures but I can tell you some hints I've experienced with textures in jReality. First it is just possible to attach textures to a sliced surface. If the surface is closed it is not possible, because of the "old" geometry structure of jReality. As a good further tutorial for textures I can recommend you this thread: http://www3.math.tu-berlin.de/jreality/ ... ?f=3&t=583
I don't have time to check your code right now, maybe I'm able at the weekend.
best
Andre
I'm not really good with textures but I can tell you some hints I've experienced with textures in jReality. First it is just possible to attach textures to a sliced surface. If the surface is closed it is not possible, because of the "old" geometry structure of jReality. As a good further tutorial for textures I can recommend you this thread: http://www3.math.tu-berlin.de/jreality/ ... ?f=3&t=583
I don't have time to check your code right now, maybe I'm able at the weekend.
best
Andre
Re: JRViewer issues
Ok, i tried a lot but it is still not working.
Maybe its because all surfaces of the subscenegraphs of al.obj are closed?
How can i figure this out?
Maybe its because all surfaces of the subscenegraphs of al.obj are closed?
How can i figure this out?
Re: JRViewer issues
It depends on, how the models are generated. In general they are closed...Shaguar wrote:Ok, i tried a lot but it is still not working.
Maybe its because all surfaces of the subscenegraphs of al.obj are closed?
How can i figure this out?
Re: JRViewer issues
Do you know a tool/possibility to cut these surfaces wihtout changing the "appearance".
Is this possible? It's very important for me to get this working with the textures.
Is this possible? It's very important for me to get this working with the textures.
Re: JRViewer issues
I'm sorry, I don't know such a tool.
Maybe it is possible with halfedge/halfedgetools from jtem:
http://www3.math.tu-berlin.de/jtem/projects.html
If you don't find a tool there you have to write it for your own.
Maybe it is possible with halfedge/halfedgetools from jtem:
http://www3.math.tu-berlin.de/jtem/projects.html
If you don't find a tool there you have to write it for your own.
Re: JRViewer issues
Probably the data does not have texture coordinates. Otherwise you would see the texture.