Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - alakat

#1
Support / Re: Texture and MD2
June 09, 2008, 10:48:46 PM
Thanks for your quick reply.
#2
Support / Texture and MD2
June 09, 2008, 09:54:07 PM

hi all
i have just read in Loader javadoc http://www.jpct.net/doc/com/threed/jpct/Loader.html#loadMD2(java.lang.String,%20float) that if i load an md2 file, and in this model  two (or more) mesh with textures have been created, these textures are not loaded. is that true?

If it is true, when i load an md2 file using loadMD2 method i supposedly get one only Object3D (not an array like in the rest of loadXXX methods) how could i set different textures to each mesh?

Thanks very much

#3
Support / Re: Initial position and rotation
June 08, 2008, 08:43:04 PM
Yes, i thought that when o i load a model, this model dont have any translation and rotation, but in other post i paste code to i use to load,in this code i dont do any transation or rotation.
I use blender to export my model, i dont kwon why send you my model. This model is a three cylender (red cylinder paralel to X, green cylinder paralel to Y and blue cylinder paralel to Z) all there are perpendicular.
if i export model with obj, i show:

                        |Red
                        |
                        |
Green____
                       /
                      /Blue


if i export model with .3ds i show
                       |Red
                       |

                      | /Green
                      |/_______Blue

is very extrange.
Thanl very much with all help, in this extrange post
                       

#4
Support / Initial position and rotation
June 08, 2008, 05:15:42 PM
Hello ever body.
i found a littel problem, this problem  occur when load model .obj or .3ds, the position and rotation is different but thy are exporting of same model, with blender.
i used this code

World worldx = new World();
        ModelFactory modelFactory = ModelFactory.getInstance();
        BaseEntity[] fields = new BaseEntity[4];
        Object3D[] cruz = null;
        if (SHOW_ORIGIN){

          /*  cruz = Loader.loadOBJ("/home/miguel/perfectday_project/TestProfectDay3D/models/xCoord.obj", "/home/miguel/perfectday_project""   /TestProfectDay3D/models/xCoord.mtl", 1.0f);*/
//              cruz = Loader.load3DS("/home/miguel/perfectday_project/TestProfectDay3D/models/xCoord.3ds", 1.0f);
            for (int i = 0; i < cruz.length; i++) {
                worldx.addObject(cruz[i]);
               
            }
        }
        worldx.buildAllObjects();
        /**
         * Place the camera at the starting position.
         */
        Camera camera = worldx.getCamera();
        camera.setPosition(this.xCamara,this.yCamara , this.zCamara);
       
        camera.lookAt(SimpleVector.ORIGIN);
         Config.fadeoutLight = false;
        worldx.getLights().setOverbrightLighting(Lights.OVERBRIGHT_LIGHTING_DISABLED);
        worldx.getLights().setRGBScale(Lights.RGB_SCALE_2X);
        worldx.setAmbientLight(25, 30, 30);

        /**
        * Place the lightsources...
        */
        worldx.addLight(new SimpleVector(0, -150, 0), 25, 22, 19);
        worldx.addLight(new SimpleVector(-1000, -150, 1000), 22, 5, 4);
        worldx.addLight(new SimpleVector(1000, -150, -1000), 4, 2, 22);
   
        return worldx;


is it normal?, if this is normal. which postion and rotation are initial with .3ds and .obj?.
Thank very much
Sorry for my english
#5


I resolved the problem
If other person suffer this problem, i resolved add uv textures in model blender. you press button "new " in UVTexture, button place is "edit mode"

Sorry i dont know put image in this post. email me if you have this problem. See my profile
Thank for all
#6

I find my problem. it is in models.
Thank for every body.

My last question it is: where  can i find good blender tutorial that explain me exporting model.
Agan Thank every body
#7
Again Thank every body.
I  do more examples, i explain this example and there result.
I modified CarTest, and i use my models, in this example mi model do NOT set Texture, because i think that the problem is a model, but.
I modified my code, and i use cartest terrain model (terascene.3ds). and do not set textures  ???, becouse i have a problem in code.
As well as  this examples, i tried two more examples. In first example i add field.calcTextureWrap():


textureManager.addTexture("metal", new Texture(new FileInputStream("/home/miguel/perfectday_project/JPCTExm/textures/rocks.jpg")));
        model = Loader.load3DS(new FileInputStream("/home/miguel/perfectday_project/blender_model/obj_export/montanya2.3ds"), 1);
        Object3D field = model[0];
        field.calcTextureWrap();
        field.setTexture("metal");
        field.setEnvmapped(Object3D.ENVMAP_DISABLED);
        field.setCenter(SimpleVector.ORIGIN);
        field.rotateX((float) (Math.PI /-2));
       
        int size = (int) field.getScale();
        System.out.println("SCALE:"+field.getScale());

        field.setOrigin(SimpleVector.ORIGIN);
        field.build();
        worldx.addObject(field);

this code does not set Texture. In Secon code:

textureManager.addTexture("metal", new Texture(new FileInputStream("/home/miguel/perfectday_project/JPCTExm/textures/rocks.jpg")));
        model = Loader.load3DS(new FileInputStream("/home/miguel/perfectday_project/blender_model/obj_export/montanya2.3ds"), 1);
        Object3D field = model[0];
        field.calcTextureWrapSpherical();
        field.setTexture("metal");
        field.setEnvmapped(Object3D.ENVMAP_DISABLED);
        field.setCenter(SimpleVector.ORIGIN);
        field.rotateX((float) (Math.PI /-2));
       
        int size = (int) field.getScale();
        System.out.println("SCALE:"+field.getScale());

        field.setOrigin(SimpleVector.ORIGIN);
        field.build();
        worldx.addObject(field);

in this code set Texture but they are dont show ver well

I use Blender to model created. But i new Blender used, and i dont know if i exporting my model well. How do i exporting model to set uv cordinates? i need exporting in .obj o .3ds.

Thank every body for help me.
#8
thank you  for a so quick answer
Igon, i called .build() in field-object and i used Software Render.

TextureManager textureManager = TextureManager.getInstance();
        textureManager.addTexture("metal", new Texture(new FileInputStream("/home/miguel/perfectday_project/JPCTExm/textures/rocks.jpg")));
        model = Loader.load3DS(new FileInputStream("/home/miguel/perfectday_project/blender_model/obj_export/plano.3ds"), 1);
        Object3D field = model[0];
        field.setTexture("metal");
        field.setEnvmapped(Object3D.ENVMAP_DISABLED);
        field.setCenter(SimpleVector.ORIGIN);
        field.rotateX((float) (Math.PI /-2));       
        int size = (int) field.getScale();
        System.out.println("SCALE:"+field.getScale());
        field.translate(-field.getScale()*(1), -field.getScale()*(1), 0);
        field.setOrigin(SimpleVector.ORIGIN);
        field.build();

JavaMan: i think you have got  a point there. the model may not have uv cordinates, How could i set them in  run time? Or should i set them in model design?
how can i set jpct in DEBUG mode? Does jpct use Log4J?
Thank you again.
#9
Hi all,i am a new jpct programer
at the moment i work  in a turn strategic game, in this game i use jpct but i am in trouble with textures and models.
i will explain my difficulties:
With this code i load a model and apply texture on it. but textures are not shown.

TextureManager textureManager = TextureManager.getInstance();
textureManager.addTexture("metal", new Texture(new FileInputStream("/home/miguel/perfectday_project/JPCTExm/textures/rocks.jpg")));
model = Loader.load3DS(new FileInputStream("/home/miguel/perfectday_project/blender_model/obj_export/plano.3ds"), 1);
Object3D field = model[0];
field.setTexture("metal");

if i don t load any model, and use Primitive to create a plane and apply texture on it the textures are shown.  ???

Object3D plane = Primitives.getPlane(1, 4);
        plane.translate(SimpleVector.ORIGIN);
        plane.setTexture("metal");
        plane.rotateX((float) (Math.PI /-2));
        plane.setEnvmapped(Object3D.ENVMAP_DISABLED);
        plane.build();

i have tried loading .obj and .3ds and textures are not applied tomy models ( i even tried loading very simple model like a cube or a plane)
I created these models  by using Blender 2.45  and exporting then to .0bj and 3ds. I dont know if the problem occurs when exporting the models or if it is due to the jpct configuration.
CarTest example works
Thank you  very much.
sorry for my english