Texture a cylinder with a wheels images

Blitz3D Forums/Blitz3D Beginners Area/Texture a cylinder with a wheels images

Blitzplotter(Posted 2009) [#1]
If you create a cylinder within B3D, can you identifiy the top and the bottom of the cylinder via code, and likewise identify the cylindrical/circular walls of the cylinder as child entities ? The reason is I would like to apply the following images to the respective sides of a cylinder:

Hub_cap_image: apply to the 'top' of a cylinder
inside_wheel_image: apply to the 'inner' of a cylinder
tyre_tread_image: apply to the 'circumference' of the cylinder

I think I can make a cylinder, give the cylinder child entities within Ultimate Unwrap 3D then import the 3d mesh to Blitz 3D with a view to achieving the above - but does anyone know how to achieve the above programmtically within Blitz 3D, i.e. assigning child entities to specific faces of a cylinder without having to use UU3D?

Thanks in advance, BP.


PowerPC603(Posted 2009) [#2]
Why would you use 3 textures instead of one?
You can use one image that you can use as texture, and when creating the vertices, give them the correct UV coordinates (X-Y coordinates that define where the vertex is located on the texture).

Then you have one object with one texture, instead of 3 objects with their seperate texture (resulting in 3 textures).
That would increase framerate if you have multiple wheels on your screen.


Blitzplotter(Posted 2009) [#3]
Thanks PowerPC603, I'll research how to create one image with the relevant textures on it. Thanks for the advice about my approach of using 3 separate images dragging down the frame rate. After your advice I found this:

http://www.blitzbasic.com/Community/posts.php?topic=44300

Which seems to provide the kind of guidance I need.


Ross C(Posted 2009) [#4]
You have UU. What to do is create a cylinder in UU and look at how the UV map is laid out. What you would then do, is export the UVmap outline, import this map into a paint package or photoshop type package, and draw over the outlines.

Then create a material in UU and apply this to the mesh. That should give you what you want.


Blitzplotter(Posted 2009) [#5]
@Ross C, thankyou for the extra info. This helps a lot as I just discovered that Latatoy is using spheres for his wheels in conjunction with the JV-ODE physics library, which was posing some extra questions about whether I should continue to use a cylinder for the wheels or a eliptical (squished) sphere, which really is what a 'true' wheel is. I will use a cylinder in the first instance to improve my 3d texturing skills associated with UU3D, then consider addressing using spheres for wheels as opposed to cylinders to combat the potential skipping problem.


Blitzplotter(Posted 2009) [#6]
Doing Well, right up to the part where I am applying my modified image to a material in order to appl it to the mesh..... Made a new material okay in UU3D called tyre_may however it is spherical?

Think have sussed it.... just needed to shift select all the faces in the left pane and apply bmp image voila..... textured wheel. Took me 50 mins or so of stumbling through (with my wife's help with GIMP, she the artist you see......).




Cheers Again Ross.


Ross C(Posted 2009) [#7]
Hmmm, I still fear you have not quite got this. I believe by the looks of it, you are unwrapping your cylinder, using a planar, or spherical unwrapping. If you select your clyinder, and choose cylinderical unwrapping, ensuring the axis is facing the right way, you will be able to map the front/back sides of the wheel, without the texture bleeding round the edges.

Let me get a little example.


Ross C(Posted 2009) [#8]
Ok, first off, i created a cylinder in UU. By default, the created meshes in UU are unwrapped well. The cylinder mesh has a cylindrical unwrapping technique to produce the UV map you see on the left pane:



Now you have the proper UVmap for a cylinder, export the UVmap, so you may paint over it, giving you the exact spot to apply your wheels, and tyre track.



Choose your size of texture, in this case 256 x 256 and preview, giving you this:



Save the map. Then take it into your painting/drawing application, and paint over the relevant details. I'm using paint, just for quickness :o) Then save.



Now back to UU. Select your cylinder wheel mesh, then right click on the materials at the top right, and choose new. A new material will be created and assigned to that mesh.



Right click on that newly created material and choose properties, then choose your diffuse maps you saved earlier in your paint package/drawing package.





Then your mesh should be textured perfectly!



Sorry if any of this was obvious. My main point is about the UV map. Notice how the wheel front and back, are completely seperate from the tyre track. This need to be like that so you don't get texture bleeding, due to the limited resolution of the texture map.

I really hope some of that helped...


jfk EO-11110(Posted 2009) [#9]
Let me add my 2c. You may use the same for the wheels front and back, should work in most cases (maybe not for superrealistic F1-Sim), so simply move and scale those Parts, move front ontop of back. You may also align everything in one "string": OMMMM , and then use something like 512*256px , not sure if UU can handle this.


Blitzplotter(Posted 2009) [#10]
@Ross, that is much clearer, will fire up my UU3D tonight and follow your instructions to prevent the texture bleed.

My unwrapped image had less polygons, i.e. no triangles just squares & 2 circles.... I did not select the cylindrical unwrap.


Ross C(Posted 2009) [#11]
Well, i don't know how many sections your wheel has. I just choose 8 sections for the demo :o)


stayne(Posted 2009) [#12]
Good form Ross :)


Blitzplotter(Posted 2009) [#13]
getting there, found the triangualte radio button, however I do not have UU3D Pro.... I can see I have separate areas now to apply my images to....




my exportuv GUI is a little different but all the options are there, apart from point and edge, I assume that is why I have clam shell polys....:



falling at one of the hurdles for why I know not......

Have selected the following however my bitmap is not appearing on my image.....






got to give up, work tomorrow. hang on, tried assign, seems to have worked....



thanks Ross.


Ross C(Posted 2009) [#14]
No worries man. I don't know about your UU version, but on my version, selecting the mesh, in the 3d window, then creating a material, applies the material right away. No matter, you can do it either way really :o) Glad you got it working.