I am having 2 major problems with materials here.
The first problem is that I cannot simply import a mesh.xml file and have the material show up. When the model loads, I can see the material flashing onto the surface of the debug shape when I move the camera around, but it never stays. I tried adding a point light but that did not help.
The second problem occurs when I try to force an image to be on the model. When I import my image as a texture key, and apply it to the model, for some reason, the image is flipped and rotated 10 degrees from the model. I can tell this because the image I am loading is from Google Earth. When loaded, the image is as if it was spun around 180 degrees and ironed onto the model (like iron- on T-shirt paper). If there a way to fix this? I expect every model from google earth to do the same in the future, and I would like to not have to manually flip and rotate the images (as these will be dynamically loaded and selected by the user).
I can’t tell if the image from from the material file is correctly rotated/flipped because I cannot see it.
it’s hard to figure out the lighting problem from what you say, could you provide some screenshots?
Directional light is what you need imo, use a white color to have proper colors, and you can multiply the color to have a more intensive light like this :
light.setColor(ColorRGBA.White.mult(2));
this result in a twice as much intensive light as making it just white.
For the flipped texture, it looks like the exporter does not export uv correctly. Maybe you should post on the thread on ogre forum about this
Multiplying the directional lighting did the trick for brightening up the the terrain, but now the vehicle is all washed out.
here’s a SS with no additional intensity multiplication. The vehicle is perfect, but the terrain is really dull and dark
Here is with the intensity = 3.25 [java]light.setColor(ColorRGBA.White.mult(3.25f)); [/java]
You can see the difference pretty well.
Now as far as applying a texture to the model, I would kind of prefer that as it would save my users from having to hack the materials file of the terrain, or manually rename images. See, the terrain is a google earth export and comes with only a black and white photo. Users manually export a color image.
There are three ways of applying the image to the terrain.
- One would be to manually change the names of the image files to match the specific one generated and used in the .materials file (Really messy).
- Another way would be to manually change the name in the .materials file to the be the color image (again really nasty)
- And the last (and preferred) method would be to simply let the user specify the color image, then apply that as a texture key to the material which is applied to the geometry of the model (-- that’s a mouth full)
Now the problem with the last method is that for some reason, even though I am using the exact same color image file listed in the .materials when I try to apply the texture key… the image itself get flipped vertically. And by flipped, I mean that the text written on the image is even backwards. I could have users manually modify this image, but that is just adding to the hassle. Any ideas on how to fix this problem?
What type of modeler are you using to export the xml object? Are you using UV’s for the surfacing of the object before exporting?
Actually I’m using an OGRE exporter plugin for Google Sketchup. I don’t know how it works really. I think it is just triangles and material.
This is the plugin http://www.ogre3d.org/forums/viewtopic.php?t=20481
I think I just found a newer version of it while searching for that link. I’ll give that a try too.
Well i just tried the new version of that exporter, and it seems to work better. I also realized that I was still applying a material to the model (forgot to comment this part out when testing the image overlay workaround I mentioned earlier.)
At this point, I have a large model to light (several hundred world units) and it seems my light is too small and only seems to light a small area in the center of the model. I’ve added a directional light but the colors are all washed out and seem dark and dull.
What is your recommendation for lighting the scene well?
Also, now that I can see the underlying material of the model, I am certain the problem with applying a texture and material image persists. When I again apply the image to the model, the image is flipped and rotated 180 degrees. This is the exact same image that is referenced in the .material file. Any help with this?
Thanks!
I edited your post because li tags were ruining the page layout i don’t know why.
For the light you’ll have to tweak it…maybe using a light grey color can make it better, but honestly i don’t really know.
You can add a second light in a reverse direction…but the scene will be renderer once for each light, so the render will be slower.
for your texture problem , you mean that when using the .material it works properly, but when creating you own Material and apply the texture, it’s flipped?
could you upload the .material file? (or paste it if it’s short)
After testing this a lot with limited results, I think I would just prefer apply a material with the image to the model. I’m still having problems with this as for some reason, I am getting the flipped version of the material on the model when using standard methods. Any ideas on how to fix this?