I am trying to import a plane from Blender to which i am going to attach an image as texture. This plane will serve the purpose of a background image of space (universe). I know that i could just use a Box and that the box texture vertices are properly aligned for the image, but i am wondering how this could be done for a mesh (plane) that came out of a j3o blendered file using loadModel.
Also i am not interested in workarounds to this question, but really dealing with it this way, as i want to understand how mesh/texturing is done in jme3 with blender.
For example i want to load a different background to my plane each time. I don’t wan’t it to be a box though.
Created a plane in Blender
Converted it to j3o
loaded it in using loadModel
assigned material with texture (space image) to the loaded model
It is not properly aligned to the mesh/plane so i can see that it’s trying to do it (the colors are of the image), but the texture coordinates are not right so the texture looks like you’ve zoomed into the image by x100.
I tried that one Flip flag (true/false) didn’t help.
I tried playing with the materials and texture in Blender but when converting the .blend file to j3o i get an error that it cannot find the TextureAssets (TextureHelper null pointer, something like that). I think i read somewhere of a way to have the blender file properly reference the texture image, but can’t find it any more. Anyways even if it could i want to do this part programatically, not in Blender.
I think the problems is with setting the mesh’s texture coords, but the model from Blender does not have the textcoords at all (since i can’t convert from .blender to .j3o if it does). I tried looking into how to set them manually, but it seems difficult (BufferFloat or something) .
Bottom line is there a link to a tutorial with “.blender-j3o” topic? This might be the latest stuff so it might not be available yet.
I’d like to design my model in Blender, and assign the material (and texture) with code (due to code logic). Please let me know of the best way to do this!
found this article, but i am not using Ogre at all - just Blender and .blend files. I always add them to the assets folder and then i right-click-convert-to-j3o and then i reference this j3o when loading models with loadModel.
However i seem to be having some issues if the .blend model has textures…the conversion to j3o seems to fail with.
Also how would one add a texture to a .j3o that has been loaded with loadModel?
Thanks for the reply wezrule, i was on the same path so i am glad i see i’m not missing something, but now i realize that adding image texture to a more complex model would best be done in Blender, do you agree? For now my model is a simple cone, and i wanted to put checkers (red-white) around it, but the method above stretches out the image…i mean it makes sense that this is what happens since the default code can’t know exactly how the texture should be applied.
I guess my only path from here is to use Blender material/texture for more complex models. However i am unable to get Blender to work with Ogre (not being recognized as an export method), so i was hoping to use the new .blend convert to .j3o method and just work like that as to materials and textures.
Do you know how stable and functional is the .blend to .j3o conversion?
Yeh make the model in the blender, create UV’s, create a texture, and map the UV’s to it, make sure it looks good. Then remove all materials, then convert to .j3o. Not too sure on stability, its been improved a lot recently. I don’t use ogre (except once for an animation in blender 2.49b), i mainly use .blender/.obj, so im not sure about that sorry
I am having similar problems. A simple cylinder shape with a texture on top results in a j3o file where the texture is projected from the wrong axis. What I really want is just a simple cylinder where I can have a texture on the top and another on the bottom as well as another one along the sides. How would I go about doing that? I am very new to blender also so its quite a learning curve, but at least I was able to add a texture and normal map using simple generated mapping coords with a flat projection (top and bottom). I guess to get another texture on the cylinder circumference I need to do full UV image editing?
What is the preferred routine people have when working with 3d models in blender and want to use them in jme3? I’d love to hear how people go about with this. Do you create your UV texture maps in blender and save those so you can reload them in jme3?
I did try a bit of modelling in Google sketchup which is very simple to work with, and my exported ogre mesh created two separate geometries, one for the top and bottom and another for the circumference surfaces. But I had problems getting the cylinder smooth around as Sketchup shows them as smooth but the j3o created from the mesh/material results in surfaced sides. I also have this problem in blender as it wants to smooth the top an bottom as well which ruins the point. Somehow I got to get that smooth function to work only on the sides. Haha, yes I am stuck at getting a cylinder to look right so I guess there will be some time before I can model something real.
I was able to get it working. Created the model in Blender, made a UV map (actually opened a saved template and edited it in Paint.net and reloaded that, Blender fortunately has a reload button so its fast to test out), converted to j3o in jMonkey (only worked if the UV map image was in the same directory as the model) and created a material for it where I could choose the same UV map texture (that had to be flipped), and voila the j3o loaded easily as a one liner.
I noticed however that the hierarchy of the geometry created one extra node level which was unexpected, but I got around that too. When I did ray picking testing I got a geometry where the parent wasnt the j3o node (which I set the name for in code), a secondary container child node of this, so I had to get parent of parent on all j3o type loaded files to reach the node where I attached object user data (name, etc). I just simplified this to look backwards in parent hierarchy to find the node with my user data attribute that indicated it was up for “picking”.
I tried playing with the materials and texture in Blender but when converting the .blend file to j3o i get an error that it cannot find the TextureAssets (TextureHelper null pointer, something like that). I think i read somewhere of a way to have the blender file properly reference the texture image, but can't find it any more.
Quick question, does anybody know what's up with this? I got the same error importing a model:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
Obviously I'm not loading textures correctly from my blend file, but I have no idea how to fix it and this is all I could find in the forums. Using Blender 2.59 by the way.
YES! finally got it - i was missing texture image in the same folder as the model. jMonkey is sweet! Great stuff…just the last piece of the puzzle i was missing. Thanks to all of you above for the help - much appreciated.
To sum up for next guy that get’s stuck on this:
Create an object
Create texture from image (in blender it’s hard to notice it, but it’s in the list of texture types)
Assign texture from image to the material
Hit render to view your textured object
Save as .blend into your jmonkey project models folder
Save the textured image to that same folder
Right-click on the .blend file in jMonkey and convert it to j3o
View it using the scene viewer (you should now have the beautiful texture and material on the object)
You should also be able to store the textures in the “Textures” folder and the model in the “Models” folder. If the blend file correctly references the textures in the Texture folder you should be able to convert it as well. Important thing is that all files are in the assets folder.