Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How do I make each face of a cube have a different texture? Darkbasic Pro

Author
Message
NoteJam
19
Years of Service
User Offline
Joined: 11th Apr 2005
Location:
Posted: 5th May 2005 06:35
I would like to use the make cube object command to make a cube.
Then I want to texture it with bitmap textures I made with my code.
Each side of the cube should get a different texture.

My texture making code saves the textures as bitmaps in form "filename.bmp"

Quetion 2: How would I find the faces of object more complicated than a cube, so I can texture each with a different texture?

I use darkbasic pro
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th May 2005 07:23
It would be far easier to make a cube in a modelling program, and unwrap it. Basically, this means you have control over where to place the texture.

The same goes for question 2, modelling outside of DB Pro would be the only way.

BatVink
Ace Of Spades
19
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 5th May 2005 08:22
How many times has this been asked? I swear I just saw a different post identical to this a day or so ago.

Digitalmodr
Coder_David
[Apolloed ]
NoteJam
19
Years of Service
User Offline
Joined: 11th Apr 2005
Location:
Posted: 5th May 2005 09:10
Must be a command we all want added. Ok, I guess I can make a cube out of seperate objects of flat panes, then texture each in dbp to get the effect I am after. That rotating cube tutorial in the manuel is what gets us all wanting to try it.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 5th May 2005 14:48
There are ways to do this natively in DBP now Read here. Always use the search function of the site and check the DBP for more often for DBP questions like this.

http://forum.thegamecreators.com/?m=forum_view&t=51288&b=1

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 6th May 2005 00:29
You can of course use the new 5.8 commands to texture each side with a different part of 1 image. This code will make an image 3 by 2 in format:

123
456

i.e 6 different images in one image, or comment out the maketexture command and load in your own.



Boo!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th May 2005 01:27
hark at Spooky and his fancy ways! Looks very good, any chance you can elaborate on exactly what you are doing in your code?

BatVink
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 6th May 2005 01:58
Quite hard to explain and I don't know all the technical terms - still learning you see!

A DBPro cube is made of 6 sides but is actually 6 different polygons, each with four vertices (corners).

Front = vertics 0 - 3
Back = 4 - 7
Top = 8 - 11
Bottom = 12 - 15
Right = 16 - 19
Left = 20 - 23

Now, each vertex has a uv coordinate which determines which bit of your texture to paste on it.

Normally a DBPro cube pastes same data on each side going from 0,0 to 1,1 which is the entire image:



What I am doing is resetting the uv data on each vertex so that the relevant bit of the texture is pasted on the relevant side.



For example, side 1 - front face is vertices 0,1,2 and 3 where 0 is top left and they go clockwise round the face. Now our collage texture is laid out like:

123
456

so the uv data we need for face 1 goes from top left of 0,0 to bottom right of 1/3,1/2

So we basically reset vertex 0 uv to 0,0
vertex 1 to 1/3,0
vertex 2 to 1/3,1/2
vertex 3 to 0,1/2

which is selecting top left part of image to fill face 1 of cube. Then repeat for each face.

Boo!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 6th May 2005 02:24 Edited at: 6th May 2005 03:20
Would you be able to use the above code as part of a dection system for coillions?

<edit>
Plus just tried this with save image of the background made with the prog and then modifing the image and then loading it back in does not do what I expected, get small 1/4 width size image on the main image.

Hope the above make senes.

ps does the wired thing if I just save it as an image then load it back in.

In Space No One can Hear You Scream! (When your comm Line is cut?)

Login to post a reply

Server time is: 2024-09-23 19:28:38
Your offset time is: 2024-09-23 19:28:38