Step by Step Tutorial with Blender

Hi guys!

i fear this might be a big one, though i hope someone might help me anyways  :smiley:



I'm looking for a step-by-step tutorial, going through a complete process of creating a simple model with texture from an image in blender, to loading that model into jme.



I've played around some with both blender and jme, though the loading of the models either works without the textures/materials or not at all :frowning:



Thx in advance!

Look for a UV Mapping tutorial for Blender, then export it using the Wavefront OBJ exporter with the texture coordinates option selected. Then import that into jME, or load it using the ModelLoader in the jME test package. You should be good to go from there.

I'll give that a try, thx for the quick reply!

Heya!



I used a UV tutorial with blender all rigth, worked fine, exported that to obj format, worked also, when i reopen the obj file with blender it shows with textures. when i import the obj with jme it only shows a white box, so the texture is missing, here's my code:



@Override

    protected void initGame()

    {

        scene = new Node("scene graph node");

        buildLighting();

        Node model = null;

       

       

        ObjToJme C1 = new ObjToJme();

        ByteArrayOutputStream BO = new ByteArrayOutputStream();

        //URL maxFile = new URL("file:///home/perschon/Desktop/ship/Ship N061008.3DS");

        URL maxFile;

        try

        {

            maxFile = new URL("file:///home/perschon/Desktop/box.obj");

            C1.convert(new BufferedInputStream(maxFile.openStream()),BO);

            TriMesh tm = (TriMesh)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));

            scene.attachChild™;

        }

        catch (MalformedURLException e)

        {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

        catch (IOException e)

        {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

    }

Search the forums for ResourceLocator :slight_smile:

Also, make sure your scene has a light in it.

also make sure to call scene.updateRenderState() after attaching the model to the scene.

also make sure to consider all of the valuable hints these nice people are giving to you  :slight_smile:

sorry couldn't resist

hehe, thx people, by following a good tutorial in the wiki i figured how to get it done.

right now the texture IS rendered, although the dice doesn't look right, it seems one plane of it isn't rendered or something, i'll add some code so that i can view it from all sides and then i'll probably get back to you :slight_smile:



THX

it seems one plane of it isn't rendered or something

Check your normals (press 'N' in simpleGame implementation)...

Also check that you have a z-buffer state in one of the parent nodes of the dice.

I just changed the superclass of my app from BaseGame to SimpleGame and that works much better, the model and textures look ok, so i guess it was a z-buffer problem

me again :wink:



as i said using SimpleGame worked fine, added some mouse input for me to rotate the dice and it looks all right.

Now i tried to apply my new knowledge and write a StandardGame, using a simple box at first.



That worked out well, no problems, but when i substitute the simple box for my dice, i can only see 3 sides of it, the rest is black. now i was thinking if it's just a lighting thing, but then the box showed up all right from all sides… i'm a little confused here…



I also tried to add a ZBufferState to the dice node but then the screen remained completely black :frowning:

screenshot

as ordered  :smiley:

Looks like a light issue to me…



(if you want some friendly advice, stick with SimpleGame for a little while before moving to StandardGame; it can really help in the learning curve of jME…)

basixs said:

(if you want some friendly advice, stick with SimpleGame for a little while before moving to StandardGame; it can really help in the learning curve of jME...)


I appreciate friendly advice  :D

Its like i try something with SimpleGame and then i try to transfer it over to StandardGame, not sure if thats the best way of learning though ;)

Problem is that (at least at the moment) it seems to me that between SimpleGame and StandardGame there's lots of differences.



It was a lighting problem, i added a couple of lights and now everything's fine, thanks buddy!

Therefore you can enable/disable the lightstate by pressing "L" in SimpleGame. So everthing get lit up on every side.

At least this was the behaviour in jme1.