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.

DarkBASIC Professional Discussion / QUESTION? How Do I Texture a whole Matrix with just one texture?

Author
Message
TinTin
17
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 10th Nov 2023 22:27
Hi Guys
This is probably easy, but the solution evades me.

(Q1)
I have a matrix
that I want to paste a texture onto
I have used the following code to achieve this...


but this results in the texture being repeated 10x10 times, I just want 1 texture to cover whole matrix.
I've tried setting the PREPARE MATRIX TEXTURE Across & Down values to 0.1 but this just gives me a White Matrix.
Any Ideas?

(Q2)
How do I scroll this Texture, I'd like it to scroll constantly in one direction even as the matrix gets moved?

Thanks.
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 11th Nov 2023 08:55
>>> MAKE MATRIX mID, 1000,1000, 1, 1

The last 2 numbers set the matrix tiles subdivision , then the texture is applied to each tile.
Cheers
TinTin
17
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 11th Nov 2023 22:34
Ha Ha, That's what I thought Scorpio

but my matrix isn't a flat plain, it's been bent as if it's been draped over a large ball, so needs to be 10x10 tiles
hence the PREPARE MATRIX TEXTURE matrixID, imageID, 1, 1 which won't accept 0.1, 0.1 for the across & down parameters it only accepts integers.

From the Description of the command.
Quote: "
Each grid square in the matrix can have a tile texture, located within the image. Individual tile textures can be obtained from the single image by slicing it into sections both across and down. The tile textures are then assigned a number starting in the top left corner of the sectioned image and working across, then down. To section an image into 4 smaller tile textures you would specify 2 across and 2 down.
"


I even tried PREPARE MATRIX TEXTURE matrixID, imageID, 10, 10 but that repeats the texture 10x10 in each of the 10x10 matrix tiles?

But if I put PREPARE MATRIX TEXTURE matrixID, imageID, 5, 5 I Get 10x10 tiles displaying a quarter of the texture, so I'm guessing your suggestion is just displaying a small corner of the texture? instead of the respective 100th of the texture.

Thanks anyway.
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:00
Run this attachment, or just study the pictues.
Cheers
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:06
hope it works
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:10
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:10 Edited at: 12th Nov 2023 07:11
pictures

Attachments

Login to view attachments
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:11
2nd picture

Attachments

Login to view attachments
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 12th Nov 2023 07:19
Sorry for the mess but it doesnt allow to upload the zip file.
You will see from the example how to use a single texture to populate each tile of the matrix.
This is the command for it : SET MATRIX TILE Matrix Number, TileX, TileZ, Tile Number
Remember that the X and Z start from zero. You will notice it in the first picture.
press "t" to switch from the demo texture to the real one.
Cheers
TinTin
17
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 13th Nov 2023 00:53
Cheers Scorpio, I'll give that a try although it looks similar to what I already have except the textures are different.
I have a 256x256x16 all white with a large blue filled circle blurred around its edges into white, I'm thinking of mapping this onto a bent mesh to form a sky dome with the white providing a sort of Nadir on the horizon with 2 similar smaller meshes filled with a Cirrus cloud texture and a Cumulus cloud texture which will slowly scroll at different speeds (I don't want to use any plugins!)
I spent the whole of last night reading through the 'Hands On DarkBASIC Pro' books, typically the info I required was at the end of volume two.
1) the current issue with scaling the matrix texture
2) scrolling a matrix texture
3) the tricky stuff, I have an idea of using the texture to modify its own transparency and as far as the cumulus cloud layer applying displacement mapping to fake some volume.
I have two options on the go for the ground which is a separate mesh. one is a terrain system like my old massive terrain demo the other is an ocean system with waves & reflections (for a different project)

Thanks for the help anyway,


Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 13th Nov 2023 08:21
Well, I use a different method.
Make a sphere of proper size , squeeze it a bit to better simulate a skydome, position it properly, apply sky texture, scroll it at run time.
Make an additional squeezed sphere that crosses the sky at a certain height , apply a cloud texture and scroll it too .
In your case you probably don't want to scale the object texture (texture repeats) beyond 1



within the do --loop:


Cheers
TinTin
17
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 13th Nov 2023 15:52
Scorpyo, you should give up this programming lark and set up a small caravan to focus on your insane mind reading abilities.

the sample code you supplied above, was my initial approach but I decided (as this is an easy solution!) that it wasn't as good as I wanted; not that this method hasn't any uses! Parallax Stanfield's & Nebula anyone

Let me explain.
In the real world, at Sea level the maximum view distance is around 5km to the horizon. However, if Mt Everest was 6Km you would still see it (the top anyway!)
Cumulus Clouds (the Big Fluffy Ones) sit around 1Km above ground level and Cirrus Clouds (the Thin Wispy Ones) sit at around 8Km, above this the Atmosphere fades off into space at about 10Km.
Keeping these values within the realms of DBP is possible but 99.9% of the Skyspere would be below the horizon and since it would need a few verts to make it appear smooth, that's a lot of wasted points and polygons!
My new approach was to use a 6x6 matrix for each layer, and bar a few points at the corners everything else is above the horizon (shame scrolling/bump mapping/alpha shading isn't allowed!)
My ground plane is a separate Terrain Object that, although cantered around the camera like the sky layers, scrolls t's height map to keep up with the player. The new height values being procedurally created enables virtually limitless terrain.

I'm kind of stuck, (Rock & Hard Place) DBPro is playing up, one minute my app works (kind of) then just stops working after a re-compile either that or the exact opposite.

I forgot how frustrating DBPro can be. Grrrrr!

Cheers

Login to post a reply

Server time is: 2024-03-02 19:53:47
Your offset time is: 2024-03-02 19:53:47