How to make good textures?

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

How to make good textures?

Postby IVO_ » Fri Jun 26, 2009 8:56 pm

Hello.

I'm going to desing a 3D game with opengl es for the first time, and I'm not sure if I must create the textures with a program like 3ds max and after parse to valid xml for opengl or create them with opengl and apply jpgs textures...

Can someone help me?
IVO_
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Jun 26, 2009 8:52 pm

Top

3D model loading

Postby cg0601 » Tue Aug 04, 2009 12:26 pm

I have used Wings3D (freeware) and "Art Of Illusion"to generate 3d models and saved them in Wavefront obj format. Next I run a stand-alone Java program, which parses the OBJ file and generates some strings like these:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         int[] vertices =
  2.  
  3.         {
  4.  
  5.                 0, 0, 0, 56755, 32768, 0, 40132, 32768, 40132, 0, 32768, 56755, -40132, 32768, 40132, -56755, 32768, 0, -40132,
  6.  
  7.                 32768, -40132, 0, 32768, -56755, 40132, 32768, -40132, 56755, -218603, 0, 40132, -218603, 40132, 0, -218603, 56755,
  8.  
  9.                 -40132, -218603, 40132, -56755, -218603, 0, -40132, -218603, -40132, 0, -218603, -56755, 40132, -218603, -40132, 0,
  10.  
  11.                 258528, 0, 0, -167649, 0
  12.  
  13.         };
  14.  
  15.         int[] normals =
  16.  
  17.         {
  18.  
  19.                 0, 0, 0, 65314, 5377, 0, 45988, 8067, 45988, 0, 5377, 65314, -45988, 8067, 45988, -65314, 5377, 0, -45988, 8067,
  20.  
  21.                 -45988, 0, 5377, -65314, 45988, 8067, -45988, 23836, -61047, 0, 39812, -33539, 39812, 0, -61047, 23836, -39812,
  22.  
  23.                 -33539, 39812, -23836, -61047, 0, -39812, -33539, -39812, 0, -61047, -23836, 39812, -33539, -39812, 0, 65536, 0, 0,
  24.  
  25.                 -65536, 0
  26.  
  27.         };
  28.  
  29.         int[] coords =
  30.  
  31.         {
  32.  
  33.                 0, 0, 0
  34.  
  35.         };
  36.  
  37.  
  38.  
  39.         short[] faceVertices =
  40.  
  41.         {
  42.  
  43.                 1, 10, 9, 1, 16, 8, 1, 17, 2, 2, 10, 1, 2, 17, 3, 3, 10, 2, 3, 12, 11, 3, 17, 4, 4, 12, 3, 4, 17, 5, 5, 12, 4, 5,
  44.  
  45.                 14, 13, 5, 17, 6, 6, 14, 5, 6, 17, 7, 7, 14, 6, 7, 16, 15, 7, 17, 8, 8, 16, 7, 8, 17, 1, 9, 16, 1, 9, 18, 16, 10,
  46.  
  47.                 18, 9, 11, 10, 3, 11, 18, 10, 12, 18, 11, 13, 12, 5, 13, 18, 12, 14, 18, 13, 15, 14, 7, 15, 18, 14, 16, 18, 15
  48.  
  49.         };
  50.  
  51.  
  52.  
  53.         verticesFB = makeIntBuffer(vertices);
  54.  
  55.         texCoordsFB = makeIntBuffer(coords);
  56.  
  57.         normalsFB = makeIntBuffer(normals);
  58.  
  59.  
  60.  
  61.         missileFaces = makeShortBuffer(faceVertices);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


These I cut and paste into my Android application and then use the glDrawElements() call to display them. So far (with the example above and no textures) I can display roughly 60FPS. The model displays a "missile" and rotates it around the screen.

The issue I have with the 3D model is that I can not find a program that will create all faces using the same indices. When you use glDrawElements() you basically give a list of "faces" which are pointers into your vertices, texture coordinates and normals. The vertices are used for the basic drawing, the texture coordinates for mapping the texture to the object and the normals are needed to do the correct lighting.

In order to have this work correctly, the indices need all to use the same offset, because glDrawElements() can use only one index at a time.

Wings3D does generate the correct normal and vertex indices , which is seen by the fact that the OBJ file contains faces like this:
f 1//1 2//2 3//3
f 2//2 4//4 3//3

The // means that no coordinates are used. But I could not generate with any tool so far the correct vertex, normal and texture coords.

AoI for example will generate something like this:

f 1/1/3 2/2/5 3/3/2

In this case my texture indices and vertices use the same index, but my normals point wrong, which causes bad lighting, so that some faces are dark when oriented towards you for example.
Does anybody know about a tool that could help here ?

Or should I need to call glDrawElements for each array separately ?
Attachments
device02.png
Example screen
device02.png (16.81 KiB) Viewed 4095 times
cg0601
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Aug 04, 2009 8:53 am

Re: How to make good textures?

Postby VansFannel » Fri Dec 03, 2010 10:00 pm

How you find the answer? I have the same problem.
VansFannel
Freshman
Freshman
 
Posts: 7
Joined: Fri Dec 03, 2010 2:49 pm

Re: How to make good textures?

Postby sharmiroye » Tue Dec 07, 2010 4:11 am

sharmiroye
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Dec 07, 2010 4:05 am

Re: How to make good textures?

Postby millerni456 » Wed Oct 05, 2011 2:34 am

Solution to your problem...

Paint.NET and Google Images. :D

Paint.Net has a pixel generating effects that you can blur/lighten/darken and make simple textures suchs as fur, stone tiles, or even cartoon art. Although it'll be hard to achieve stone pathways or similar things, you can do a lot with it. Pain.NET also supports transparency and layering to make your life easier. Yes I am selling the product to you :P...

Don't worry it's freeware @ www.getpaint.net
Hope this helps! My fave editing program in my opinion. I even like it better than photoshop XD!
millerni456
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 05, 2011 12:39 am

Re: How to make good textures?

Postby roopa » Wed Oct 19, 2011 11:18 am

I definitely try these features.This definitely helps to my project.
roopa
Developer
Developer
 
Posts: 27
Joined: Wed Sep 14, 2011 6:46 am

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests